]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-site.service.ts
import ceph 16.2.7
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / api / rgw-site.service.ts
index 545179dcf1abe44f7ccc7d8ebc90fb237e89226e..49589c83f4e071a23a75a77a621713435585ef6b 100644 (file)
@@ -1,6 +1,10 @@
 import { HttpClient, HttpParams } from '@angular/common/http';
 import { Injectable } from '@angular/core';
 
+import { Observable } from 'rxjs';
+import { map, mergeMap } from 'rxjs/operators';
+
+import { RgwDaemon } from '~/app/ceph/rgw/models/rgw-daemon';
 import { RgwDaemonService } from '~/app/shared/api/rgw-daemon.service';
 import { cdEncode } from '~/app/shared/decorators/cd-encode';
 
@@ -21,4 +25,14 @@ export class RgwSiteService {
       return this.http.get(this.url, { params: params });
     });
   }
+
+  isDefaultRealm(): Observable<boolean> {
+    return this.get('default-realm').pipe(
+      mergeMap((defaultRealm: string) =>
+        this.rgwDaemonService.selectedDaemon$.pipe(
+          map((selectedDaemon: RgwDaemon) => selectedDaemon.realm_name === defaultRealm)
+        )
+      )
+    );
+  }
 }