Revert "[CST-5535] hide empty panels"

This reverts commit 692ab040dc.
This commit is contained in:
Davide Negretti
2022-06-06 16:18:22 +02:00
parent eca9f79924
commit 39cba0414a
2 changed files with 19 additions and 30 deletions

View File

@@ -1,27 +1,25 @@
<p class="h4">{{'health-page.status' | translate}} : <ds-health-status [status]="healthResponse.status"></ds-health-status></p>
<ngb-accordion #acc="ngbAccordion" [activeIds]="activeId">
<ng-container *ngFor="let entry of healthResponse.components | dsObjNgFor">
<ngb-panel [id]="entry.key" *ngIf="showEntryData(entry.value)">
<ng-template ngbPanelHeader>
<div class="w-100 d-flex justify-content-between collapse-toggle" ngbPanelToggle (click)="acc.toggle(entry.key)" data-test="component">
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="!acc.isExpanded(entry.key)"
aria-controls="collapseExample">
{{ getPanelLabel(entry.key) | titlecase }}
</button>
<div class="text-right d-flex">
<ds-health-status [status]="entry.value?.status"></ds-health-status>
<div class="ml-3 d-inline-block">
<span *ngIf="acc.isExpanded(entry.key)" class="fas fa-chevron-up fa-fw"></span>
<span *ngIf="!acc.isExpanded(entry.key)" class="fas fa-chevron-down fa-fw"></span>
</div>
<ngb-panel [id]="entry.key" *ngFor="let entry of healthResponse.components | dsObjNgFor">
<ng-template ngbPanelHeader>
<div class="w-100 d-flex justify-content-between collapse-toggle" ngbPanelToggle (click)="acc.toggle(entry.key)" data-test="component">
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="!acc.isExpanded(entry.key)"
aria-controls="collapseExample">
{{ getPanelLabel(entry.key) | titlecase }}
</button>
<div class="text-right d-flex">
<ds-health-status [status]="entry.value?.status"></ds-health-status>
<div class="ml-3 d-inline-block">
<span *ngIf="acc.isExpanded(entry.key)" class="fas fa-chevron-up fa-fw"></span>
<span *ngIf="!acc.isExpanded(entry.key)" class="fas fa-chevron-down fa-fw"></span>
</div>
</div>
</ng-template>
<ng-template ngbPanelContent>
<ds-health-component [healthComponent]="entry.value" [healthComponentName]="entry.key"></ds-health-component>
</ng-template>
</ngb-panel>
</ng-container>
</div>
</ng-template>
<ng-template ngbPanelContent>
<ds-health-component [healthComponent]="entry.value" [healthComponentName]="entry.key"></ds-health-component>
</ng-template>
</ngb-panel>
</ngb-accordion>

View File

@@ -1,7 +1,6 @@
import { Component, Input, OnInit } from '@angular/core';
import { HealthResponse } from '../models/health-component.model';
import { TranslateService } from '@ngx-translate/core';
import {isNotEmpty} from '../../shared/empty.util';
@Component({
selector: 'ds-health-panel',
@@ -30,7 +29,7 @@ export class HealthPanelComponent implements OnInit {
/**
* Return translated label if exist for the given property
*
* @param panelKey
* @param property
*/
public getPanelLabel(panelKey: string): string {
const translationKey = `health-page.section.${panelKey}.title`;
@@ -38,12 +37,4 @@ export class HealthPanelComponent implements OnInit {
return (translation === translationKey) ? panelKey : translation;
}
/**
* Check if the current entry has data to be shown
* @param entryValue
*/
showEntryData(entryValue) {
return isNotEmpty(entryValue?.components) || isNotEmpty(entryValue?.details);
}
}