From 39723ff29d460f77a0ce688c7fef8a3aa29c7cd8 Mon Sep 17 00:00:00 2001 From: Aashish Sharma Date: Mon, 30 Sep 2024 11:10:32 +0530 Subject: [PATCH] mgr/dashboard: Donot display restart gateway message on completion of 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 --- .../rgw-multisite-details.component.ts | 26 +++++++++++++------ .../rgw-multisite-wizard.component.ts | 2 ++ .../app/shared/api/rgw-multisite.service.ts | 8 ++++++ 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.ts index fbe3110b978ea..4bd04ee29faa7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.ts @@ -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( diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-wizard/rgw-multisite-wizard.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-wizard/rgw-multisite-wizard.component.ts index 3d4b06528c181..2fbe1163ef841 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-wizard/rgw-multisite-wizard.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-wizard/rgw-multisite-wizard.component.ts @@ -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(); }, diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-multisite.service.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-multisite.service.ts index d57cd523a4dfe..b3a77e32198b2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-multisite.service.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-multisite.service.ts @@ -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(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); + } } -- 2.39.5