]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Object gateway sync status cards keeps loading when multisite is not... 53244/head
authorAashish Sharma <aasharma@li-e74156cc-2f67-11b2-a85c-e98659a63c5c.ibm.com>
Thu, 31 Aug 2023 13:24:21 +0000 (18:54 +0530)
committerAashish Sharma <aasharma@li-e74156cc-2f67-11b2-a85c-e98659a63c5c.ibm.com>
Wed, 6 Sep 2023 05:47:26 +0000 (11:17 +0530)
Fixes: https://tracker.ceph.com/issues/62665
Signed-off-by: Aashish Sharma <aasharma@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-overview-dashboard/rgw-overview-dashboard.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-overview-dashboard/rgw-overview-dashboard.component.ts
src/pybind/mgr/dashboard/services/rgw_client.py

index e4bc1293feef3325eddbae74d8ec8bfd34f75cce..e4cb2c1f8f53922ad893acc853b607fcf0e0b956 100644 (file)
     <cd-card cardTitle="Multisite Sync Status"
              i18n-title>
       <ng-template #notConfigured>
-        <cd-alert-panel type="info"
-                        i18n>
-          Multisite needs to be configured in order to see the multisite sync status.
-          Please consult the <cd-doc section="multisite"></cd-doc> on how to configure and enable the multisite functionality.
-        </cd-alert-panel>
+        <span class="pe-5 ps-5">
+          <cd-alert-panel type="info"
+                          i18n>
+            Multisite needs to be configured in order to see the multisite sync status.
+            Please consult the <cd-doc section="multisite"></cd-doc> on how to configure and enable the multisite functionality.
+          </cd-alert-panel>
+        </span>
       </ng-template>
       <span *ngIf="loading"
             class="d-flex justify-content-center">
index b8c4774bec17f7500cc5541ac266a44178d17b62..1f11b776971841c7aab94e22c0a15b9b91c14a0d 100644 (file)
@@ -1,7 +1,7 @@
 import { Component, OnDestroy, OnInit } from '@angular/core';
 
 import _ from 'lodash';
-import { Observable, ReplaySubject, Subscription } from 'rxjs';
+import { Observable, ReplaySubject, Subscription, of } from 'rxjs';
 
 import { Permissions } from '~/app/shared/models/permissions';
 import { AuthStorageService } from '~/app/shared/services/auth-storage.service';
@@ -18,8 +18,7 @@ import { RgwPromqls as queries } from '~/app/shared/enum/dashboard-promqls.enum'
 import { HealthService } from '~/app/shared/api/health.service';
 import { Icons } from '~/app/shared/enum/icons.enum';
 import { RgwMultisiteService } from '~/app/shared/api/rgw-multisite.service';
-import { shareReplay, switchMap, tap } from 'rxjs/operators';
-import { RgwZonegroup } from '../models/rgw-multisite';
+import { catchError, shareReplay, switchMap, tap } from 'rxjs/operators';
 
 @Component({
   selector: 'cd-rgw-overview-dashboard',
@@ -120,18 +119,22 @@ export class RgwOverviewDashboardComponent implements OnInit, OnDestroy {
             this.loading = false;
             this.replicaZonesInfo = data['dataSyncInfo'];
             this.metadataSyncInfo = data['metadataSyncInfo'];
+            if (this.replicaZonesInfo.length === 0) {
+              this.showMultisiteCard = false;
+              this.syncCardLoading = false;
+              this.loading = false;
+            }
             [this.realm, this.zonegroup, this.zone] = data['primaryZoneData'];
+          }),
+          catchError((err) => {
+            this.showMultisiteCard = false;
+            this.syncCardLoading = false;
+            this.loading = false;
+            err.preventDefault();
+            return of(true);
           })
         )
       ),
-      tap(() => {
-        const zonegroup = new RgwZonegroup();
-        zonegroup.name = this.zonegroup;
-        this.rgwZonegroupService.get(zonegroup).subscribe((data: any) => {
-          this.showMultisiteCard = data['zones'].length !== 1;
-          this.syncCardLoading = false;
-        });
-      }),
       shareReplay(1)
     );
   }
index 58496f9a487820f18a715fd7b41f1e411332fd9e..bd4982e2d069b898f8b2c6354845252ff10f2561 100644 (file)
@@ -1545,7 +1545,7 @@ class RgwMultisite:
         try:
             exit_code, out, _ = mgr.send_rgwadmin_command(rgw_multisite_sync_status_cmd, False)
             if exit_code > 0:
-                raise DashboardException('Unable to get multisite sync status',
+                raise DashboardException('Unable to get sync status',
                                          http_status_code=500, component='rgw')
             if out:
                 return self.process_data(out)
@@ -1555,8 +1555,10 @@ class RgwMultisite:
 
     def process_data(self, data):
         primary_zone_data, metadata_sync_data = self.extract_metadata_and_primary_zone_data(data)
-        datasync_info = self.extract_datasync_info(data)
-        replica_zones_info = [self.extract_replica_zone_data(item) for item in datasync_info]
+        replica_zones_info = []
+        if metadata_sync_data != {}:
+            datasync_info = self.extract_datasync_info(data)
+            replica_zones_info = [self.extract_replica_zone_data(item) for item in datasync_info]
 
         replica_zones_info_object = {
             'metadataSyncInfo': metadata_sync_data,
@@ -1575,7 +1577,10 @@ class RgwMultisite:
         zone = self.get_primary_zonedata(primary_zone_tree[2])
 
         primary_zone_data = [realm, zonegroup, zone]
-        metadata_sync_data = self.extract_metadata_sync_data(metadata_sync_infoormation)
+        zonegroup_info = self.get_zonegroup(zonegroup)
+        metadata_sync_data = {}
+        if len(zonegroup_info['zones']) > 1:
+            metadata_sync_data = self.extract_metadata_sync_data(metadata_sync_infoormation)
 
         return primary_zone_data, metadata_sync_data