</i>
</div>
<div cdsToggletipContent>
- <cd-health-checks [healthData]="healthData.health.checks"></cd-health-checks>
+ <div class="cds--popover-scroll-container">
+ <cd-health-checks [healthData]="healthData.health.checks"></cd-health-checks>
+ </div>
</div>
</cds-toggletip>
</ng-template>
</div>
<div cdsToggletipContent
#healthCheck>
- <cd-health-checks *ngIf="healthData?.health?.checks"
- [healthData]="healthData.health.checks">
- </cd-health-checks>
+ <div class="cds--popover-scroll-container">
+ <cd-health-checks *ngIf="healthData?.health?.checks"
+ [healthData]="healthData.health.checks">
+ </cd-health-checks>
+ </div>
</div>
</cds-toggletip>
</div>
</span>
</div>
<div cdsToggletipContent>
- <cd-health-checks [healthData]="healthData"></cd-health-checks>
+ <div class="cds--popover-scroll-container">
+ <cd-health-checks [healthData]="healthData"></cd-health-checks>
+ </div>
</div>
</cds-toggletip>
</ng-container>
</cd-health-pie>
</div>
<cds-popover-content>
- <ng-container *ngTemplateOutlet="logsLink"></ng-container>
- <ul>
- <li *ngFor="let pgStatesText of healthData.pg_info.statuses | keyvalue">
- {{ pgStatesText.key }}: {{ pgStatesText.value }}
- </li>
- </ul>
+ <div class="cds--popover-scroll-container">
+ <ng-container *ngTemplateOutlet="logsLink"></ng-container>
+ <ul>
+ <li *ngFor="let pgStatesText of healthData.pg_info.statuses | keyvalue">
+ {{ pgStatesText.key }}: {{ pgStatesText.value }}
+ </li>
+ </ul>
+ </div>
</cds-popover-content>
</div>
</cd-info-card>
</li>
</div>
<div cdsToggletipContent>
- <ul class="text-center">
- <li><h5><b i18n>Sync Status:</b></h5></li>
- <li *ngFor="let status of zone.fullSyncStatus">
- <span *ngIf="!status?.includes(zone.name) && !status?.includes(zone.syncstatus) && !status?.includes('failed') && !status?.includes('error')">
- <span *ngIf="status?.includes(':')">
- <b>{{ status.split(': ')[0] | titlecase }}</b>:{{ status.split(': ')[1] | titlecase}}
+ <div class="cds--popover-scroll-container">
+ <ul class="text-center">
+ <li><h5><b i18n>Sync Status:</b></h5></li>
+ <li *ngFor="let status of zone.fullSyncStatus">
+ <span *ngIf="!status?.includes(zone.name) && !status?.includes(zone.syncstatus) && !status?.includes('failed') && !status?.includes('error')">
+ <span *ngIf="status?.includes(':')">
+ <b>{{ status.split(': ')[0] | titlecase }}</b>:{{ status.split(': ')[1] | titlecase}}
+ </span>
+ <span *ngIf="!status?.includes(':')">
+ <b>{{ status | titlecase }}</b>
+ </span>
</span>
- <span *ngIf="!status?.includes(':')">
- <b>{{ status | titlecase }}</b>
+ <span *ngIf="status?.includes('failed') || status?.includes('error')">
+ {{ status | titlecase }}
</span>
- </span>
- <span *ngIf="status?.includes('failed') || status?.includes('error')">
- {{ status | titlecase }}
- </span>
- </li>
- </ul>
+ </li>
+ </ul>
+ </div>
</div>
</cds-toggletip>
<li class="mt-4 fw-bold"
</li>
</div>
<div cdsToggletipContent>
- <ul class="text-center">
- <li><h5><b i18n>Metadata Sync Status:</b></h5></li>
- <li *ngFor="let status of metadataSyncInfo.fullSyncStatus">
- <span *ngIf="!status?.includes(metadataSyncInfo.syncstatus) && !status?.includes('failed') && !status?.includes('error')">
- <span *ngIf="status?.includes(':')">
- <b>{{ status.split(':')[0] | titlecase }}</b>:{{ status.split(':')[1] | titlecase}}
+ <div class="cds--popover-scroll-container">
+ <ul class="text-center">
+ <li><h5><b i18n>Metadata Sync Status:</b></h5></li>
+ <li *ngFor="let status of metadataSyncInfo.fullSyncStatus">
+ <span *ngIf="!status?.includes(metadataSyncInfo.syncstatus) && !status?.includes('failed') && !status?.includes('error')">
+ <span *ngIf="status?.includes(':')">
+ <b>{{ status.split(':')[0] | titlecase }}</b>:{{ status.split(':')[1] | titlecase}}
+ </span>
+ <span *ngIf="!status?.includes(':')">
+ <b>{{ status | titlecase }}</b>
+ </span>
</span>
- <span *ngIf="!status?.includes(':')">
- <b>{{ status | titlecase }}</b>
+ <span *ngIf="status?.includes('failed') || status?.includes('error')">
+ {{ status | titlecase }}
</span>
- </span>
- <span *ngIf="status?.includes('failed') || status?.includes('error')">
- {{ status | titlecase }}
- </span>
- </li>
- </ul>
+ </li>
+ </ul>
+ </div>
</div>
</cds-toggletip>
<li class="mt-4 fw-bold"
ProgressIndicatorModule,
PanelModule,
LayoutModule,
- TilesModule
+ TilesModule,
+ PopoverModule
} from 'carbon-components-angular';
import EditIcon from '@carbon/icons/es/edit/20';
import CodeIcon from '@carbon/icons/es/code/16';
PanelModule,
ChartsModule,
LayoutModule,
- TilesModule
+ TilesModule,
+ PopoverModule
],
declarations: [
SparklineComponent,
-<ng-template #popoverTpl>
- <div [class]="class"
- [innerHtml]="html">
+<ng-template #tooltipTemplate>
+ <div class="cds--popover-scroll-container">
+ <div [class]="class"
+ [innerHtml]="html">
+ </div>
+ <ng-container *ngTemplateOutlet="content"></ng-container>
</div>
- <ng-content></ng-content>
</ng-template>
+@if (type === helperType.tooltip) {
+ <cds-tooltip [description]="tooltipTemplate"
+ [autoAlign]="true">
+ <svg [cdsIcon]="iconType"
+ [size]="iconSize"></svg>
+ </cds-tooltip>
+} @else {
+ <div class="inline-block"
+ [ngClass]="class">
+ <div
+ cdsPopover
+ [isOpen]="isPopoverOpen"
+ [autoAlign]="true"
+ (click)="togglePopover()"
+ (keydown.enter)="togglePopover()"
+ tabindex="0">
+ <div class="popover-trigger">
+ <svg
+ [cdsIcon]="iconType"
+ [size]="iconSize"></svg>
+ </div>
+ <cds-popover-content>
+ <div class="cds--popover-scroll-container"
+ (click)="$event.stopPropagation()">
+ <ng-container *ngTemplateOutlet="content"></ng-container>
+ </div>
+ </cds-popover-content>
+ </div>
+ </div>
+}
-<cds-tooltip [description]="popoverTpl"
- [autoAlign]="true">
- <svg cdsIcon="information"
- size="16"
- title="info"></svg>
-</cds-tooltip>
+<ng-template #content>
+ <ng-content></ng-content>
+</ng-template>
cds-tooltip {
margin-left: 5px;
}
+
+.inline-block {
+ display: inline-block;
+}
import { Component, Input } from '@angular/core';
+import { Icons } from '../../enum/icons.enum';
+import { HelperType } from '../../enum/cd-helper.enum';
@Component({
selector: 'cd-helper',
styleUrls: ['./helper.component.scss']
})
export class HelperComponent {
- @Input()
- class: string;
+ icons = Icons;
+ isPopoverOpen = false;
+ helperType = HelperType;
- @Input()
- iconClass = '';
+ // Tooltip: Displayed on hover or focus and contains contextual, helpful, and nonessential information.
+ // Popover: Displayed on click and can contain varying text and interactive elements
+ @Input() type: HelperType.tooltip | HelperType.popover = HelperType.tooltip; // Default to tooltip for backward compatibility
+ @Input() class: string;
+ @Input() html: any;
+ @Input() iconSize = this.icons.size16;
+ @Input() iconType = this.icons.info;
- @Input()
- html: any;
+ togglePopover() {
+ this.isPopoverOpen = !this.isPopoverOpen;
+ }
+
+ closePopover() {
+ if (this.type === HelperType.popover && this.isPopoverOpen) {
+ this.isPopoverOpen = false;
+ }
+ }
}
--- /dev/null
+export enum HelperType {
+ popover = 'popover',
+ tooltip = 'tooltip'
+}
/******************************************
Carbon Popover
******************************************/
+.cds--popover {
+ .cds--popover-caret {
+ background-color: theme.$background;
+ }
+}
+
.cds--popover-content {
- background-color: theme.$layer-02;
+ background-color: theme.$background;
+}
+
+// inner container class for overflow
+.cds--popover-scroll-container {
max-height: layout.$spacing-13;
- overflow: auto;
+ overflow-y: auto;
+ margin-right: -1rem;
+ padding-right: 1rem;
}
/******************************************