diff --git a/ui/src/components/CloudMonkey/Resource.vue b/ui/src/components/CloudMonkey/Resource.vue
index f0abb5c6cb9..10d971746fb 100644
--- a/ui/src/components/CloudMonkey/Resource.vue
+++ b/ui/src/components/CloudMonkey/Resource.vue
@@ -234,6 +234,7 @@ import DataView from '@/components/widgets/DataView'
import InstanceView from '@/components/widgets/InstanceView'
import Status from '@/components/widgets/Status'
import { mixinDevice } from '@/utils/mixin.js'
+import { constants } from 'crypto';
export default {
name: 'Resource',
@@ -506,9 +507,21 @@ export default {
const closeAction = this.closeAction
const showError = this.$notification['error']
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.currentAction.label, 'jobid': json[obj][res], 'description': this.resource.name, 'status': 'progress'})
+ break
+ }
+ }
+ break
+ }
+ }
closeAction()
}).catch(function (error) {
closeAction()
+ console.log(error)
showError({
message: 'Request Failed',
description: error.response.headers['x-description']
diff --git a/ui/src/components/tools/HeaderNotice.vue b/ui/src/components/tools/HeaderNotice.vue
index 67d3a9c0eee..db1b8a6ee46 100644
--- a/ui/src/components/tools/HeaderNotice.vue
+++ b/ui/src/components/tools/HeaderNotice.vue
@@ -17,7 +17,7 @@
-
+
@@ -32,26 +32,89 @@
diff --git a/ui/src/core/bootstrap.js b/ui/src/core/bootstrap.js
index e67bbe51a66..f86f39ff5c3 100644
--- a/ui/src/core/bootstrap.js
+++ b/ui/src/core/bootstrap.js
@@ -12,7 +12,8 @@ import {
DEFAULT_FIXED_HEADER_HIDDEN,
DEFAULT_FIXED_SIDEMENU,
DEFAULT_CONTENT_WIDTH_TYPE,
- DEFAULT_MULTI_TAB
+ DEFAULT_MULTI_TAB,
+ ASYNC_JOB_IDS
} from '@/store/mutation-types'
import config from '@/config/settings'
@@ -29,4 +30,5 @@ export default function Initializer () {
store.commit('TOGGLE_MULTI_TAB', Vue.ls.get(DEFAULT_MULTI_TAB, config.multiTab))
store.commit('SET_TOKEN', Vue.ls.get(ACCESS_TOKEN))
store.commit('SET_PROJECT', Vue.ls.get(CURRENT_PROJECT))
+ store.commit('SET_ASYNC_JOB_IDS', Vue.ls.get(ASYNC_JOB_IDS))
}
diff --git a/ui/src/store/getters.js b/ui/src/store/getters.js
index 1055b0cb9fb..4eac6d5f849 100644
--- a/ui/src/store/getters.js
+++ b/ui/src/store/getters.js
@@ -10,7 +10,8 @@ const getters = {
apis: state => state.user.apis,
userInfo: state => state.user.info,
addRouters: state => state.permission.addRouters,
- multiTab: state => state.app.multiTab
+ multiTab: state => state.app.multiTab,
+ asyncJobIds: state => state.user.asyncJobIds
}
export default getters
diff --git a/ui/src/store/modules/app.js b/ui/src/store/modules/app.js
index 2d0627b920d..45875de58da 100644
--- a/ui/src/store/modules/app.js
+++ b/ui/src/store/modules/app.js
@@ -39,7 +39,6 @@ const app = {
state.device = device
},
TOGGLE_THEME: (state, theme) => {
- // setStore('_DEFAULT_THEME', theme)
Vue.ls.set(DEFAULT_THEME, theme)
state.theme = theme
},
diff --git a/ui/src/store/modules/user.js b/ui/src/store/modules/user.js
index 23dd2e16375..f8f9d4bfeb9 100644
--- a/ui/src/store/modules/user.js
+++ b/ui/src/store/modules/user.js
@@ -1,7 +1,7 @@
import Vue from 'vue'
import md5 from 'md5'
import { login, logout, api } from '@/api'
-import { ACCESS_TOKEN, CURRENT_PROJECT } from '@/store/mutation-types'
+import { ACCESS_TOKEN, CURRENT_PROJECT, ASYNC_JOB_IDS } from '@/store/mutation-types'
import { welcome } from '@/utils/util'
// import VueCookies from 'vue-cookies'
@@ -13,7 +13,8 @@ const user = {
avatar: '',
info: {},
apis: {},
- project: {}
+ project: {},
+ asyncJobIds: []
},
mutations: {
@@ -36,6 +37,10 @@ const user = {
},
SET_APIS: (state, apis) => {
state.apis = apis
+ },
+ SET_ASYNC_JOB_IDS: (state, jobsJsonArray) => {
+ Vue.ls.set(ASYNC_JOB_IDS, jobsJsonArray)
+ state.asyncJobIds = jobsJsonArray
}
},
@@ -61,6 +66,7 @@ const user = {
Vue.ls.set(ACCESS_TOKEN, result.sessionkey, 60 * 60 * 1000)
commit('SET_TOKEN', result.sessionkey)
commit('SET_PROJECT', {})
+ commit('SET_ASYNC_JOB_IDS', [])
resolve()
}).catch(error => {
@@ -104,7 +110,6 @@ const user = {
})
})
},
-
Logout ({ commit, state }) {
return new Promise((resolve) => {
// Remove cookies
@@ -122,6 +127,7 @@ const user = {
commit('SET_APIS', {})
Vue.ls.remove(CURRENT_PROJECT)
Vue.ls.remove(ACCESS_TOKEN)
+ Vue.ls.remove(ASYNC_JOB_IDS)
logout(state.token).then(() => {
resolve()
@@ -129,8 +135,12 @@ const user = {
resolve()
})
})
+ },
+ AddAsyncJob ({ commit }, jobJson) {
+ var jobsArray = Vue.ls.get(ASYNC_JOB_IDS, [])
+ jobsArray.push(jobJson)
+ commit('SET_ASYNC_JOB_IDS', jobsArray)
}
-
}
}
diff --git a/ui/src/store/mutation-types.js b/ui/src/store/mutation-types.js
index 6e0c55345d6..e0880657c1e 100644
--- a/ui/src/store/mutation-types.js
+++ b/ui/src/store/mutation-types.js
@@ -10,6 +10,7 @@ export const DEFAULT_FIXED_SIDEMENU = 'DEFAULT_FIXED_SIDEMENU'
export const DEFAULT_FIXED_HEADER_HIDDEN = 'DEFAULT_FIXED_HEADER_HIDDEN'
export const DEFAULT_CONTENT_WIDTH_TYPE = 'DEFAULT_CONTENT_WIDTH_TYPE'
export const DEFAULT_MULTI_TAB = 'DEFAULT_MULTI_TAB'
+export const ASYNC_JOB_IDS = 'ASYNC_JOB_IDS'
export const CONTENT_WIDTH_TYPE = {
Fluid: 'Fluid',