]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Donot display restart gateway message on completion of 60049/head
authorAashish Sharma <aasharma@li-e74156cc-2f67-11b2-a85c-e98659a63c5c.ibm.com>
Mon, 30 Sep 2024 05:40:32 +0000 (11:10 +0530)
committerAashish Sharma <aasharma@li-e74156cc-2f67-11b2-a85c-e98659a63c5c.ibm.com>
Fri, 4 Oct 2024 10:13:31 +0000 (15:43 +0530)
Setup Multisite Replication wizard

On completion of multi-site replication wizard, stop showing message to
restart the rgw services

Fixes: https://tracker.ceph.com/issues/68307
Signed-off-by: Aashish Sharma <aasharma@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-wizard/rgw-multisite-wizard.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-multisite.service.ts

index fbe3110b978ea8179ad30aa10c40edc604857b93..4bd04ee29faa76f8eca823c2f92d408519954427 100644 (file)
@@ -40,6 +40,7 @@ import { Router } from '@angular/router';
 import { RgwMultisiteWizardComponent } from '../rgw-multisite-wizard/rgw-multisite-wizard.component';
 import { RgwMultisiteSyncPolicyComponent } from '../rgw-multisite-sync-policy/rgw-multisite-sync-policy.component';
 import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
+import { RgwMultisiteService } from '~/app/shared/api/rgw-multisite.service';
 
 const BASE_URL = 'rgw/multisite/configuration';
 
@@ -121,7 +122,8 @@ export class RgwMultisiteDetailsComponent implements OnDestroy, OnInit {
     public rgwDaemonService: RgwDaemonService,
     public mgrModuleService: MgrModuleService,
     private notificationService: NotificationService,
-    private cdsModalService: ModalCdsService
+    private cdsModalService: ModalCdsService,
+    private rgwMultisiteService: RgwMultisiteService
   ) {
     this.permission = this.authStorageService.getPermissions().rgw;
   }
@@ -412,22 +414,30 @@ export class RgwMultisiteDetailsComponent implements OnDestroy, OnInit {
     this.realmIds = [];
     this.zoneIds = [];
     this.evaluateMigrateAndReplicationActions();
+    this.rgwMultisiteService.restartGatewayMessage$.subscribe((value) => {
+      if (value !== null) {
+        this.restartGatewayMessage = value;
+      } else {
+        this.checkRestartGatewayMessage();
+      }
+    });
+    return allNodes;
+  }
+
+  checkRestartGatewayMessage() {
     this.rgwDaemonService.list().subscribe((data: any) => {
-      const hasEmptyRealmName = data.some(
-        (item: { [x: string]: any }) =>
-          item['realm_name'] === '' &&
-          !data.some((i: { [x: string]: any }) => i['id'] === item['id'] && i['realm_name'] !== '')
-      );
+      const realmName = data.map((item: { [x: string]: any }) => item['realm_name']);
       if (
         this.defaultRealmId !== '' &&
         this.defaultZonegroupId !== '' &&
         this.defaultZoneId !== '' &&
-        hasEmptyRealmName
+        realmName.includes('')
       ) {
         this.restartGatewayMessage = true;
+      } else {
+        this.restartGatewayMessage = false;
       }
     });
-    return allNodes;
   }
 
   getDefaultsEntities(
index 3d4b06528c181183550370a32db4b30efe793b33..2fbe1163ef841d840a102ee8d1c9b4f9d58d20cc 100644 (file)
@@ -236,6 +236,7 @@ export class RgwMultisiteWizardComponent extends BaseModal implements OnInit {
         )
         .subscribe((data: object[]) => {
           this.setupCompleted = true;
+          this.rgwMultisiteService.setRestartGatewayMessage(false);
           this.loading = false;
           this.realms = data;
           this.showSuccessNotification();
@@ -258,6 +259,7 @@ export class RgwMultisiteWizardComponent extends BaseModal implements OnInit {
         .subscribe(
           () => {
             this.setupCompleted = true;
+            this.rgwMultisiteService.setRestartGatewayMessage(false);
             this.loading = false;
             this.showSuccessNotification();
           },
index d57cd523a4dfe5a8fbba5572074f2a5e62946b6c..b3a77e32198b28a5083a46e9041223b82886d240 100644 (file)
@@ -2,6 +2,7 @@ import { HttpClient, HttpParams } from '@angular/common/http';
 import { Injectable } from '@angular/core';
 import { RgwRealm, RgwZone, RgwZonegroup } from '~/app/ceph/rgw/models/rgw-multisite';
 import { RgwDaemonService } from './rgw-daemon.service';
+import { BehaviorSubject } from 'rxjs';
 
 @Injectable({
   providedIn: 'root'
@@ -10,6 +11,9 @@ export class RgwMultisiteService {
   private uiUrl = 'ui-api/rgw/multisite';
   private url = 'api/rgw/multisite';
 
+  private restartGatewayMessageSource = new BehaviorSubject<boolean>(null);
+  restartGatewayMessage$ = this.restartGatewayMessageSource.asObservable();
+
   constructor(private http: HttpClient, public rgwDaemonService: RgwDaemonService) {}
 
   migrate(realm: RgwRealm, zonegroup: RgwZonegroup, zone: RgwZone) {
@@ -137,4 +141,8 @@ export class RgwMultisiteService {
       { params }
     );
   }
+
+  setRestartGatewayMessage(value: boolean): void {
+    this.restartGatewayMessageSource.next(value);
+  }
 }