]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Fix notification panel mounting
authorAfreen Misbah <afreen@ibm.com>
Tue, 16 Dec 2025 19:00:15 +0000 (00:30 +0530)
committerAfreen Misbah <afreen@ibm.com>
Thu, 8 Jan 2026 23:11:27 +0000 (04:41 +0530)
- fixed notification panel mounting which was earlier via service
- earlier side panel was always mounted which was not good from perf POV
- also used carbon provided icon for new notification instead of custom css

Signed-off-by: Afreen Misbah <afreen@ibm.com>
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation.module.ts
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.html
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.ts
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notification-panel/notifications-page/notifications-page.component.html
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notification-panel/notifications-page/notifications-page.component.ts
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.html
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.scss
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/notifications/notifications.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.scss
src/pybind/mgr/dashboard/frontend/src/app/shared/components/icon/icon.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/enum/icons.enum.ts

index 9652d372d97d4dc6f6874a641df717dca8964bb0..70e60684cd2195cb4aa80816939ffbf2568e10e8 100644 (file)
@@ -41,6 +41,7 @@ import SettingsIcon from '@carbon/icons/es/settings/20';
 import HelpIcon from '@carbon/icons/es/help/20';
 import NotificationIcon from '@carbon/icons/es/notification/20';
 import NotificationOffIcon from '@carbon/icons/es/notification--off/20';
+import NotificationNewIcon from '@carbon/icons/es/notification--new/20';
 import LaunchIcon from '@carbon/icons/es/launch/16';
 import DashboardIcon from '@carbon/icons/es/template/20';
 import ClusterIcon from '@carbon/icons/es/web-services--cluster/20';
@@ -57,6 +58,7 @@ import ErrorFilledIcon from '@carbon/icons/es/error--filled/16';
 import InformationFilledIcon from '@carbon/icons/es/information--filled/16';
 import WarningFilledIcon from '@carbon/icons/es/warning--filled/16';
 import NotificationFilledIcon from '@carbon/icons/es/notification--filled/16';
+
 import CloseIcon from '@carbon/icons/es/close/16';
 import { NotificationPanelComponent } from './notification-panel/notification-panel/notification-panel.component';
 import { NotificationHeaderComponent } from './notification-panel/notification-header/notification-header.component';
@@ -137,6 +139,7 @@ export class NavigationModule {
       InformationFilledIcon,
       WarningFilledIcon,
       NotificationFilledIcon,
+      NotificationNewIcon,
       CloseIcon
     ]);
   }
index 0e2ec96b8b8adaf3e4457f79d29fdbd7e39c5280..ffa28d80efeb7e7cb31a3256bfb9a1b353e16227 100644 (file)
@@ -1,8 +1,5 @@
 <div class="cd-navbar-main">
-  <!-- ************************ -->
-  <!-- NOTIFICATIONS     -->
-  <!-- ************************ -->
-  <cd-notifications-sidebar></cd-notifications-sidebar>
+  <cd-notification-panel *ngIf="isNotifPanelOpen"></cd-notification-panel>
   <!-- ************************ -->
   <!-- HEADER                   -->
   <!-- ************************ -->
@@ -34,7 +31,7 @@
       </cds-header-navigation>
       <cds-header-action
         description=""
-        (click)="toggleSidebar()">
+        [(active)]="isNotifPanelOpen">
           <cd-notifications></cd-notifications>
       </cds-header-action>
       <div class="cds--btn cds--btn--icon-only cds--header__action">
index 612ef52ddc3707312e5e4be6133f0609ca48ad3f..2864776c94c6f5994db79e214305370fcf5aff6c 100644 (file)
@@ -33,7 +33,7 @@ export class NavigationComponent implements OnInit, OnDestroy {
   clusterTokenStatus: object = {};
   summaryData: any;
 
-  rightSidebarOpen = false; // rightSidebar only opens when width is less than 768px
+  isNotifPanelOpen = false;
   showMenuSidebar = true;
 
   simplebar = {
@@ -161,8 +161,8 @@ export class NavigationComponent implements OnInit, OnDestroy {
     this.displayedSubMenu[menu] = !this.displayedSubMenu[menu];
   }
 
-  toggleRightSidebar() {
-    this.rightSidebarOpen = !this.rightSidebarOpen;
+  toggleSidebar() {
+    this.isNotifPanelOpen = !this.isNotifPanelOpen;
   }
 
   onClusterSelection(value: object) {
@@ -210,9 +210,7 @@ export class NavigationComponent implements OnInit, OnDestroy {
       }
     );
   }
-  toggleSidebar() {
-    this.notificationService.toggleSidebar(true, true);
-  }
+
   trackByFn(item: any) {
     return item;
   }
index 1e6d3e67d935c2c0a7bdd95ed1b64ed5467a96a4..bbc832bef4ac10147f8673f80e79e4a0cdf7bc32 100644 (file)
@@ -1,4 +1,4 @@
-<div 
+<div
   cdsGrid
   [useCssGrid]="true"
   [fullWidth]="true"
@@ -61,7 +61,7 @@
           cdsRow>
         <svg
           cdsIcon="notification"
-          size="48"
+          size="20"
           class="empty-icon"></svg>
         <p *ngIf="searchText">No notifications match your search</p>
         <p *ngIf="!searchText">No notifications available</p>
@@ -70,7 +70,7 @@
   <!-- Right Panel - Notifications Details -->
   <div cdsCol
        [columnNumbers]="{sm: 12, md: 12, lg: 9}">
-    <div 
+    <div
       cdsGrid
       [fullWidth]="true"
       *ngIf="selectedNotification"
index f507941a2147c797b1ce83ae65993cf4ecf5454d..4391e3bd35d99c975548bfe2f76f311b54f091f6 100644 (file)
@@ -1,4 +1,11 @@
-import { Component, OnInit, OnDestroy, AfterViewInit, ChangeDetectorRef, AfterViewChecked } from '@angular/core';
+import {
+  Component,
+  OnInit,
+  OnDestroy,
+  AfterViewInit,
+  ChangeDetectorRef,
+  AfterViewChecked
+} from '@angular/core';
 import { Subscription } from 'rxjs';
 import { NotificationService } from '~/app/shared/services/notification.service';
 import { CdNotification } from '~/app/shared/models/cd-notification';
@@ -12,7 +19,8 @@ import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
   templateUrl: './notifications-page.component.html',
   styleUrls: ['./notifications-page.component.scss']
 })
-export class NotificationsPageComponent implements OnInit, OnDestroy, AfterViewInit, AfterViewChecked {
+export class NotificationsPageComponent
+  implements OnInit, OnDestroy, AfterViewInit, AfterViewChecked {
   notifications: CdNotification[] = [];
   selectedNotification: CdNotification | null = null;
   searchText: string = '';
index ec0639de33112777451fbe9590d26449a31f3322..da785b10266b3bd1c77837a6fc65c47080a682ae 100644 (file)
@@ -1,23 +1,15 @@
-<a i18n-title
-   title="Tasks and Notifications"
-   [ngClass]="{ 'running': hasRunningTasks }"
-   (click)="togglePanel($event)">
-  <div class="notification-icon-wrapper">
-    <cd-icon type="notification"
-             *ngIf="!isMuted"
-             size="20">
-    </cd-icon>
-    <svg *ngIf="isMuted"
-         cdsIcon="notification--off"
-         size="20"
-         title="Notifications muted"></svg>
-    <span class="notification-count"
-          *ngIf="notificationCount > 0">
-      {{ notificationCount }}
-    </span>
-  </div>
-  <span class="d-md-none"
-        i18n>Tasks and Notifications</span>
-</a>
-<cd-notification-panel *ngIf="isPanelOpen && useNewPanel"></cd-notification-panel>
-<cd-notifications-sidebar *ngIf="isPanelOpen && !useNewPanel"></cd-notifications-sidebar>
+@if(isMuted) {
+  <cd-icon type="notificationOff"
+          [size]="iconSize">
+</cd-icon>
+}
+@else if(!isMuted && hasRunningTasks) {
+  <cd-icon type="notificationNew"
+          [size]="iconSize">
+  </cd-icon>
+}
+@else {
+  <cd-icon type="notification"
+          [size]="iconSize">
+  </cd-icon>
+}
index 2ef1e08d03243c3a47e713196abfe544ad65b34d..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,55 +0,0 @@
-@use './src/styles/vendor/variables' as vv;
-@use '@carbon/styles/scss/spacing';
-@use '@carbon/styles/scss/theme' as *;
-@use '@carbon/styles/scss/type';
-
-.running i {
-  color: vv.$primary;
-}
-
-.running:hover i {
-  color: vv.$white;
-}
-
-a {
-  .dot {
-    background-color: vv.$primary-500;
-    border: 2px solid vv.$secondary;
-    border-radius: 50%;
-    height: 11px;
-    position: absolute;
-    right: 17px;
-    top: 10px;
-    width: 10px;
-  }
-
-  &:hover .dot {
-    background-color: vv.$white;
-    border-color: vv.$primary-500;
-  }
-}
-
-.notification-icon-wrapper {
-  position: relative;
-  display: inline-flex;
-  padding: spacing.$spacing-04;
-  cursor: pointer;
-  border-radius: spacing.$spacing-01;
-  transition: background-color 0.2s ease;
-}
-
-.notification-count {
-  position: absolute;
-  top: spacing.$spacing-02;
-  right: spacing.$spacing-02;
-  min-width: spacing.$spacing-04;
-  height: spacing.$spacing-04;
-  padding: 0 spacing.$spacing-01;
-  border-radius: spacing.$spacing-02;
-  background-color: $support-error;
-  color: $text-on-color;
-  font-size: spacing.$spacing-04;
-  line-height: spacing.$spacing-04;
-  text-align: center;
-  font-weight: 500;
-}
index bbeff3ed75497013d8581e0b32b4f2fbbe90f22c..ff0a276959d3dc3fe6cc933f30b85048e43b52a4 100644 (file)
@@ -1,8 +1,8 @@
-import { Component, OnDestroy, OnInit } from '@angular/core';
+import { Component, Input, OnDestroy, OnInit } from '@angular/core';
 
 import { Subscription } from 'rxjs';
 
-import { Icons } from '~/app/shared/enum/icons.enum';
+import { ICON_TYPE, IconSize } from '~/app/shared/enum/icons.enum';
 import { CdNotification } from '~/app/shared/models/cd-notification';
 import { NotificationService } from '~/app/shared/services/notification.service';
 import { SummaryService } from '~/app/shared/services/summary.service';
@@ -14,11 +14,11 @@ import { SummaryService } from '~/app/shared/services/summary.service';
   standalone: false
 })
 export class NotificationsComponent implements OnInit, OnDestroy {
-  icons = Icons;
+  @Input() isPanelOpen: boolean = false;
+  icons = ICON_TYPE;
+  iconSize = IconSize.size20;
   hasRunningTasks = false;
   hasNotifications = false;
-  isPanelOpen = false;
-  useNewPanel = true;
   notificationCount = 0;
   isMuted = false;
   private subs = new Subscription();
@@ -42,12 +42,6 @@ export class NotificationsComponent implements OnInit, OnDestroy {
       })
     );
 
-    this.subs.add(
-      this.notificationService.panelState$.subscribe((state) => {
-        this.isPanelOpen = state.isOpen;
-        this.useNewPanel = state.useNewPanel;
-      })
-    );
     this.subs.add(
       this.notificationService.muteState$.subscribe((isMuted) => {
         this.isMuted = isMuted;
@@ -55,12 +49,6 @@ export class NotificationsComponent implements OnInit, OnDestroy {
     );
   }
 
-  togglePanel(event: Event) {
-    event.preventDefault();
-    event.stopPropagation();
-    this.notificationService.toggleSidebar(!this.isPanelOpen, this.useNewPanel);
-  }
-
   ngOnDestroy(): void {
     this.subs.unsubscribe();
   }
index 544c16f6a2429d01fd409bb12e71ed214568bc00..ff63dde9c9ae97cb008622429a99ab664e5cb081 100644 (file)
@@ -38,3 +38,7 @@ Using `color` in css and seyting svg will fill="currentColor does not work.
 .info-icon {
   fill: theme.$support-info !important;
 }
+
+.notificationNew-icon circle {
+  fill: theme.$support-error !important;
+}
index 5266aeae32330de6ed62db9ba781decff8c9c26e..5af1ff726544850b155a0231ff5a2d380f7cc9f7 100644 (file)
@@ -1,11 +1,12 @@
-import { Component, Input, OnInit } from '@angular/core';
+import { Component, Input, OnInit, ViewEncapsulation } from '@angular/core';
 import { ICON_TYPE, Icons, IconSize } from '../../enum/icons.enum';
 
 @Component({
   selector: 'cd-icon',
   templateUrl: './icon.component.html',
   styleUrl: './icon.component.scss',
-  standalone: false
+  standalone: false,
+  encapsulation: ViewEncapsulation.None
 })
 export class IconComponent implements OnInit {
   @Input() type!: keyof typeof ICON_TYPE;
index 50db9d77e826cb81a5000ebfc871943d0032859c..500671d054bad9e8ab673a74a542dcd672471b52 100644 (file)
@@ -102,7 +102,9 @@ export enum Icons {
   spin = 'fa fa-spin', //  To get any icon to rotate
   inverse = 'fa fa-inverse', // To get an alternative icon color
   notification = 'notification',
-  error = 'error--filled'
+  error = 'error--filled',
+  notificationOff = 'notification--off',
+  notificationNew = 'notification--new'
 }
 
 export enum IconSize {
@@ -120,6 +122,8 @@ export const ICON_TYPE = {
   error: 'error--filled',
   infoCircle: 'info-circle',
   notification: 'notification',
+  notificationOff: 'notification--off',
+  notificationNew: 'notification--new',
   success: 'success',
   warning: 'warning'
 } as const;