Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Commit

Permalink
Prevent password show/hide icon from receiving focus (#4776)
Browse files Browse the repository at this point in the history
* Prevent password show/hide icon from receiving focus

* Fix lint issues
  • Loading branch information
nwmac committed Nov 16, 2020
1 parent 26b0734 commit 00dbcf9
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 41 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class CardCfRecentAppsComponent implements OnInit {
if (!this.allApps$) {
this.allApps$ = this.appsPagObs.entities$;
this.loading$ = this.appsPagObs.fetchingEntities$;
this.hasEntities$ = this.appsPagObs.hasEntities$
this.hasEntities$ = this.appsPagObs.hasEntities$;
} else {
this.hasEntities$ = of(true);
}
Expand All @@ -84,7 +84,7 @@ export class CardCfRecentAppsComponent implements OnInit {
}

private fetchAppStats(recentApps: APIResource<IApp>[]) {
if(!this.noStats) {
if (!this.noStats) {
recentApps.forEach(app => {
if (app.entity.state === 'STARTED') {
cfEntityCatalog.appStats.api.getMultiple(app.metadata.guid, this.endpoint);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ export class CompactAppCardComponent implements OnInit {

) { }
ngOnInit() {
if(this.activeRouteCfOrgSpace) {
if (this.activeRouteCfOrgSpace) {
this.bcType = this.setBreadcrumbType(this.activeRouteCfOrgSpace);
if (!this.endpoint) {
this.endpoint = this.activeRouteCfOrgSpace.cfGuid;
}
}

if (!this.app) {
return
return;
}

const initState = this.appStateService.get(this.app.entity, null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ import { ITileConfig } from './../../../../../core/src/shared/components/tile/ti
})
export class CFHomeCardComponent implements HomePageEndpointCard {

_layout: HomePageCardLayout;
pLayout: HomePageCardLayout;

get layout(): HomePageCardLayout {
return this._layout;
return this.pLayout;
}

@Input() set layout(value: HomePageCardLayout) {
if (value) {
this._layout = value;
this.pLayout = value;
}
this.updateLayout();
};
}

@Input() set endpoint(value: EndpointModel) {
this.guid = value.guid;
Expand Down Expand Up @@ -89,7 +89,7 @@ export class CFHomeCardComponent implements HomePageEndpointCard {
appDeploySourceTypes: ApplicationDeploySourceTypes,
) {
// Set a default layout
this._layout = new HomePageCardLayout(1, 1);
this.pLayout = new HomePageCardLayout(1, 1);

// Get source types for if we are showing tiles to deploy an application
this.sourceTypes = appDeploySourceTypes.getTypes();
Expand All @@ -110,7 +110,7 @@ export class CFHomeCardComponent implements HomePageEndpointCard {
if (tile) {
const query = {
[BASE_REDIRECT_QUERY]: `applications/new/${this.guid}`,
[AUTO_SELECT_CF_URL_PARAM]:this.guid
[AUTO_SELECT_CF_URL_PARAM]: this.guid
};
if (tile.data.subType) {
query[AUTO_SELECT_DEPLOY_TYPE_URL_PARAM] = tile.data.subType;
Expand All @@ -126,7 +126,7 @@ export class CFHomeCardComponent implements HomePageEndpointCard {
this.appCount$ = CloudFoundryEndpointService.fetchAppCount(this.store, this.pmf, this.guid);
this.orgCount$ = CloudFoundryEndpointService.fetchOrgCount(this.store, this.pmf, this.guid);

this.appLink = () => goToAppWall(this.store, this.guid);;
this.appLink = () => goToAppWall(this.store, this.guid);

const appsPagObs = cfEntityCatalog.application.store.getPaginationService(this.guid);

Expand Down Expand Up @@ -192,8 +192,6 @@ export class CFHomeCardComponent implements HomePageEndpointCard {
}

private restrictApps(apps: APIResource<IApp>[]): APIResource<IApp>[] {
return !apps ? [] :[...apps.sort(appDataSort).slice(0, this.recentAppsRows)];
return !apps ? [] : [...apps.sort(appDataSort).slice(0, this.recentAppsRows)];
}

}

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<button mat-icon-button (click)="show = !show" [attr.aria-label]="'Hide password'" [attr.aria-pressed]="!show"
<button tabindex="-1" mat-icon-button (click)="show = !show" [attr.aria-label]="'Hide password'" [attr.aria-pressed]="!show"
type="button">
<mat-icon>{{!show ? 'visibility_off' : 'visibility'}}</mat-icon>
</button>
5 changes: 2 additions & 3 deletions src/frontend/packages/core/src/features/home/home.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export abstract class HomePageEndpointCard {
}

export interface LinkMetadata {
favs: IHydrationResults[],
shortcuts: HomeCardShortcut[]
favs: IHydrationResults[];
shortcuts: HomeCardShortcut[];
}

Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class FavoritesSidePanelComponent implements PreviewableComponent {
name: string;

setProps(props: { [key: string]: any; }): void {
this.favorites$ = props.favorites$
this.favorites$ = props.favorites$;
this.name = props.endpoint.name;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('HomePageEndpointCardComponent', () => {

afterEach(() => {
component.ngOnDestroy();
})
});

it('should create', () => {
expect(component).toBeTruthy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ const MAX_LINKS = 5;
})
export class HomePageEndpointCardComponent implements OnInit, OnDestroy, AfterViewInit {

@ViewChild('customCard', {read:ViewContainerRef}) customCard: ViewContainerRef;
@ViewChild('customCard', {read: ViewContainerRef}) customCard: ViewContainerRef;

@Input() endpoint: EndpointModel;

_layout: HomePageCardLayout;
pLayout: HomePageCardLayout;

get layout(): HomePageCardLayout {
return this._layout;
return this.pLayout;
}

@Input() set layout(value: HomePageCardLayout) {
if (value) {
this._layout = value;
this.pLayout = value;
}
this.updateLayout();
};
}

@Output() loaded = new EventEmitter<HomePageEndpointCardComponent>();

Expand Down Expand Up @@ -102,7 +102,7 @@ export class HomePageEndpointCardComponent implements OnInit, OnDestroy, AfterVi

ngAfterViewInit() {
// Dynamically load the component for the Home Card for this endopoint
const endpointEntity = entityCatalog.getEndpoint(this.endpoint.cnsi_type, this.endpoint.sub_type)
const endpointEntity = entityCatalog.getEndpoint(this.endpoint.cnsi_type, this.endpoint.sub_type);
if (endpointEntity && endpointEntity.definition.homeCard && endpointEntity.definition.homeCard.component) {
this.createCard(endpointEntity);
} else {
Expand All @@ -116,7 +116,7 @@ export class HomePageEndpointCardComponent implements OnInit, OnDestroy, AfterVi
map(f => f.map(item => this.userFavoriteManager.mapToHydrated(item)))
);

this.entity = entityCatalog.getEndpoint(this.endpoint.cnsi_type, this.endpoint.sub_type)
this.entity = entityCatalog.getEndpoint(this.endpoint.cnsi_type, this.endpoint.sub_type);
if (this.entity) {
this.definition = this.entity.definition;
this.favorite = this.favoritesConfigMapper.getFavoriteEndpointFromEntity(this.endpoint);
Expand Down Expand Up @@ -187,7 +187,7 @@ export class HomePageEndpointCardComponent implements OnInit, OnDestroy, AfterVi
public updateLayout() {
this.layout$.next(this.layout);
if (this.ref && this.ref.instance) {
this.ref.instance.layout = this._layout;
this.ref.instance.layout = this.pLayout;
}
}

Expand All @@ -196,7 +196,7 @@ export class HomePageEndpointCardComponent implements OnInit, OnDestroy, AfterVi
const component = await endpointEntity.definition.homeCard.component(this.compiler, this.injector);
this.ref = this.customCard.createComponent(component);
this.ref.instance.endpoint = this.endpoint;
this.ref.instance.layout = this._layout;
this.ref.instance.layout = this.pLayout;
this.loadCardIfReady();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class HomePageComponent implements AfterViewInit, OnInit, OnDestroy {
).subscribe(id => {
const selected = this.layouts.find(hpcl => hpcl && hpcl.id === id) || this.layouts[0];
this.onChangeLayout(selected);
})
});
}

ngOnInit() {
Expand Down Expand Up @@ -152,10 +152,10 @@ export class HomePageComponent implements AfterViewInit, OnInit, OnDestroy {
} else {
remaining.push(index);
}
};
}
this.processCardsToLoad();
this.notLoadedCardIndices = remaining;
})
});
}

processCardsToLoad() {
Expand Down Expand Up @@ -184,7 +184,7 @@ export class HomePageComponent implements AfterViewInit, OnInit, OnDestroy {

setCardsToLoad(cards: any[]) {
this.notLoadedCardIndices = [];
for(let i=0;i< cards.length; i++) {
for (let i = 0; i < cards.length; i++) {
this.notLoadedCardIndices.push(i);
}
setTimeout(() => this.checkCardsInView(), 1);
Expand Down Expand Up @@ -263,7 +263,7 @@ export class HomePageComponent implements AfterViewInit, OnInit, OnDestroy {
processed[ep.guid] = true;
result.push(ep);
}
})
});

// Filter out the disconnected ones
return result.filter(ep => ep.connectionStatus === 'connected');
Expand All @@ -277,7 +277,7 @@ export class HomePageComponent implements AfterViewInit, OnInit, OnDestroy {
return !!defn.definition.homeCard;
})),
map(eps => {
switch(eps.length) {
switch (eps.length) {
case 1:
return this.getLayout(1, 1);
case 2:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ export class KubernetesHomeCardComponent implements OnInit {

@Input() endpoint: EndpointModel;

_layout: HomePageCardLayout;
pLayout: HomePageCardLayout;

get layout(): HomePageCardLayout {
return this._layout;
return this.pLayout;
}

@Input() set layout(value: HomePageCardLayout) {
if (value) {
this._layout = value;
this.pLayout = value;
}
};
}

public shortcuts: HomeCardShortcut[];

Expand Down
4 changes: 2 additions & 2 deletions src/frontend/packages/store/src/user-favorite-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ export class UserFavoriteManager {
if (f.endpointId === endpointID && f.entityId) {
result.push(f);
}
})
});
return result;
})
)
);
}

public getEndpointIDFromFavoriteID(id: string): string {
Expand Down

0 comments on commit 00dbcf9

Please sign in to comment.