From 98c486bc202b7c0d67ae4a8da2b2b936f308ece6 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 (cherry picked from commit 1dd42e1a339ef4cf1f3253534646aa6c9342233d) Conflicts: src/pybind/mgr/dashboard/frontend/src/app/shared/components/copy2clipboard-button/copy2clipboard-button.component.html --- ...ephfs-snapshotschedule-list.component.html | 21 +++++-------- .../card-row/card-row.component.html | 6 ++-- .../copy2clipboard-button.component.html | 30 +++++++++---------- .../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 | 6 ++-- .../frontend/src/styles/_carbon-defaults.scss | 4 +++ 12 files changed, 77 insertions(+), 82 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 2a41e3e7faaab..80e150ded48ef 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 @@ -71,7 +71,7 @@ {{ data.info }} + type="infoCircle"> } - - + @if (data === null) { 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 8581a51109aca..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,17 +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..ef3ad63500f27 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, 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 = ICON_TYPE[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 971bd96a4abff..b3f18340821fa 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 @@ -380,23 +380,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 458ca296f60a7..e6afb14ef803b 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 @@ -98,7 +98,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,7 +107,7 @@ export enum IconsSize { export const ICON_TYPE = { danger: 'warning--filled', - info: 'information--filled', + infoCircle: 'information--filled', success: 'checkmark--filled', warning: 'warning--alt--filled' -} as const; \ No newline at end of file +} 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 61ad991178a7a..32b13c08012b3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/styles/_carbon-defaults.scss +++ b/src/pybind/mgr/dashboard/frontend/src/styles/_carbon-defaults.scss @@ -42,6 +42,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