From a291dea26aea2cebcd84c59d6f3a08f0f2357697 Mon Sep 17 00:00:00 2001 From: davidjumani Date: Wed, 17 Mar 2021 17:38:26 +0530 Subject: [PATCH] ui: Fixes for action messages and forms (#4824) * ui: Fixes for storage * ui: fixes for compute * ui: Fixes for network and accounts * ui: Fixes for domain * ui: Fixes for infra --- ui/public/locales/en.json | 7 ++++++- ui/src/config/section/compute.js | 1 + ui/src/config/section/domain.js | 2 +- ui/src/config/section/infra/routers.js | 1 + .../config/section/infra/secondaryStorages.js | 20 ++++++++++--------- ui/src/config/section/infra/systemVms.js | 1 + ui/src/config/section/network.js | 3 ++- ui/src/views/AutogenView.vue | 7 +++++++ ui/src/views/compute/AssignInstance.vue | 12 +++++++++-- ui/src/views/iam/DomainActionForm.vue | 3 +++ .../project/AddAccountOrUserToProject.vue | 4 +++- ui/src/views/storage/FormSchedule.vue | 6 +++--- ui/src/views/storage/MigrateVolume.vue | 9 +++++---- ui/src/views/storage/ResizeVolume.vue | 7 ++++--- ui/src/views/storage/TakeSnapshot.vue | 6 +++--- 15 files changed, 61 insertions(+), 28 deletions(-) diff --git a/ui/public/locales/en.json b/ui/public/locales/en.json index 5b1cc6a9517..88b236ceb18 100644 --- a/ui/public/locales/en.json +++ b/ui/public/locales/en.json @@ -202,6 +202,8 @@ "label.action.generate.keys": "Generate Keys", "label.action.generate.keys.processing": "Generate Keys....", "label.action.get.diagnostics": "Get Diagnostics Data", +"label.action.image.store.read.only": "Make Image store read-only", +"label.action.image.store.read.write": "Make Image store read-write", "label.action.iso.permission": "Update ISO Permissions", "label.action.iso.share": "Update ISO Sharing", "label.action.list.nexusvswitch": "List Nexus 1000v", @@ -2428,6 +2430,8 @@ "message.action.revert.snapshot": "Please confirm that you want to revert the owning volume to this snapshot.", "message.action.router.health.checks": "Health checks result will be fetched from router.", "message.action.router.health.checks.disabled.warning": "Please enable router health checks.", +"message.action.secondary.storage.read.only": "Please confirm that you want to make this secondary storage read only.", +"message.action.secondary.storage.read.write": "Please confirm that you want to make this secondary storage read write.", "message.action.secure.host": "This will restart the host agent and libvirtd process after applying new X509 certificates, please confirm?", "message.action.settings.warning.vm.running": "Please stop the virtual machine to access settings", "message.action.settings.warning.vm.started": "Virtual machine has been started. It needs to be stopped to access settings", @@ -3043,7 +3047,7 @@ "message.restart.mgmt.usage.server": "Please restart your management server(s) and usage server(s) for your new settings to take effect.", "message.restart.network": "All services provided by this network will be interrupted. Please confirm that you want to restart this network.", "message.restart.vpc": "Please confirm that you want to restart the VPC", -"message.restart.vpc.remark": "Please confirm that you want to restart the VPC

Remark: making a non-redundant VPC redundant will force a clean up. The networks will not be available for a couple of minutes.

", +"message.restart.vpc.remark": "Please confirm that you want to restart the VPC

Remark: making a non-redundant VPC redundant will force a clean up. The networks will not be available for a couple of minutes.

", "message.restorevm": "Do you want to restore the VM ?", "message.role.ordering.fail": "Reordering of rule permissions aborted as the list has changed while you were making changes. Please try again.", "message.role.update.fail": "Failed updating rule permission", @@ -3177,6 +3181,7 @@ "message.update.ipaddress.processing": "Updating IP Address...", "message.update.os.preference": "Please choose a OS preference for this host. All virtual instances with similar preferences will be first allocated to this host before choosing another.", "message.update.resource.count": "Please confirm that you want to update resource counts for this account.", +"message.update.resource.count.domain": "Please confirm that you want to update resource counts for this domain.", "message.update.ssl": "Please submit a new X.509 compliant SSL certificate chain to be updated to each console proxy and secondary storage virtual instance:", "message.update.ssl.failed": "Failed to update SSL Certificate.", "message.update.ssl.succeeded": "Update SSL Certificates succeeded", diff --git a/ui/src/config/section/compute.js b/ui/src/config/section/compute.js index dc4efe9af61..f635561cc46 100644 --- a/ui/src/config/section/compute.js +++ b/ui/src/config/section/compute.js @@ -543,6 +543,7 @@ export default { api: 'deleteSSHKeyPair', icon: 'delete', label: 'label.remove.ssh.key.pair', + message: 'message.please.confirm.remove.ssh.key.pair', dataView: true, args: ['name', 'account', 'domainid'], mapping: { diff --git a/ui/src/config/section/domain.js b/ui/src/config/section/domain.js index 7fbd263b4ba..c8cbe4ace81 100644 --- a/ui/src/config/section/domain.js +++ b/ui/src/config/section/domain.js @@ -93,7 +93,7 @@ export default { api: 'updateResourceCount', icon: 'sync', label: 'label.action.update.resource.count', - message: 'message.update.resource.count', + message: 'message.update.resource.count.domain', listView: true, dataView: true, args: ['domainid'], diff --git a/ui/src/config/section/infra/routers.js b/ui/src/config/section/infra/routers.js index b10991409c6..09f4fff8755 100644 --- a/ui/src/config/section/infra/routers.js +++ b/ui/src/config/section/infra/routers.js @@ -103,6 +103,7 @@ export default { api: 'migrateSystemVm', icon: 'drag', label: 'label.action.migrate.router', + message: 'message.migrate.router.confirm', dataView: true, show: (record, store) => { return ['Running'].includes(record.state) && ['Admin'].includes(store.userInfo.roletype) }, args: ['virtualmachineid', 'hostid'], diff --git a/ui/src/config/section/infra/secondaryStorages.js b/ui/src/config/section/infra/secondaryStorages.js index 7395ff9aed7..17600aaa17b 100644 --- a/ui/src/config/section/infra/secondaryStorages.js +++ b/ui/src/config/section/infra/secondaryStorages.js @@ -61,17 +61,11 @@ export default { popup: true, component: () => import('@/views/infra/AddSecondaryStorage.vue') }, - { - api: 'deleteImageStore', - icon: 'delete', - label: 'label.action.delete.secondary.storage', - message: 'message.action.delete.secondary.storage', - dataView: true - }, { api: 'updateImageStore', icon: 'stop', - label: 'Make Image store read-only', + label: 'label.action.image.store.read.only', + message: 'message.action.secondary.storage.read.only', dataView: true, defaultArgs: { readonly: true }, show: (record) => { return record.readonly === false } @@ -79,10 +73,18 @@ export default { { api: 'updateImageStore', icon: 'check-circle', - label: 'Make Image store read-write', + label: 'label.action.image.store.read.write', + message: 'message.action.secondary.storage.read.write', dataView: true, defaultArgs: { readonly: false }, show: (record) => { return record.readonly === true } + }, + { + api: 'deleteImageStore', + icon: 'delete', + label: 'label.action.delete.secondary.storage', + message: 'message.action.delete.secondary.storage', + dataView: true } ] } diff --git a/ui/src/config/section/infra/systemVms.js b/ui/src/config/section/infra/systemVms.js index 8b3c66afd35..8d519ca5f49 100644 --- a/ui/src/config/section/infra/systemVms.js +++ b/ui/src/config/section/infra/systemVms.js @@ -68,6 +68,7 @@ export default { api: 'migrateSystemVm', icon: 'drag', label: 'label.action.migrate.systemvm', + message: 'message.migrate.systemvm.confirm', dataView: true, show: (record) => { return record.state === 'Running' }, args: ['virtualmachineid', 'hostid'], diff --git a/ui/src/config/section/network.js b/ui/src/config/section/network.js index c97f41c3e49..3ea3fe07104 100644 --- a/ui/src/config/section/network.js +++ b/ui/src/config/section/network.js @@ -85,6 +85,7 @@ export default { api: 'restartNetwork', icon: 'sync', label: 'label.restart.network', + message: 'message.restart.network', dataView: true, args: ['cleanup'], show: (record) => record.type !== 'L2' @@ -165,7 +166,7 @@ export default { api: 'restartVPC', icon: 'sync', label: 'label.restart.vpc', - message: 'message.restart.vpc', + message: (record) => { return record.redundantvpcrouter ? 'message.restart.vpc' : 'message.restart.vpc.remark' }, dataView: true, args: (record) => { var fields = ['cleanup'] diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue index a41b17d47bf..ecb5c702119 100644 --- a/ui/src/views/AutogenView.vue +++ b/ui/src/views/AutogenView.vue @@ -727,6 +727,13 @@ export default { return 0 }) this.currentAction.paramFields = [] + if ('message' in action) { + var message = action.message + if (typeof action.message === 'function') { + message = action.message(action.resource) + } + action.message = message + } if ('args' in action) { var args = action.args if (typeof action.args === 'function') { diff --git a/ui/src/views/compute/AssignInstance.vue b/ui/src/views/compute/AssignInstance.vue index 543a43bb261..3d83f3ff756 100644 --- a/ui/src/views/compute/AssignInstance.vue +++ b/ui/src/views/compute/AssignInstance.vue @@ -17,14 +17,16 @@