From 1dd42e1a339ef4cf1f3253534646aa6c9342233d Mon Sep 17 00:00:00 2001 From: Afreen Misbah Date: Fri, 11 Jul 2025 01:59:12 +0530 Subject: [PATCH] mgr/dashboard:Fixed issue with clipboard icon - clipboard icon not displaying breaking several places - cliboard icon on click gets filed primary green color losing the visibilty of icon. The icon now remain visible on click - clipboard button for path and copy in tables on mouseover does not give `hand` but `cursor`. which was not ideal from a usability standpoint. This behavior has been updated to use the hand cursor making the interaction semantically correct and more intuitive for users. Signed-off-by: Afreen Misbah --- ...ephfs-snapshotschedule-list.component.html | 21 +++++------- .../card-row/card-row.component.html | 6 ++-- .../copy2clipboard-button.component.html | 33 ++++++++----------- .../copy2clipboard-button.component.scss | 9 +++++ .../copy2clipboard-button.component.ts | 9 ++++- .../components/icon/icon.component.html | 26 ++------------- .../components/icon/icon.component.scss | 4 ++- .../components/icon/icon.component.spec.ts | 10 +++--- .../shared/components/icon/icon.component.ts | 15 +++++---- .../datatable/table/table.component.html | 19 +++++------ .../src/app/shared/enum/icons.enum.ts | 5 +-- .../frontend/src/styles/_carbon-defaults.scss | 4 +++ 12 files changed, 77 insertions(+), 84 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-snapshotschedule-list/cephfs-snapshotschedule-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-snapshotschedule-list/cephfs-snapshotschedule-list.component.html index ee790712d1681..46d6c0f1848a3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-snapshotschedule-list/cephfs-snapshotschedule-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-snapshotschedule-list/cephfs-snapshotschedule-list.component.html @@ -38,19 +38,14 @@ - {{ row.pathForSelection?.split?.("@")?.[0] }} - - - + + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/card-row/card-row.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/card-row/card-row.component.html index a5a2f495f1c06..3ed393aa6fed4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/card-row/card-row.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/card-row/card-row.component.html @@ -62,7 +62,7 @@ {{ data.info }} + type="infoCircle"> - - + {{ data.up }} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/copy2clipboard-button/copy2clipboard-button.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/copy2clipboard-button/copy2clipboard-button.component.html index f91ff8eafd6bd..4046a4e2a2153 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/copy2clipboard-button/copy2clipboard-button.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/copy2clipboard-button/copy2clipboard-button.component.html @@ -1,20 +1,15 @@ - - - - - - - - + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/copy2clipboard-button/copy2clipboard-button.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/copy2clipboard-button/copy2clipboard-button.component.scss index e69de29bb2d1d..72ec3a89b8ef9 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/copy2clipboard-button/copy2clipboard-button.component.scss +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/copy2clipboard-button/copy2clipboard-button.component.scss @@ -0,0 +1,9 @@ +.clipboard-btn { + border: none; + box-shadow: none; + outline: none; +} + +.clipboard-btn-with-text { + color: inherit; +} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/copy2clipboard-button/copy2clipboard-button.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/copy2clipboard-button/copy2clipboard-button.component.ts index b6b8ca77e8adb..2b82b76f5a512 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/copy2clipboard-button/copy2clipboard-button.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/copy2clipboard-button/copy2clipboard-button.component.ts @@ -11,14 +11,21 @@ import { Icons } from '~/app/shared/enum/icons.enum'; styleUrls: ['./copy2clipboard-button.component.scss'] }) export class Copy2ClipboardButtonComponent { + // The text to be copied @Input() private source: string; + // Optional: Extracts text to be copied by "id" attribute @Input() byId = true; + // Size of the button @Input() - showIconOnly = false; + size = 'md'; + + // Optional: Adds text to the left of copy icon + @Input() + text?: string; icons = Icons; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.html index 2e6522bd93891..f1182dd46d037 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.html @@ -1,23 +1,3 @@ -@if (type === ICON_TYPE.danger) { - -} - -@if (type === ICON_TYPE.info) { - -} - -@if (type === ICON_TYPE.success) { - -} - -@if (type === ICON_TYPE.warning) { - -} + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.scss index e0a3d2050b34e..96e563783678d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.scss +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.scss @@ -8,7 +8,9 @@ color: theme.$support-error; } -.info-icon { +//@TODO: this naming needs to be changed +// Do this after converting Icons enum to const +.infoCircle-icon { color: theme.$support-info; } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.spec.ts index c14459401a617..720480b0960e5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.spec.ts @@ -1,16 +1,18 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; +import { configureTestBed } from '~/testing/unit-test-helper'; import { IconComponent } from './icon.component'; describe('IconComponent', () => { let component: IconComponent; let fixture: ComponentFixture; - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [IconComponent] - }).compileComponents(); + configureTestBed({ + declarations: [IconComponent], + imports: [] + }); + beforeEach(() => { fixture = TestBed.createComponent(IconComponent); component = fixture.componentInstance; fixture.detectChanges(); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.ts index 82bb1981836aa..a4442d559e3d1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.ts @@ -1,15 +1,18 @@ -import { Component, Input } from '@angular/core'; -import { ICON_TYPE, Icons, IconsSize } from '../../enum/icons.enum'; +import { Component, Input, OnInit } from '@angular/core'; +import { ICON_TYPE, Icons, IconSize } from '../../enum/icons.enum'; @Component({ selector: 'cd-icon', templateUrl: './icon.component.html', styleUrl: './icon.component.scss' }) -export class IconComponent { +export class IconComponent implements OnInit { @Input() type!: keyof typeof ICON_TYPE; - @Input() size: IconsSize = IconsSize.size16; + @Input() size: IconSize = IconSize.size16; - readonly ICONS = Icons; - readonly ICON_TYPE = ICON_TYPE; + icon: string; + + ngOnInit() { + this.icon = Icons[this.type]; + } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.html index da5a96d3a6b60..a530d728420aa 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.html @@ -379,23 +379,20 @@ - {{ value | path }} - - - + + - {{value}} + [size]="lg" + [text]="value"> diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/icons.enum.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/icons.enum.ts index 9d5c95413209a..8c86a302f18bb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/icons.enum.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/icons.enum.ts @@ -99,7 +99,7 @@ export enum Icons { inverse = 'fa fa-inverse' // To get an alternative icon color } -export enum IconsSize { +export enum IconSize { size16 = '16', size20 = '20', size24 = '24', @@ -107,8 +107,9 @@ export enum IconsSize { } export const ICON_TYPE = { + copy: 'copy', danger: 'danger', - info: 'info', + infoCircle: 'info-circle', success: 'success', warning: 'warning' } as const; 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 f66478d7ccba6..7bc6e6c007902 100644 --- a/src/pybind/mgr/dashboard/frontend/src/styles/_carbon-defaults.scss +++ b/src/pybind/mgr/dashboard/frontend/src/styles/_carbon-defaults.scss @@ -41,6 +41,10 @@ Custom theme Datatable ******************************************/ +:root { + @include type.type-classes(); +} + tr.cds--expandable-row > td:first-of-type { background-color: vv.$white !important; padding-inline-start: 1rem !important; -- 2.39.5