From 1f8442eb69a169c17165e4b48bb1d4e7c7b39524 Mon Sep 17 00:00:00 2001 From: Imvedansh <113465074+Imvedansh@users.noreply.github.com> Date: Fri, 2 May 2025 21:06:46 +0530 Subject: [PATCH] Extra checks in UI when deleting accounts (#10760) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Bernardo De Marco Gonçalves --- ui/public/locales/en.json | 9 +- ui/src/config/section/account.js | 5 +- ui/src/views/iam/DeleteAccount.vue | 176 ++++++++++++++++++++++ ui/src/views/iam/DeleteAccountWrapper.vue | 74 +++++++++ 4 files changed, 260 insertions(+), 4 deletions(-) create mode 100644 ui/src/views/iam/DeleteAccount.vue create mode 100644 ui/src/views/iam/DeleteAccountWrapper.vue diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json index 18df4d2a7bf..f4a8f59017e 100644 --- a/ui/public/locales/en.json +++ b/ui/public/locales/en.json @@ -1,4 +1,5 @@ { +"message.delete.account.not.disabled": "Please disable the account before attempting to delete it.", "alert.service.domainrouter": "Domain router", "error.dedicate.cluster.failed": "Failed to dedicate cluster.", "error.dedicate.host.failed": "Failed to dedicate host.", @@ -855,6 +856,7 @@ "label.endipv6": "IPv6 end IP", "label.endpoint": "Endpoint", "label.endport": "End port", +"label.enter.account.name": "Enter the account name", "label.enter.code": "Enter 2FA code to verify", "label.enter.static.pin": "Enter static PIN to verify", "label.enter.token": "Enter token", @@ -2720,7 +2722,11 @@ "message.dedicating.host": "Dedicating host...", "message.dedicating.pod": "Dedicating pod...", "message.dedicating.zone": "Dedicating zone...", -"message.delete.account": "Please confirm that you want to delete this Account.", +"message.delete.account.confirm": "Please confirm that you want to delete this account by entering the name of the account below.", +"message.delete.account.failed": "Delete account failed", +"message.delete.account.processing": "Deleting account", +"message.delete.account.success": "Successfully deleted account", +"message.delete.account.warning": "Deleting this account will delete all of the instances, volumes and snapshots associated with the account.", "message.delete.acl.processing": "Removing ACL rule...", "message.delete.acl.rule": "Remove ACL rule", "message.delete.acl.rule.failed": "Failed to remove ACL rule.", @@ -2807,6 +2813,7 @@ "message.enabling.security.group.provider": "Enabling security group provider", "message.enter.valid.nic.ip": "Please enter a valid IP address for NIC", "message.error.access.key": "Please enter access key.", +"message.error.account.delete.name.mismatch": "Name entered doesn't match the account name.", "message.error.add.guest.network": "Either IPv4 fields or IPv6 fields need to be filled when adding a guest Network.", "message.error.add.interface.static.route": "Adding interface Static Route failed", "message.error.add.logical.router": "Adding Logical Router failed", diff --git a/ui/src/config/section/account.js b/ui/src/config/section/account.js index 28c0e3f556d..bdd71738660 100644 --- a/ui/src/config/section/account.js +++ b/ui/src/config/section/account.js @@ -225,11 +225,10 @@ export default { message: 'message.delete.account', dataView: true, disabled: (record, store) => { - return record.id !== 'undefined' && store.userInfo.accountid === record.id + return store.userInfo.accountid === record?.id }, - groupAction: true, popup: true, - groupMap: (selection) => { return selection.map(x => { return { id: x } }) } + component: shallowRef(defineAsyncComponent(() => import('@/views/iam/DeleteAccountWrapper.vue'))) } ] } diff --git a/ui/src/views/iam/DeleteAccount.vue b/ui/src/views/iam/DeleteAccount.vue new file mode 100644 index 00000000000..0e7c6139e4c --- /dev/null +++ b/ui/src/views/iam/DeleteAccount.vue @@ -0,0 +1,176 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + + + + + diff --git a/ui/src/views/iam/DeleteAccountWrapper.vue b/ui/src/views/iam/DeleteAccountWrapper.vue new file mode 100644 index 00000000000..2c6a07ca3c6 --- /dev/null +++ b/ui/src/views/iam/DeleteAccountWrapper.vue @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + + + + + +