Skip to content

Commit e0bf430

Browse files
authored
Merge pull request ceph#60049 from rhcs-dashboard/fix-68307-main
mgr/dashboard: Do not display restart gateway message on completion of Setup Multisite Replication wizard Reviewed-by: Afreen Misbah <[email protected]>
2 parents eb21831 + 39723ff commit e0bf430

File tree

3 files changed

+28
-8
lines changed

3 files changed

+28
-8
lines changed

src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.ts

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import { Router } from '@angular/router';
4040
import { RgwMultisiteWizardComponent } from '../rgw-multisite-wizard/rgw-multisite-wizard.component';
4141
import { RgwMultisiteSyncPolicyComponent } from '../rgw-multisite-sync-policy/rgw-multisite-sync-policy.component';
4242
import { ModalCdsService } from '~/app/shared/services/modal-cds.service';
43+
import { RgwMultisiteService } from '~/app/shared/api/rgw-multisite.service';
4344

4445
const BASE_URL = 'rgw/multisite/configuration';
4546

@@ -121,7 +122,8 @@ export class RgwMultisiteDetailsComponent implements OnDestroy, OnInit {
121122
public rgwDaemonService: RgwDaemonService,
122123
public mgrModuleService: MgrModuleService,
123124
private notificationService: NotificationService,
124-
private cdsModalService: ModalCdsService
125+
private cdsModalService: ModalCdsService,
126+
private rgwMultisiteService: RgwMultisiteService
125127
) {
126128
this.permission = this.authStorageService.getPermissions().rgw;
127129
}
@@ -412,22 +414,30 @@ export class RgwMultisiteDetailsComponent implements OnDestroy, OnInit {
412414
this.realmIds = [];
413415
this.zoneIds = [];
414416
this.evaluateMigrateAndReplicationActions();
417+
this.rgwMultisiteService.restartGatewayMessage$.subscribe((value) => {
418+
if (value !== null) {
419+
this.restartGatewayMessage = value;
420+
} else {
421+
this.checkRestartGatewayMessage();
422+
}
423+
});
424+
return allNodes;
425+
}
426+
427+
checkRestartGatewayMessage() {
415428
this.rgwDaemonService.list().subscribe((data: any) => {
416-
const hasEmptyRealmName = data.some(
417-
(item: { [x: string]: any }) =>
418-
item['realm_name'] === '' &&
419-
!data.some((i: { [x: string]: any }) => i['id'] === item['id'] && i['realm_name'] !== '')
420-
);
429+
const realmName = data.map((item: { [x: string]: any }) => item['realm_name']);
421430
if (
422431
this.defaultRealmId !== '' &&
423432
this.defaultZonegroupId !== '' &&
424433
this.defaultZoneId !== '' &&
425-
hasEmptyRealmName
434+
realmName.includes('')
426435
) {
427436
this.restartGatewayMessage = true;
437+
} else {
438+
this.restartGatewayMessage = false;
428439
}
429440
});
430-
return allNodes;
431441
}
432442

433443
getDefaultsEntities(

src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-wizard/rgw-multisite-wizard.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ export class RgwMultisiteWizardComponent extends BaseModal implements OnInit {
236236
)
237237
.subscribe((data: object[]) => {
238238
this.setupCompleted = true;
239+
this.rgwMultisiteService.setRestartGatewayMessage(false);
239240
this.loading = false;
240241
this.realms = data;
241242
this.showSuccessNotification();
@@ -258,6 +259,7 @@ export class RgwMultisiteWizardComponent extends BaseModal implements OnInit {
258259
.subscribe(
259260
() => {
260261
this.setupCompleted = true;
262+
this.rgwMultisiteService.setRestartGatewayMessage(false);
261263
this.loading = false;
262264
this.showSuccessNotification();
263265
},

src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-multisite.service.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { HttpClient, HttpParams } from '@angular/common/http';
22
import { Injectable } from '@angular/core';
33
import { RgwRealm, RgwZone, RgwZonegroup } from '~/app/ceph/rgw/models/rgw-multisite';
44
import { RgwDaemonService } from './rgw-daemon.service';
5+
import { BehaviorSubject } from 'rxjs';
56

67
@Injectable({
78
providedIn: 'root'
@@ -10,6 +11,9 @@ export class RgwMultisiteService {
1011
private uiUrl = 'ui-api/rgw/multisite';
1112
private url = 'api/rgw/multisite';
1213

14+
private restartGatewayMessageSource = new BehaviorSubject<boolean>(null);
15+
restartGatewayMessage$ = this.restartGatewayMessageSource.asObservable();
16+
1317
constructor(private http: HttpClient, public rgwDaemonService: RgwDaemonService) {}
1418

1519
migrate(realm: RgwRealm, zonegroup: RgwZonegroup, zone: RgwZone) {
@@ -137,4 +141,8 @@ export class RgwMultisiteService {
137141
{ params }
138142
);
139143
}
144+
145+
setRestartGatewayMessage(value: boolean): void {
146+
this.restartGatewayMessageSource.next(value);
147+
}
140148
}

0 commit comments

Comments
 (0)