Skip to content

Commit 27d674d

Browse files
committed
Merge branch '4.15' into main
2 parents 05a978c + 535761b commit 27d674d

62 files changed

Lines changed: 375 additions & 840 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ui/src/components/header/HeaderNotice.vue

Lines changed: 13 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,26 @@
3232
<a-button size="small" slot="description" @click="clearJobs">{{ $t('label.clear.list') }}</a-button>
3333
</a-list-item-meta>
3434
</a-list-item>
35-
<a-list-item v-for="(job, index) in jobs" :key="index">
36-
<a-list-item-meta :title="job.title">
37-
<a-avatar :style="notificationAvatar[job.status].style" :icon="notificationAvatar[job.status].icon" slot="avatar"/><br/>
38-
<span v-if="getResourceName(job.description, 'name') && job.path" slot="description"><router-link :to="{ path: job.path}"> {{ getResourceName(job.description, "name") + ' - ' }}</router-link></span>
39-
<span v-if="getResourceName(job.description, 'name') && job.path" slot="description"> {{ getResourceName(job.description, "msg") }}</span>
40-
<span v-else slot="description"> {{ job.description }} </span>
35+
<a-list-item v-for="(notice, index) in notices" :key="index">
36+
<a-list-item-meta :title="notice.title" :description="notice.description">
37+
<a-avatar :style="notificationAvatar[notice.status].style" :icon="notificationAvatar[notice.status].icon" slot="avatar"/>
38+
<span v-if="getResourceName(notice.description, 'name') && notice.path" slot="description"><router-link :to="{ path: notice.path}"> {{ getResourceName(notice.description, "name") + ' - ' }}</router-link></span>
39+
<span v-if="getResourceName(notice.description, 'name') && notice.path" slot="description"> {{ getResourceName(notice.description, "msg") }}</span>
40+
<span v-else slot="description"> {{ notice.description }} </span>
4141
</a-list-item-meta>
4242
</a-list-item>
4343
</a-list>
4444
</a-spin>
4545
</template>
4646
<span @click="showNotifications" class="header-notice-opener">
47-
<a-badge :count="jobs.length">
47+
<a-badge :count="notices.length">
4848
<a-icon class="header-notice-icon" type="bell" />
4949
</a-badge>
5050
</span>
5151
</a-popover>
5252
</template>
5353

5454
<script>
55-
import { api } from '@/api'
5655
import store from '@/store'
5756
5857
export default {
@@ -61,7 +60,7 @@ export default {
6160
return {
6261
loading: false,
6362
visible: false,
64-
jobs: [],
63+
notices: [],
6564
poller: null,
6665
notificationAvatar: {
6766
done: { icon: 'check-circle', style: 'backgroundColor:#87d068' },
@@ -75,13 +74,8 @@ export default {
7574
this.visible = !this.visible
7675
},
7776
clearJobs () {
78-
this.jobs = this.jobs.filter(x => x.status === 'progress')
79-
this.$store.commit('SET_ASYNC_JOB_IDS', this.jobs)
80-
},
81-
startPolling () {
82-
this.poller = setInterval(() => {
83-
this.pollJobs()
84-
}, 4000)
77+
this.notices = this.notices.filter(x => x.status === 'progress')
78+
this.$store.commit('SET_HEADER_NOTICES', this.notices)
8579
},
8680
getResourceName (description, data) {
8781
if (description) {
@@ -92,61 +86,15 @@ export default {
9286
const msg = description.substring(description.indexOf(')') + 1)
9387
return msg
9488
}
95-
},
96-
async pollJobs () {
97-
var hasUpdated = false
98-
for (var i in this.jobs) {
99-
if (this.jobs[i].status === 'progress') {
100-
await api('queryAsyncJobResult', { jobid: this.jobs[i].jobid }).then(json => {
101-
var result = json.queryasyncjobresultresponse
102-
if (result.jobstatus === 1 && this.jobs[i].status !== 'done') {
103-
hasUpdated = true
104-
const title = this.jobs[i].title
105-
const description = this.jobs[i].description
106-
this.$message.success({
107-
content: title + (description ? ' - ' + description : ''),
108-
key: this.jobs[i].jobid,
109-
duration: 2
110-
})
111-
this.jobs[i].status = 'done'
112-
} else if (result.jobstatus === 2 && this.jobs[i].status !== 'failed') {
113-
hasUpdated = true
114-
this.jobs[i].status = 'failed'
115-
if (result.jobresult.errortext !== null) {
116-
this.jobs[i].description = '(' + this.jobs[i].description + ') ' + result.jobresult.errortext
117-
}
118-
if (!this.jobs[i].bulkAction) {
119-
this.$notification.error({
120-
message: this.jobs[i].title,
121-
description: this.jobs[i].description,
122-
key: this.jobs[i].jobid,
123-
duration: 0
124-
})
125-
}
126-
}
127-
}).catch(function (e) {
128-
console.log(this.$t('error.fetching.async.job.result') + e)
129-
})
130-
}
131-
}
132-
if (hasUpdated) {
133-
this.$store.commit('SET_ASYNC_JOB_IDS', this.jobs.reverse())
134-
}
13589
}
13690
},
137-
beforeDestroy () {
138-
clearInterval(this.poller)
139-
},
140-
created () {
141-
this.startPolling()
142-
},
14391
mounted () {
144-
this.jobs = (store.getters.asyncJobIds || []).reverse()
92+
this.notices = (store.getters.headerNotices || []).reverse()
14593
this.$store.watch(
146-
(state, getters) => getters.asyncJobIds,
94+
(state, getters) => getters.headerNotices,
14795
(newValue, oldValue) => {
14896
if (oldValue !== newValue && newValue !== undefined) {
149-
this.jobs = newValue.reverse()
97+
this.notices = newValue.reverse()
15098
}
15199
}
152100
)

ui/src/components/view/ActionButton.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ export default {
145145
this.actionBadge = {}
146146
const arrAsync = []
147147
const actionBadge = this.actions.filter(action => action.showBadge === true)
148+
if ((actionBadge.dataView ? actionBadge.dataView : false) !== this.dataView) return
148149
149150
if (actionBadge && actionBadge.length > 0) {
150151
const dataLength = actionBadge.length

ui/src/components/view/DedicateData.vue

Lines changed: 8 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -175,20 +175,13 @@ export default {
175175
}).then(response => {
176176
this.$pollJob({
177177
jobId: response.releasededicatedzoneresponse.jobid,
178+
title: this.$t('label.release.dedicated.zone'),
179+
description: this.resource.id,
178180
successMessage: this.$t('message.dedicated.zone.released'),
179181
successMethod: () => {
180-
this.parentFetchData()
181182
this.dedicatedDomainId = null
182-
this.$store.dispatch('AddAsyncJob', {
183-
title: this.$t('message.dedicated.zone.released'),
184-
jobid: response.releasededicatedzoneresponse.jobid,
185-
status: 'progress'
186-
})
187183
},
188184
errorMessage: this.$t('error.release.dedicate.zone'),
189-
errorMethod: () => {
190-
this.parentFetchData()
191-
},
192185
loadingMessage: this.$t('message.releasing.dedicated.zone'),
193186
catchMessage: this.$t('error.fetching.async.job.result'),
194187
catchMethod: () => {
@@ -205,20 +198,13 @@ export default {
205198
}).then(response => {
206199
this.$pollJob({
207200
jobId: response.releasededicatedpodresponse.jobid,
201+
title: this.$t('label.release.dedicated.pod'),
202+
description: this.resource.id,
208203
successMessage: this.$t('message.pod.dedication.released'),
209204
successMethod: () => {
210-
this.parentFetchData()
211205
this.dedicatedDomainId = null
212-
this.$store.dispatch('AddAsyncJob', {
213-
title: this.$t('message.pod.dedication.released'),
214-
jobid: response.releasededicatedpodresponse.jobid,
215-
status: 'progress'
216-
})
217206
},
218207
errorMessage: this.$t('error.release.dedicate.pod'),
219-
errorMethod: () => {
220-
this.parentFetchData()
221-
},
222208
loadingMessage: this.$t('message.releasing.dedicated.pod'),
223209
catchMessage: this.$t('error.fetching.async.job.result'),
224210
catchMethod: () => {
@@ -235,20 +221,13 @@ export default {
235221
}).then(response => {
236222
this.$pollJob({
237223
jobId: response.releasededicatedclusterresponse.jobid,
224+
title: this.$t('label.release.dedicated.cluster'),
225+
description: this.resource.id,
238226
successMessage: this.$t('message.cluster.dedication.released'),
239227
successMethod: () => {
240-
this.parentFetchData()
241228
this.dedicatedDomainId = null
242-
this.$store.dispatch('AddAsyncJob', {
243-
title: this.$t('message.cluster.dedication.released'),
244-
jobid: response.releasededicatedclusterresponse.jobid,
245-
status: 'progress'
246-
})
247229
},
248230
errorMessage: this.$t('error.release.dedicate.cluster'),
249-
errorMethod: () => {
250-
this.parentFetchData()
251-
},
252231
loadingMessage: this.$t('message.releasing.dedicated.cluster'),
253232
catchMessage: this.$t('error.fetching.async.job.result'),
254233
catchMethod: () => {
@@ -265,20 +244,13 @@ export default {
265244
}).then(response => {
266245
this.$pollJob({
267246
jobId: response.releasededicatedhostresponse.jobid,
247+
title: this.$t('label.release.dedicated.host'),
248+
description: this.resource.id,
268249
successMessage: this.$t('message.host.dedication.released'),
269250
successMethod: () => {
270-
this.parentFetchData()
271251
this.dedicatedDomainId = null
272-
this.$store.dispatch('AddAsyncJob', {
273-
title: this.$t('message.host.dedication.released'),
274-
jobid: response.releasededicatedhostresponse.jobid,
275-
status: 'progress'
276-
})
277252
},
278253
errorMessage: this.$t('error.release.dedicate.host'),
279-
errorMethod: () => {
280-
this.parentFetchData()
281-
},
282254
loadingMessage: this.$t('message.releasing.dedicated.host'),
283255
catchMessage: this.$t('error.fetching.async.job.result'),
284256
catchMethod: () => {

ui/src/components/view/DedicateModal.vue

Lines changed: 9 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -93,22 +93,16 @@ export default {
9393
}).then(response => {
9494
this.$pollJob({
9595
jobId: response.dedicatezoneresponse.jobid,
96-
successMessage: this.$t('label.zone.dedicated'),
96+
title: this.$t('label.dedicate.zone'),
97+
description: `${this.$t('label.domain.id')} : ${this.domainId}`,
98+
successMessage: `${this.$t('label.zone.dedicated')}`,
9799
successMethod: () => {
98-
this.parentFetchData()
99100
this.fetchParentData()
100101
this.dedicatedDomainId = this.domainId
101102
this.dedicatedDomainModal = false
102-
this.$store.dispatch('AddAsyncJob', {
103-
title: this.$t('label.zone.dedicated'),
104-
jobid: response.dedicatezoneresponse.jobid,
105-
description: `${this.$t('label.domain.id')} : ${this.dedicatedDomainId}`,
106-
status: 'progress'
107-
})
108103
},
109104
errorMessage: this.$t('error.dedicate.zone.failed'),
110105
errorMethod: () => {
111-
this.parentFetchData()
112106
this.fetchParentData()
113107
this.dedicatedDomainModal = false
114108
},
@@ -137,22 +131,16 @@ export default {
137131
}).then(response => {
138132
this.$pollJob({
139133
jobId: response.dedicatepodresponse.jobid,
134+
title: this.$t('label.dedicate.pod'),
135+
description: `${this.$t('label.domain.id')} : ${this.domainId}`,
140136
successMessage: this.$t('label.pod.dedicated'),
141137
successMethod: () => {
142-
this.parentFetchData()
143138
this.fetchParentData()
144139
this.dedicatedDomainId = this.domainId
145140
this.dedicatedDomainModal = false
146-
this.$store.dispatch('AddAsyncJob', {
147-
title: this.$t('label.pod.dedicated'),
148-
jobid: response.dedicatepodresponse.jobid,
149-
description: `${this.$t('label.domainid')}: ${this.dedicatedDomainId}`,
150-
status: 'progress'
151-
})
152141
},
153142
errorMessage: this.$t('error.dedicate.pod.failed'),
154143
errorMethod: () => {
155-
this.parentFetchData()
156144
this.fetchParentData()
157145
this.dedicatedDomainModal = false
158146
},
@@ -181,22 +169,16 @@ export default {
181169
}).then(response => {
182170
this.$pollJob({
183171
jobId: response.dedicateclusterresponse.jobid,
172+
title: this.$t('label.dedicate.cluster'),
173+
description: `${this.$t('label.domain.id')} : ${this.domainId}`,
184174
successMessage: this.$t('message.cluster.dedicated'),
185175
successMethod: () => {
186-
this.parentFetchData()
187176
this.fetchParentData()
188177
this.dedicatedDomainId = this.domainId
189178
this.dedicatedDomainModal = false
190-
this.$store.dispatch('AddAsyncJob', {
191-
title: this.$t('message.cluster.dedicated'),
192-
jobid: response.dedicateclusterresponse.jobid,
193-
description: `${this.$t('label.domainid')}: ${this.dedicatedDomainId}`,
194-
status: 'progress'
195-
})
196179
},
197180
errorMessage: this.$t('error.dedicate.cluster.failed'),
198181
errorMethod: () => {
199-
this.parentFetchData()
200182
this.fetchParentData()
201183
this.dedicatedDomainModal = false
202184
},
@@ -225,22 +207,16 @@ export default {
225207
}).then(response => {
226208
this.$pollJob({
227209
jobId: response.dedicatehostresponse.jobid,
210+
title: this.$t('label.dedicate.host'),
211+
description: `${this.$t('label.domain.id')} : ${this.domainId}`,
228212
successMessage: this.$t('message.host.dedicated'),
229213
successMethod: () => {
230-
this.parentFetchData()
231214
this.fetchParentData()
232215
this.dedicatedDomainId = this.domainId
233216
this.dedicatedDomainModal = false
234-
this.$store.dispatch('AddAsyncJob', {
235-
title: this.$t('message.host.dedicated'),
236-
jobid: response.dedicatehostresponse.jobid,
237-
description: `${this.$t('label.domainid')}: ${this.dedicatedDomainId}`,
238-
status: 'progress'
239-
})
240217
},
241218
errorMessage: this.$t('error.dedicate.host.failed'),
242219
errorMethod: () => {
243-
this.parentFetchData()
244220
this.fetchParentData()
245221
this.dedicatedDomainModal = false
246222
},

ui/src/core/bootstrap.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
DEFAULT_FIXED_SIDEMENU,
3232
DEFAULT_CONTENT_WIDTH_TYPE,
3333
DEFAULT_MULTI_TAB,
34-
ASYNC_JOB_IDS
34+
HEADER_NOTICES
3535
} from '@/store/mutation-types'
3636

3737
export default function Initializer () {
@@ -47,5 +47,5 @@ export default function Initializer () {
4747
store.commit('TOGGLE_MULTI_TAB', Vue.ls.get(DEFAULT_MULTI_TAB, config.multiTab))
4848
store.commit('SET_TOKEN', Vue.ls.get(ACCESS_TOKEN))
4949
store.commit('SET_PROJECT', Vue.ls.get(CURRENT_PROJECT))
50-
store.commit('SET_ASYNC_JOB_IDS', Vue.ls.get(ASYNC_JOB_IDS) || [])
50+
store.commit('SET_HEADER_NOTICES', Vue.ls.get(HEADER_NOTICES) || [])
5151
}

ui/src/store/getters.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const getters = {
3030
userInfo: state => state.user.info,
3131
addRouters: state => state.permission.addRouters,
3232
multiTab: state => state.app.multiTab,
33-
asyncJobIds: state => state.user.asyncJobIds,
33+
headerNotices: state => state.user.headerNotices,
3434
isLdapEnabled: state => state.user.isLdapEnabled,
3535
cloudian: state => state.user.cloudian,
3636
zones: state => state.user.zones,

0 commit comments

Comments
 (0)