config: icon and action loading fixes

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
Rohit Yadav 2020-06-21 12:06:36 +05:30
parent 32cc572a35
commit 0f2cfa8817
6 changed files with 18 additions and 12 deletions

View File

@ -439,7 +439,7 @@ export default {
}, },
{ {
api: 'stopKubernetesCluster', api: 'stopKubernetesCluster',
icon: 'stop', icon: 'poweroff',
label: 'label.kubernetes.cluster.stop', label: 'label.kubernetes.cluster.stop',
dataView: true, dataView: true,
show: (record) => { return !['Stopped'].includes(record.state) } show: (record) => { return !['Stopped'].includes(record.state) }

View File

@ -34,7 +34,7 @@ export default {
}, },
{ {
api: 'stopInternalLoadBalancerVM', api: 'stopInternalLoadBalancerVM',
icon: 'stop', icon: 'poweroff',
label: 'label.action.stop.router', label: 'label.action.stop.router',
dataView: true, dataView: true,
args: ['forced'], args: ['forced'],

View File

@ -34,7 +34,7 @@ export default {
}, },
{ {
api: 'stopRouter', api: 'stopRouter',
icon: 'stop', icon: 'poweroff',
label: 'label.action.stop.router', label: 'label.action.stop.router',
message: 'message.action.stop.router', message: 'message.action.stop.router',
dataView: true, dataView: true,

View File

@ -33,7 +33,7 @@ export default {
}, },
{ {
api: 'stopSystemVm', api: 'stopSystemVm',
icon: 'stop', icon: 'poweroff',
label: 'label.action.stop.systemvm', label: 'label.action.stop.systemvm',
message: 'message.action.stop.systemvm', message: 'message.action.stop.systemvm',
dataView: true, dataView: true,

View File

@ -87,7 +87,7 @@
:closable="true" :closable="true"
style="top: 20px;" style="top: 20px;"
@cancel="closeAction" @cancel="closeAction"
:confirmLoading="currentAction.loading" :confirmLoading="actionLoading"
:footer="null" :footer="null"
centered centered
width="auto" width="auto"
@ -110,7 +110,7 @@
style="top: 20px;" style="top: 20px;"
@ok="handleSubmit" @ok="handleSubmit"
@cancel="closeAction" @cancel="closeAction"
:confirmLoading="currentAction.loading" :confirmLoading="actionLoading"
centered centered
> >
<span slot="title"> <span slot="title">
@ -123,7 +123,7 @@
<a-icon type="question-circle-o"></a-icon> <a-icon type="question-circle-o"></a-icon>
</a> </a>
</span> </span>
<a-spin :spinning="currentAction.loading"> <a-spin :spinning="actionLoading">
<span v-if="currentAction.message"> <span v-if="currentAction.message">
<a-alert type="warning"> <a-alert type="warning">
<span slot="message" v-html="$t(currentAction.message)" /> <span slot="message" v-html="$t(currentAction.message)" />
@ -338,6 +338,7 @@ export default {
apiName: '', apiName: '',
docBase: config.docBase, docBase: config.docBase,
loading: false, loading: false,
actionLoading: false,
columns: [], columns: [],
items: [], items: [],
itemCount: 0, itemCount: 0,
@ -588,7 +589,7 @@ export default {
this.fetchData() this.fetchData()
}, },
closeAction () { closeAction () {
this.currentAction.loading = false this.actionLoading = false
this.showAction = false this.showAction = false
this.currentAction = {} this.currentAction = {}
}, },
@ -643,7 +644,7 @@ export default {
this.listUuidOpts(param) this.listUuidOpts(param)
} }
} }
this.currentAction.loading = false this.actionLoading = false
if (action.dataView && ['copy', 'edit'].includes(action.icon)) { if (action.dataView && ['copy', 'edit'].includes(action.icon)) {
this.fillEditFormFieldValues() this.fillEditFormFieldValues()
} }
@ -756,7 +757,6 @@ export default {
this.form.validateFields((err, values) => { this.form.validateFields((err, values) => {
console.log(values) console.log(values)
if (!err) { if (!err) {
this.currentAction.loading = true
const params = {} const params = {}
if ('id' in this.resource && this.currentAction.params.map(i => { return i.name }).includes('id')) { if ('id' in this.resource && this.currentAction.params.map(i => { return i.name }).includes('id')) {
params.id = this.resource.id params.id = this.resource.id
@ -812,6 +812,7 @@ export default {
const resourceName = params.displayname || params.displaytext || params.name || params.hostname || params.username || params.ipaddress || params.virtualmachinename || this.resource.name const resourceName = params.displayname || params.displaytext || params.name || params.hostname || params.username || params.ipaddress || params.virtualmachinename || this.resource.name
var hasJobId = false var hasJobId = false
this.actionLoading = true
api(this.currentAction.api, params).then(json => { api(this.currentAction.api, params).then(json => {
for (const obj in json) { for (const obj in json) {
if (obj.includes('response')) { if (obj.includes('response')) {
@ -822,7 +823,11 @@ export default {
hasJobId = true hasJobId = true
break break
} else { } else {
this.$message.success(this.$t(this.currentAction.label) + (resourceName ? ' - ' + resourceName : '')) this.$message.success({
content: this.$t(this.currentAction.label) + (resourceName ? ' - ' + resourceName : ''),
key: this.currentAction.label + resourceName,
duration: 2
})
} }
} }
break break
@ -839,6 +844,7 @@ export default {
console.log(error) console.log(error)
this.$notifyError(error) this.$notifyError(error)
}).finally(f => { }).finally(f => {
this.actionLoading = false
this.closeAction() this.closeAction()
}) })
} }

View File

@ -132,7 +132,7 @@
</a-form-item> </a-form-item>
<a-form-item <a-form-item
:label="$t('label.bypassvlanoverlapcheck')" :label="$t('label.bypassvlanoverlapcheck')"
v-if="$store.getters.apis.createPrivateGateway.params.filter(x => x.name === 'bypassvlanoverlapcheck').length > 0" > v-if="$store.getters.apis.createPrivateGateway && $store.getters.apis.createPrivateGateway.params.filter(x => x.name === 'bypassvlanoverlapcheck').length > 0" >
<a-checkbox <a-checkbox
v-decorator="['bypassvlanoverlapcheck']" v-decorator="['bypassvlanoverlapcheck']"
></a-checkbox> ></a-checkbox>