Skip to content

Commit 7dca825

Browse files
authored
Merge pull request #9255 from GuoLiBin6/feat/glb-to-4.0/src
feat: vm add kickstart complete action
2 parents d7aee06 + defbd56 commit 7dca825

File tree

9 files changed

+99
-6
lines changed

9 files changed

+99
-6
lines changed

containers/Compute/locales/en.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2000,5 +2000,9 @@
20002000
"compute.snapshotpolicy_bind_server_tip": "If the disk bound to the virtual machine is bound to an automatic snapshot policy, the automatic snapshot policy of the virtual machine will be automatically unbound when binding the automatic snapshot policy of the disk",
20012001
"compute.kickstart": "Kickstart",
20022002
"compute.kickstart.tooltip": "Only supported for ISO images of CentOS, RHEL, OpenEuler, and Ubuntu distributions",
2003-
"compute.kickstart_placeholder": "Please enter the kickstart script, which can be referenced in the official documentation of each system distribution."
2003+
"compute.kickstart_placeholder": "Please enter the kickstart script, which can be referenced in the official documentation of each system distribution.",
2004+
"compute.kickstart_complete": "Kickstart complete",
2005+
"compute.kickstart_complete_action": "Manually trigger kickstart complete",
2006+
"compute.kickstart_complete_tip": "Only the [Kickstart installing] state supports this operation",
2007+
"compute.kickstart_complete_tip_2": "Manually trigger kickstart complete, and the virtual machine will be restarted to try to boot"
20042008
}

containers/Compute/locales/ja-JP.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2002,5 +2002,9 @@
20022002
"compute.snapshotpolicy_bind_server_tip": "仮想マシンにバインドされているHDDが自動快照ポリシーにバインドされている場合、仮想マシンの自動快照ポリシーをバインドするとHDDの自動快照ポリシーが自動的にバインド解除されます",
20032003
"compute.kickstart": "Kickstart",
20042004
"compute.kickstart.tooltip": "CentOS、RHEL、OpenEuler、Ubuntu発行版のISOイメージのみサポート",
2005-
"compute.kickstart_placeholder": "各システム発行版の公式ドキュメントを参照してください。"
2005+
"compute.kickstart_placeholder": "各システム発行版の公式ドキュメントを参照してください。",
2006+
"compute.kickstart_complete": "Kickstart complete",
2007+
"compute.kickstart_complete_action": "Manually trigger kickstart complete",
2008+
"compute.kickstart_complete_tip": "Only the [Kickstart installing] state supports this operation",
2009+
"compute.kickstart_complete_tip_2": "Manually trigger kickstart complete, and the virtual machine will be restarted to try to boot"
20062010
}

containers/Compute/locales/zh-CN.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2004,5 +2004,9 @@
20042004
"compute.snapshotpolicy_bind_server_tip": "若虚拟机的硬盘绑定了自动快照策略,则绑定虚拟机自动快照策略时会自动解绑硬盘自动快照策略",
20052005
"compute.kickstart": "无人值守安装",
20062006
"compute.kickstart.tooltip": "仅支持CentOS、RHEL、OpenEuler、Ubuntu发行版的ISO镜像",
2007-
"compute.kickstart_placeholder": "请输入kickstart脚本,可参考各系统发行版官方文档."
2007+
"compute.kickstart_placeholder": "请输入kickstart脚本,可参考各系统发行版官方文档.",
2008+
"compute.kickstart_complete": "无人值守安装完成",
2009+
"compute.kickstart_complete_action": "手动触发无人值守安装完成",
2010+
"compute.kickstart_complete_tip": "仅【无人值守安装中】状态支持该操作",
2011+
"compute.kickstart_complete_tip_2": "手动触发无人值守安装完成,触发后会重启,尝试引导虚拟机"
20082012
}

containers/Compute/views/vminstance/constants/actions.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,26 @@ const getSingleActions = function (ctx) {
645645
},
646646
hidden: (row) => !(hasSetupKey(['onecloud'])) || this.$isScopedPolicyMenuHidden('vminstance_hidden_menus.server_perform_screen_dump'),
647647
},
648+
// 手动触发无人值守安装完成
649+
{
650+
label: i18n.t('compute.kickstart_complete'),
651+
permission: 'server_perform_kickstart_complete',
652+
action: () => {
653+
this.createDialog('VmKickstartComplateDialog', {
654+
data: [obj],
655+
columns: this.columns,
656+
onManager: this.onManager,
657+
})
658+
},
659+
meta: () => {
660+
const ret = {
661+
validate: obj.status === 'kickstart_installing',
662+
tooltip: obj.status !== 'kickstart_installing' ? '' : i18n.t('compute.kickstart_complete_tip'),
663+
}
664+
return ret
665+
},
666+
hidden: () => this.$isScopedPolicyMenuHidden('vminstance_hidden_menus.server_perform_kickstart_complete'),
667+
},
648668
],
649669
},
650670
// * 属性设置
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<template>
2+
<base-dialog @cancel="cancelDialog">
3+
<div slot="header">{{$t('compute.kickstart_complete_action')}}</div>
4+
<div slot="body">
5+
<a-alert class="mb-2" type="warning">
6+
<div slot="message">{{$t('compute.kickstart_complete_tip_2')}}</div>
7+
</a-alert>
8+
<dialog-selected-tips :name="$t('dictionary.server')" :count="params.data.length" :action="$t('compute.kickstart_complete_action')" />
9+
<dialog-table :data="params.data" :columns="columns" />
10+
</div>
11+
<div slot="footer">
12+
<a-button type="primary" @click="handleConfirm" :loading="loading">{{ $t('dialog.ok') }}</a-button>
13+
<a-button @click="cancelDialog">{{ $t('dialog.cancel') }}</a-button>
14+
</div>
15+
</base-dialog>
16+
</template>
17+
18+
<script>
19+
import DialogMixin from '@/mixins/dialog'
20+
import WindowsMixin from '@/mixins/windows'
21+
22+
export default {
23+
name: 'VmKickstartComplateDialog',
24+
mixins: [DialogMixin, WindowsMixin],
25+
data () {
26+
return {
27+
loading: false,
28+
}
29+
},
30+
computed: {
31+
columns () {
32+
const fields = ['name', 'instance_type', 'brand']
33+
return this.params.columns.filter(item => {
34+
const { field } = item
35+
return fields.indexOf(field) > -1
36+
})
37+
},
38+
},
39+
methods: {
40+
async handleConfirm () {
41+
this.loading = true
42+
try {
43+
await this.params.onManager('performAction', {
44+
id: this.params.data[0].id,
45+
steadyStatus: ['running', 'ready'],
46+
managerArgs: {
47+
action: 'kickstart-complete',
48+
},
49+
})
50+
this.cancelDialog()
51+
} finally {
52+
this.loading = false
53+
}
54+
},
55+
},
56+
}
57+
</script>

src/constants/permission.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ export const PERMISSION = {
439439
server_perform_stop_rescue: ['compute', 'servers', 'perform', 'stop-rescue'],
440440
server_perform_screen_dump: ['compute', 'servers', 'perform', 'screen-dump'],
441441
server_perform_change_billing_type: ['compute', 'servers', 'perform', 'change-billing-type'],
442+
server_perform_kickstart_complete: ['compute', 'servers', 'perform', 'kickstart-complete'],
442443
/**
443444
* images 相关操作
444445
*/

src/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@
184184
"create_container_failed": "Creation failed",
185185
"delete_container_failed": "Delete container failed",
186186
"snapshot_delete": "Delete snapshot",
187-
"change_billing_type": "Change billing mode"
187+
"change_billing_type": "Change billing mode",
188+
"kickstart_installing": "Kickstart installing"
188189
},
189190
"network": {
190191
"init": "Initialize",

src/locales/ja-JP.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@
184184
"create_container_failed": "作成に失敗しました",
185185
"delete_container_failed": "削除に失敗しました",
186186
"snapshot_delete": "スナップショットを削除してください。",
187-
"change_billing_type": "課金モードの変更"
187+
"change_billing_type": "課金モードの変更",
188+
"kickstart_installing": "無人インストール中"
188189
},
189190
"network": {
190191
"init": "初期化する",

src/locales/zh-CN.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@
191191
"create_container_failed": "创建失败",
192192
"delete_container_failed": "删除失败",
193193
"snapshot_delete": "删除快照",
194-
"change_billing_type": "修改计费模式"
194+
"change_billing_type": "修改计费模式",
195+
"kickstart_installing": "无人值守安装中"
195196
},
196197
"network": {
197198
"init": "初始化",

0 commit comments

Comments
 (0)