From: Naman Munet Date: Tue, 8 Jul 2025 15:26:34 +0000 (+0530) Subject: mgr/dashboard: add reusable carbon popover X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F64388%2Fhead;p=ceph.git mgr/dashboard: add reusable carbon popover https://tracker.ceph.com/issues/72002 Signed-off-by: Naman Munet --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/upgrade/upgrade.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/upgrade/upgrade.component.html index 85a7333437e0..440986c535aa 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/upgrade/upgrade.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/upgrade/upgrade.component.html @@ -58,7 +58,9 @@
- +
+ +
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard-v3/dashboard/dashboard-v3.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard-v3/dashboard/dashboard-v3.component.html index baa80cb41eb4..c4b8ec5e7cb2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard-v3/dashboard/dashboard-v3.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard-v3/dashboard/dashboard-v3.component.html @@ -167,9 +167,11 @@
- - +
+ + +
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.html index 18ceaf85672f..b015c7323361 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.html @@ -28,7 +28,9 @@
- +
+ +
@@ -161,12 +163,14 @@ - -
    -
  • - {{ pgStatesText.key }}: {{ pgStatesText.value }} -
  • -
+
+ +
    +
  • + {{ pgStatesText.key }}: {{ pgStatesText.value }} +
  • +
+
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-sync-data-info/rgw-sync-data-info.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-sync-data-info/rgw-sync-data-info.component.html index cbf9b033792a..920a548f50b0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-sync-data-info/rgw-sync-data-info.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-sync-data-info/rgw-sync-data-info.component.html @@ -25,22 +25,24 @@
-
    -
  • Sync Status:
  • -
  • - - - {{ status.split(': ')[0] | titlecase }}:{{ status.split(': ')[1] | titlecase}} +
    +
      +
    • Sync Status:
    • +
    • + + + {{ status.split(': ')[0] | titlecase }}:{{ status.split(': ')[1] | titlecase}} + + + {{ status | titlecase }} + - - {{ status | titlecase }} + + {{ status | titlecase }} - - - {{ status | titlecase }} - -
    • -
    +
  • +
+
  • -
      -
    • Metadata Sync Status:
    • -
    • - - - {{ status.split(':')[0] | titlecase }}:{{ status.split(':')[1] | titlecase}} +
      +
        +
      • Metadata Sync Status:
      • +
      • + + + {{ status.split(':')[0] | titlecase }}:{{ status.split(':')[1] | titlecase}} + + + {{ status | titlecase }} + - - {{ status | titlecase }} + + {{ status | titlecase }} - - - {{ status | titlecase }} - -
      • -
      +
    • +
    +
  • -
    + +
    +
    +
    +
    -
    +@if (type === helperType.tooltip) { + + + +} @else { +
    +
    +
    + +
    + +
    + +
    +
    +
    +
    +} - - - + + + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/helper/helper.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/helper/helper.component.scss index bf5c67b4cc7f..68f53090d11b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/helper/helper.component.scss +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/helper/helper.component.scss @@ -1,3 +1,7 @@ cds-tooltip { margin-left: 5px; } + +.inline-block { + display: inline-block; +} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/helper/helper.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/helper/helper.component.ts index 073fb37a0718..c55d1abfc9de 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/helper/helper.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/helper/helper.component.ts @@ -1,4 +1,6 @@ import { Component, Input } from '@angular/core'; +import { Icons } from '../../enum/icons.enum'; +import { HelperType } from '../../enum/cd-helper.enum'; @Component({ selector: 'cd-helper', @@ -6,12 +8,25 @@ import { Component, Input } from '@angular/core'; 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; + } + } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/cd-helper.enum.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/cd-helper.enum.ts new file mode 100644 index 000000000000..8c64ce99705c --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/cd-helper.enum.ts @@ -0,0 +1,4 @@ +export enum HelperType { + popover = 'popover', + tooltip = 'tooltip' +} diff --git a/src/pybind/mgr/dashboard/frontend/src/styles/_carbon-defaults.scss b/src/pybind/mgr/dashboard/frontend/src/styles/_carbon-defaults.scss index b1ba3d9ec478..289e2f0fa20f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/styles/_carbon-defaults.scss +++ b/src/pybind/mgr/dashboard/frontend/src/styles/_carbon-defaults.scss @@ -168,10 +168,22 @@ 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; } /******************************************