You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/05/30 23:35:43 UTC
[cloudstack-primate] branch master updated: config: introduce
action message feature
This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cloudstack-primate.git
The following commit(s) were added to refs/heads/master by this push:
new 3b9ee63 config: introduce action message feature
3b9ee63 is described below
commit 3b9ee63e836120dbaab0185689d46585dc7a8471
Author: Rohit Yadav <ro...@shapeblue.com>
AuthorDate: Sun May 31 05:04:29 2020 +0530
config: introduce action message feature
This adds a new config for actions that could show a translatable
message in the auto-generated action form
Signed-off-by: Rohit Yadav <ro...@shapeblue.com>
---
src/config/section/compute.js | 2 ++
src/config/section/infra/routers.js | 1 +
src/config/section/infra/systemVms.js | 1 +
src/permission.js | 6 +++++-
src/views/AutogenView.vue | 4 ++++
5 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/src/config/section/compute.js b/src/config/section/compute.js
index 3b077f2..0faec6e 100644
--- a/src/config/section/compute.js
+++ b/src/config/section/compute.js
@@ -94,6 +94,7 @@ export default {
api: 'stopVirtualMachine',
icon: 'stop',
label: 'label.action.stop.instance',
+ message: 'message.action.stop.instance',
docHelp: 'adminguide/virtual_machines.html#stopping-and-starting-vms',
dataView: true,
groupAction: true,
@@ -104,6 +105,7 @@ export default {
api: 'rebootVirtualMachine',
icon: 'reload',
label: 'label.action.reboot.instance',
+ message: 'message.action.reboot.instance',
dataView: true,
show: (record) => { return ['Running'].includes(record.state) }
},
diff --git a/src/config/section/infra/routers.js b/src/config/section/infra/routers.js
index 370fdaa..adec638 100644
--- a/src/config/section/infra/routers.js
+++ b/src/config/section/infra/routers.js
@@ -35,6 +35,7 @@ export default {
api: 'stopRouter',
icon: 'stop',
label: 'label.action.stop.router',
+ message: 'message.action.stop.router',
dataView: true,
args: ['forced'],
show: (record) => { return record.state === 'Running' }
diff --git a/src/config/section/infra/systemVms.js b/src/config/section/infra/systemVms.js
index da53efa..b02f833 100644
--- a/src/config/section/infra/systemVms.js
+++ b/src/config/section/infra/systemVms.js
@@ -34,6 +34,7 @@ export default {
api: 'stopSystemVm',
icon: 'stop',
label: 'label.action.stop.systemvm',
+ message: 'message.action.stop.systemvm',
dataView: true,
show: (record) => { return record.state === 'Running' },
args: ['forced']
diff --git a/src/permission.js b/src/permission.js
index 97aff53..f73f09d 100644
--- a/src/permission.js
+++ b/src/permission.js
@@ -17,6 +17,7 @@
import Cookies from 'js-cookie'
import Vue from 'vue'
+import i18n from './locales'
import router from './router'
import store from './store'
@@ -34,7 +35,10 @@ const whiteList = ['login'] // no redirect whitelist
router.beforeEach((to, from, next) => {
// start progress bar
NProgress.start()
- to.meta && (typeof to.meta.title !== 'undefined' && setDocumentTitle(`${to.meta.title} - ${domTitle}`))
+ if (to.meta && typeof to.meta.title !== 'undefined') {
+ const title = i18n.t(to.meta.title) + ' - ' + domTitle
+ setDocumentTitle(title)
+ }
const validLogin = Vue.ls.get(ACCESS_TOKEN) || Cookies.get('userid') || Cookies.get('userid', { path: '/client' })
if (validLogin) {
if (to.path === '/user/login') {
diff --git a/src/views/AutogenView.vue b/src/views/AutogenView.vue
index 27b7f05..21a75f0 100644
--- a/src/views/AutogenView.vue
+++ b/src/views/AutogenView.vue
@@ -115,6 +115,10 @@
</a>
</span>
<a-spin :spinning="currentAction.loading">
+ <span v-if="currentAction.message">
+ <a-alert :message="$t(currentAction.message)" type="warning" />
+ <br v-if="currentAction.paramFields.length > 0"/>
+ </span>
<a-form
:form="form"
@submit="handleSubmit"