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 33e9e9f autogenview: display actual name from API args in notification
33e9e9f is described below
commit 33e9e9f98217313b6254e513b041eb276fb6b384
Author: Rohit Yadav <[email protected]>
AuthorDate: Thu May 21 14:38:11 2020 +0530
autogenview: display actual name from API args in notification
Fixes #336
With this fix, any API action will use the name and similar parameters
to display in the notification instead of resource.name. This also fixes
the issue of removal of all jobs in the notification menu (the ones in
progress shouldn't be cleared).
Signed-off-by: Rohit Yadav <[email protected]>
---
src/components/header/HeaderNotice.vue | 7 +++----
src/views/AutogenView.vue | 15 +++++++++++----
2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/src/components/header/HeaderNotice.vue
b/src/components/header/HeaderNotice.vue
index 1cbbb6b..f59c7b8 100644
--- a/src/components/header/HeaderNotice.vue
+++ b/src/components/header/HeaderNotice.vue
@@ -25,7 +25,7 @@
overlayClassName="header-notice-popover">
<template slot="content">
<a-spin :spinning="loading">
- <a-list style="min-width: 200px">
+ <a-list style="min-width: 200px; max-width: 300px">
<a-list-item>
<a-list-item-meta title="Notifications">
<a-avatar :style="{backgroundColor: '#6887d0', verticalAlign:
'middle'}" icon="notification" slot="avatar"/>
@@ -72,9 +72,8 @@ export default {
this.visible = !this.visible
},
clearJobs () {
- this.visible = false
- this.jobs = []
- this.$store.commit('SET_ASYNC_JOB_IDS', [])
+ this.jobs = this.jobs.filter(x => x.status === 'progress')
+ this.$store.commit('SET_ASYNC_JOB_IDS', this.jobs)
},
startPolling () {
this.poller = setInterval(() => {
diff --git a/src/views/AutogenView.vue b/src/views/AutogenView.vue
index fb8df99..6422288 100644
--- a/src/views/AutogenView.vue
+++ b/src/views/AutogenView.vue
@@ -694,7 +694,7 @@ export default {
}).then(function () {
})
},
- pollActionCompletion (jobId, action) {
+ pollActionCompletion (jobId, action, resourceName) {
this.$pollJob({
jobId,
successMethod: result => {
@@ -711,7 +711,7 @@ export default {
}
},
errorMethod: () => this.fetchData(),
- loadingMessage: `${this.$t(action.label)} in progress for
${this.resource.name}`,
+ loadingMessage: `${this.$t(action.label)} in progress for
${resourceName}`,
catchMessage: 'Error encountered while fetching async job result',
action
})
@@ -791,16 +791,23 @@ export default {
console.log(this.resource)
console.log(params)
+ const resourceName = params.displayname || params.displaytext ||
params.name || params.hostname || params.username || params.ipaddress ||
params.virtualmachinename || this.resource.name
+
var hasJobId = false
api(this.currentAction.api, params).then(json => {
for (const obj in json) {
if (obj.includes('response')) {
for (const res in json[obj]) {
if (res === 'jobid') {
- this.$store.dispatch('AddAsyncJob', { title:
this.$t(this.currentAction.label), jobid: json[obj][res], description:
this.resource.name, status: 'progress' })
- this.pollActionCompletion(json[obj][res],
this.currentAction)
+ this.$store.dispatch('AddAsyncJob', { title:
this.$t(this.currentAction.label), jobid: json[obj][res], description:
resourceName, status: 'progress' })
+ this.pollActionCompletion(json[obj][res],
this.currentAction, resourceName)
hasJobId = true
break
+ } else {
+ this.$notification.success({
+ message: this.$t(this.currentAction.label),
+ description: resourceName
+ })
}
}
break