Skip to content

Commit

Permalink
Merge pull request #313 from SUSE/workload-loading-indicator
Browse files Browse the repository at this point in the history
Add loading indicator for Workload resource stats
  • Loading branch information
nwmac committed Feb 17, 2020
2 parents 962bfd7 + 1aed15d commit daedc68
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,22 @@
</app-tile-grid>

<app-metadata-item class="chart-details__item" label="All Resources"></app-metadata-item>
<div *ngIf="resources$ | async as resources" class="grid">
<app-card-number-metric *ngFor="let res of resources" label="{{ res.label }}" icon="{{ res.icon.name }}"
iconFont="{{ res.icon.font }}" value="{{ res.count }}">
</app-card-number-metric>
<div *ngIf="hasAllResources$ | async; else stillLoadingResources">
<div *ngIf="resources$ | async as resources" class="grid">
<app-card-number-metric *ngFor="let res of resources" label="{{ res.label }}" icon="{{ res.icon.name }}"
iconFont="{{ res.icon.font }}" value="{{ res.count }}">
</app-card-number-metric>
</div>
</div>
<ng-template #stillLoadingResources>
<div class="resources__loading">
<div class="resources__loading__content">
Updating Resource Information
<mat-progress-bar class="" [color]="'primary'" mode="indeterminate">
</mat-progress-bar>
</div>
</div>
</ng-template>
</div>
<ng-template #loadingResources>
<div class="resources__loading">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export class HelmReleaseSummaryTabComponent implements OnDestroy {
private busyDeletingSubject = new ReplaySubject<boolean>();
public isBusy$: Observable<boolean>;
public hasResources$: Observable<boolean>;
public hasAllResources$: Observable<boolean>;
private readonly DEFAULT_LOADING_MESSAGE = 'Retrieving Release Details';
public loadingMessage = this.DEFAULT_LOADING_MESSAGE;

Expand Down Expand Up @@ -134,6 +135,13 @@ export class HelmReleaseSummaryTabComponent implements OnDestroy {
map(([chartData, resources]) => !!chartData && !!resources)
);

this.hasAllResources$ = combineLatest([
this.resources$,
this.hasResources$
]).pipe(
map(([resources, hasSome]) => hasSome && resources && resources.length > 0)
);

this.deleteReleaseConfirmation = new ConfirmationDialogConfig(
`Delete Workload`,
{
Expand Down

0 comments on commit daedc68

Please sign in to comment.