From: avanthakkar Date: Thu, 30 Mar 2023 17:18:52 +0000 (+0530) Subject: mgr/dashboard: add support for editing RGW zonegroup X-Git-Tag: v18.2.1~373^2~6 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=8048155f70306214a1f2d8de3a2ac6696bb8b287;p=ceph-ci.git mgr/dashboard: add support for editing RGW zonegroup Fixes: https://tracker.ceph.com/issues/59239 Signed-off-by: Avan Thakkar Co-authored-by: Aashish Sharma (cherry picked from commit d9efaed62e7082ad1a61233515b05b7c15bdc28b) --- diff --git a/src/pybind/mgr/dashboard/controllers/rgw.py b/src/pybind/mgr/dashboard/controllers/rgw.py index 331d2067fd0..4e01fb9ea3a 100644 --- a/src/pybind/mgr/dashboard/controllers/rgw.py +++ b/src/pybind/mgr/dashboard/controllers/rgw.py @@ -817,6 +817,21 @@ class RgwZonegroup(RESTController): except NoRgwDaemonsException as e: raise DashboardException(e, http_status_code=404, component='rgw') + @allow_empty_body + # pylint: disable=W0613,W0102 + def set(self, zonegroup_name: str, realm_name: str, new_zonegroup_name: str, default: str = '', + master: str = '', zonegroup_endpoints: List[str] = [], add_zones: List[str] = [], + remove_zones: List[str] = [], placement_targets: List[Dict[str, str]] = [], + daemon_name=None): + try: + instance = RgwClient.admin_instance() + result = instance.edit_zonegroup(realm_name, zonegroup_name, new_zonegroup_name, + default, master, zonegroup_endpoints, add_zones, + remove_zones, placement_targets) + return result + except NoRgwDaemonsException as e: + raise DashboardException(e, http_status_code=404, component='rgw') + @APIRouter('/rgw/zone', Scope.RGW) class RgwZone(RESTController): diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.html index 3dcb290c641..12ae56a2d07 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.html @@ -34,17 +34,18 @@ *ngIf="node.data.is_default"> default - master
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.scss index 423c078066a..537b53a519c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.scss +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.scss @@ -7,3 +7,7 @@ .align-inline-btns { margin-left: 5em; } + +.btn:disabled { + pointer-events: none; +} 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 0a8e598f6e7..a0edcd95b49 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 @@ -76,6 +76,7 @@ export class RgwMultisiteDetailsComponent implements OnDestroy, OnInit { defaultZoneId = ''; multisiteInfo: object[] = []; defaultsInfo: string[] = []; + title: string = 'Edit'; constructor( private modalService: ModalService, @@ -291,18 +292,21 @@ export class RgwMultisiteDetailsComponent implements OnDestroy, OnInit { } getDisable() { + let isMasterZone = true; if (this.defaultRealmId === '') { return this.messages.noDefaultRealm; } else { - let isMasterZone = true; this.zonegroups.forEach((zgp: any) => { if (_.isEmpty(zgp.master_zone)) { isMasterZone = false; } }); if (!isMasterZone) { + this.title = + 'Please create a master zone for each existing zonegroup to enable this feature'; return this.messages.noMasterZone; } else { + this.title = 'Edit'; return false; } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-zonegroup-form/rgw-multisite-zonegroup-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-zonegroup-form/rgw-multisite-zonegroup-form.component.html index adcadde8775..b3848052b5b 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-zonegroup-form/rgw-multisite-zonegroup-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-zonegroup-form/rgw-multisite-zonegroup-form.component.html @@ -52,7 +52,10 @@ type="checkbox">
+ i18n>Default + + Zonegroup doesn't belong to the default realm. +
+ + Multiple master zonegroups can't be configured. If you want to create a new zonegroup and make it the master zonegroup, you must delete the default zonegroup. +
@@ -89,6 +95,97 @@ i18n>Please enter a valid IP address. +
+ +
+ +
+ Cannot remove master zone. +
+
+
+ Placement targets + +
+
+
+ {{ (index + 1) | ordinal }} + × +
+ +
+ +
+ +
+ + + This field is required. + +
+
+ + +
+ +
+ +
+
+ + +
+ +
+ +
+
+
+
+
+
+ +