Skip to content

Commit e2547a4

Browse files
authored
Merge pull request #9822 from GuoLiBin6/automated-cherry-pick-of-#9819-upstream-master
Automated cherry pick of #9819: feat: Disable synchronization status in backup saving
2 parents 19f4bd5 + 82b8626 commit e2547a4

4 files changed

Lines changed: 147 additions & 117 deletions

File tree

containers/Compute/views/disk-backup/components/List.vue

Lines changed: 68 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -61,65 +61,76 @@ export default {
6161
}),
6262
groupActions: [
6363
{
64-
label: this.$t('compute.perform_sync_status'),
65-
permission: 'diskbackups_perform_syncstatus',
66-
action: () => {
67-
this.onManager('batchPerformAction', {
68-
steadyStatus: ['running', 'ready'],
69-
managerArgs: {
70-
action: 'syncstatus',
64+
label: this.$t('compute.text_275'),
65+
actions: () => {
66+
return [
67+
{
68+
label: this.$t('compute.perform_sync_status'),
69+
permission: 'diskbackups_perform_syncstatus',
70+
action: () => {
71+
this.onManager('batchPerformAction', {
72+
steadyStatus: ['running', 'ready'],
73+
managerArgs: {
74+
action: 'syncstatus',
75+
},
76+
})
77+
},
78+
meta: () => {
79+
const hasSaving = this.list.selectedItems.some(item => item.status === 'saving')
80+
return {
81+
validate: this.list.selected.length && !hasSaving,
82+
tooltip: hasSaving ? this.$t('compute.text_1397') : '',
83+
}
84+
},
7185
},
72-
})
73-
},
74-
meta: () => ({
75-
validate: this.list.selected.length,
76-
}),
77-
},
78-
{
79-
label: this.$t('table.action.set_tag'),
80-
permission: 'diskbackups_perform_set_user_metadata',
81-
action: () => {
82-
this.createDialog('SetTagDialog', {
83-
data: this.list.selectedItems,
84-
columns: this.columns,
85-
onManager: this.onManager,
86-
mode: 'add',
87-
params: {
88-
resources: 'diskbackups',
86+
{
87+
label: this.$t('table.action.set_tag'),
88+
permission: 'diskbackups_perform_set_user_metadata',
89+
action: () => {
90+
this.createDialog('SetTagDialog', {
91+
data: this.list.selectedItems,
92+
columns: this.columns,
93+
onManager: this.onManager,
94+
mode: 'add',
95+
params: {
96+
resources: 'diskbackups',
97+
},
98+
tipName: this.$t('compute.text_462'),
99+
})
100+
},
101+
meta: () => {
102+
return {
103+
validate: this.list.selected.length,
104+
tooltip: null,
105+
}
106+
},
89107
},
90-
tipName: this.$t('compute.text_462'),
91-
})
92-
},
93-
meta: () => {
94-
return {
95-
validate: this.list.selected.length,
96-
tooltip: null,
97-
}
98-
},
99-
},
100-
{
101-
label: this.$t('compute.perform_delete'),
102-
permission: 'diskbackups_delete',
103-
action: () => {
104-
this.createDialog('DeleteResDialog', {
105-
vm: this,
106-
data: this.list.selectedItems,
107-
columns: this.columns,
108-
onManager: this.onManager,
109-
title: this.$t('compute.perform_delete'),
110-
name: this.$t('compute.text_462'),
111-
})
112-
},
113-
meta: () => {
114-
const ret = {
115-
validate: this.list.selected.length,
116-
tooltip: null,
117-
}
118-
if (this.list.selectedItems.some(item => !item.can_delete)) {
119-
ret.validate = false
120-
return ret
121-
}
122-
return ret
108+
{
109+
label: this.$t('compute.perform_delete'),
110+
permission: 'diskbackups_delete',
111+
action: () => {
112+
this.createDialog('DeleteResDialog', {
113+
vm: this,
114+
data: this.list.selectedItems,
115+
columns: this.columns,
116+
onManager: this.onManager,
117+
title: this.$t('compute.perform_delete'),
118+
name: this.$t('compute.text_462'),
119+
})
120+
},
121+
meta: () => {
122+
const ret = {
123+
validate: this.list.selected.length,
124+
tooltip: null,
125+
}
126+
if (this.list.selectedItems.some(item => !item.can_delete)) {
127+
ret.validate = false
128+
return ret
129+
}
130+
return ret
131+
},
132+
},
133+
]
123134
},
124135
},
125136
],

containers/Compute/views/disk-backup/mixins/singleActions.js

Lines changed: 47 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,6 @@ import i18n from '@/locales'
33
export default {
44
created () {
55
this.singleActions = [
6-
{
7-
label: i18n.t('compute.perform_sync_status'),
8-
permission: 'diskbackups_perform_syncstatus',
9-
action: obj => {
10-
this.onManager('performAction', {
11-
steadyStatus: ['running', 'ready'],
12-
id: obj.id,
13-
managerArgs: {
14-
action: 'syncstatus',
15-
},
16-
})
17-
},
18-
meta: () => ({
19-
validate: true,
20-
}),
21-
},
226
{
237
label: i18n.t('compute.text_478'),
248
permission: 'diskbackups_perform_recovery',
@@ -36,27 +20,54 @@ export default {
3620
}),
3721
},
3822
{
39-
label: i18n.t('compute.perform_delete'),
40-
permission: 'diskbackups_delete',
41-
action: obj => {
42-
this.createDialog('DeleteResDialog', {
43-
vm: this,
44-
data: [obj],
45-
columns: this.columns,
46-
title: i18n.t('compute.perform_delete'),
47-
onManager: this.onManager,
48-
name: i18n.t('compute.disk_backup'),
49-
content: () => {
50-
const change = (bool) => {
51-
this.deleteResProps.force = bool
52-
}
53-
return <a-checkbox onInput={ change }>{ this.$t('compute.text_655') }</a-checkbox>
23+
label: i18n.t('compute.text_352'),
24+
actions: obj => {
25+
return [
26+
{
27+
label: i18n.t('compute.perform_sync_status'),
28+
permission: 'diskbackups_perform_syncstatus',
29+
action: obj => {
30+
this.onManager('performAction', {
31+
steadyStatus: ['running', 'ready'],
32+
id: obj.id,
33+
managerArgs: {
34+
action: 'syncstatus',
35+
},
36+
})
37+
},
38+
meta: obj => {
39+
const isSaving = obj.status === 'saving'
40+
return {
41+
validate: !isSaving,
42+
tooltip: isSaving ? i18n.t('compute.text_1397') : '',
43+
}
44+
},
5445
},
55-
requestParams: this.deleteResProps,
56-
})
57-
},
58-
meta: obj => {
59-
return this.$getDeleteResult(obj)
46+
{
47+
label: i18n.t('compute.perform_delete'),
48+
permission: 'diskbackups_delete',
49+
action: obj => {
50+
this.createDialog('DeleteResDialog', {
51+
vm: this,
52+
data: [obj],
53+
columns: this.columns,
54+
title: i18n.t('compute.perform_delete'),
55+
onManager: this.onManager,
56+
name: i18n.t('compute.disk_backup'),
57+
content: () => {
58+
const change = (bool) => {
59+
this.deleteResProps.force = bool
60+
}
61+
return <a-checkbox onInput={ change }>{ this.$t('compute.text_655') }</a-checkbox>
62+
},
63+
requestParams: this.deleteResProps,
64+
})
65+
},
66+
meta: obj => {
67+
return this.$getDeleteResult(obj)
68+
},
69+
},
70+
]
6071
},
6172
},
6273
]

containers/Compute/views/instance-backup/components/List.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,13 @@ export default {
105105
},
106106
})
107107
},
108-
meta: () => ({
109-
validate: this.list.selected.length,
110-
}),
108+
meta: () => {
109+
const hasSaving = this.list.selectedItems.some(item => item.status === 'saving')
110+
return {
111+
validate: this.list.selected.length && !hasSaving,
112+
tooltip: hasSaving ? this.$t('compute.text_1397') : '',
113+
}
114+
},
111115
},
112116
{
113117
label: this.$t('table.action.set_tag'),

containers/Compute/views/instance-backup/mixins/singleActions.js

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,44 @@ export default {
44
created () {
55
this.singleActions = [
66
{
7-
label: i18n.t('compute.perform_sync_status'),
8-
permission: 'instancebackups_perform_syncstatus',
7+
label: i18n.t('compute.text_478'),
8+
permission: 'instancebackups_perform_recovery',
99
action: obj => {
10-
this.onManager('performAction', {
11-
steadyStatus: ['ready'],
12-
id: obj.id,
13-
managerArgs: {
14-
action: 'syncstatus',
15-
},
10+
this.createDialog('InstanceBackupRollbackDialog', {
11+
data: [obj],
12+
columns: this.columns,
13+
onManager: this.onManager,
14+
refresh: this.refresh,
1615
})
1716
},
18-
meta: () => ({
19-
validate: true,
17+
meta: obj => ({
18+
validate: obj.status === 'ready',
19+
tooltip: obj.status === 'ready' ? '' : i18n.t('compute.instance_backup_not_ready_alert'),
2020
}),
2121
},
2222
{
2323
label: i18n.t('compute.text_352'),
2424
actions: obj => {
2525
return [
2626
{
27-
label: i18n.t('compute.text_478'),
28-
permission: 'instancebackups_perform_recovery',
27+
label: i18n.t('compute.perform_sync_status'),
28+
permission: 'instancebackups_perform_syncstatus',
2929
action: obj => {
30-
this.createDialog('InstanceBackupRollbackDialog', {
31-
data: [obj],
32-
columns: this.columns,
33-
onManager: this.onManager,
34-
refresh: this.refresh,
30+
this.onManager('performAction', {
31+
steadyStatus: ['ready'],
32+
id: obj.id,
33+
managerArgs: {
34+
action: 'syncstatus',
35+
},
3536
})
3637
},
37-
meta: obj => ({
38-
validate: obj.status === 'ready',
39-
tooltip: obj.status === 'ready' ? '' : i18n.t('compute.instance_backup_not_ready_alert'),
40-
}),
38+
meta: obj => {
39+
const isSaving = obj.status === 'saving'
40+
return {
41+
validate: !isSaving,
42+
tooltip: isSaving ? i18n.t('compute.text_1397') : '',
43+
}
44+
},
4145
},
4246
{
4347
label: this.$t('compute.unpack'),

0 commit comments

Comments
 (0)