Skip to content

Commit

Permalink
Show all favorites for an endpoint favorite if there is only one (#4440)
Browse files Browse the repository at this point in the history
* Show all favorites for the endpoint favorite if there is only one

* Missing changes
  • Loading branch information
nwmac committed Jul 22, 2020
1 parent fd17825 commit dd34fc5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
[endpointDisconnected]="endpointDisconnected"></app-favorites-meta-card>
</div>
<ng-container *ngIf="(searchedEntities$ | async) as searchedEntities">
<button class="favorite-entity-list__expand-button" *ngIf="searchedEntities.length > minLimit"
<button class="favorite-entity-list__expand-button" *ngIf="searchedEntities.length > minLimit && !autoExpand"
(click)="toggleExpand()" mat-icon-button>
<mat-icon *ngIf="(limitToggle$ | async) === null">expand_less</mat-icon>
<mat-icon *ngIf="(limitToggle$ | async) !== null">expand_more</mat-icon>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { IFavoriteEntity } from '../../../../../store/src/types/user-favorite-ma
})
export class FavoritesEntityListComponent implements OnInit {

constructor(private favoritesConfigMapper: FavoritesConfigMapper) { }
constructor(private favoritesConfigMapper: FavoritesConfigMapper) {}

@Input()
set entities(favoriteEntities: IFavoriteEntity[]) {
Expand All @@ -30,6 +30,9 @@ export class FavoritesEntityListComponent implements OnInit {
@Input()
public endpointDisconnected = false;

@Input()
public autoExpand = false;

@Input()
set endpointTypes(types: string[] | string) {
if (!this.favoriteTypes) {
Expand Down Expand Up @@ -144,5 +147,9 @@ export class FavoritesEntityListComponent implements OnInit {
map(([nameSearch, type, entities]) => entities.length === 0 && (!!nameSearch || !!type)),
startWith(false)
);

if (this.autoExpand) {
this.toggleExpand();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
}"></app-no-content-message>
</div>
<div class="favorite-list__group"
*ngFor="let favGroup of entityGroups;trackBy: trackByEndpointId; last as isLast">
*ngFor="let favGroup of entityGroups;trackBy: trackByEndpointId; last as isLast; count as count">
<app-favorites-meta-card class="favorite-list__endpoint-card" [endpoint]="true"
[endpointHasEntities]="favGroup.entities && favGroup.entities.length > 0"
[favoriteEntity]="favGroup.endpoint"></app-favorites-meta-card>
<app-favorites-entity-list *ngIf="favGroup.entities && favGroup.entities.length" class="favorite-list__entities"
[endpointTypes]="favGroup.endpoint.favorite.endpointType" [entities]="favGroup.entities"
[autoExpand]="count === 1"
[showFilters]="showFilters"></app-favorites-entity-list>
<div *ngIf="favGroup.entities && favGroup.entities.length && !isLast" class="favorite-list__seperator"></div>
</div>
Expand Down

0 comments on commit dd34fc5

Please sign in to comment.