-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Expand file tree
/
Copy pathdialog.vue
More file actions
83 lines (77 loc) · 2.36 KB
/
dialog.vue
File metadata and controls
83 lines (77 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<template>
<DialogPro v-model="open" :title="$t('commons.msg.infoTitle')" size="small">
<el-form ref="formRef" label-position="top" @submit.prevent>
<el-form-item :label="$t('xpack.node.syncProxyHelper')">
<el-radio-group v-model="restart">
<el-radio :value="true">{{ $t('setting.restartNow') }}</el-radio>
<el-radio :value="false">{{ $t('setting.restartLater') }}</el-radio>
</el-radio-group>
<span class="input-help" v-if="restart">{{ $t('xpack.node.syncProxyHelper1') }}</span>
<span class="input-help" v-else>{{ $t('xpack.node.syncProxyHelper2') }}</span>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="open = false">
{{ $t('commons.button.cancel') }}
</el-button>
<el-button type="primary" @click="onConfirm">
{{ $t('commons.button.confirm') }}
</el-button>
</span>
</template>
</DialogPro>
</template>
<script lang="ts" setup>
import { getSettingInfo } from '@/api/modules/setting';
import { searchXpackSetting } from '@/extensions/xpack';
const open = ref(false);
const restart = ref(true);
const em = defineEmits(['update:withDockerRestart', 'submit']);
interface DialogProps {
syncList: string;
open: boolean;
}
const emit = () => {
em('update:withDockerRestart', false);
em('submit');
};
const acceptParams = async (props: DialogProps): Promise<void> => {
if (props.syncList.indexOf('SyncSystemProxy') === -1) {
emit();
return;
}
if (props.open) {
open.value = true;
return;
}
try {
const res = await getSettingInfo();
if (res.data.proxyType === '' || res.data.proxyType === 'close') {
emit();
return;
}
} catch (error) {
emit();
return;
}
const res = await searchXpackSetting();
if (!res) {
emit();
return;
}
if (res.data.proxyDocker === '') {
emit();
return;
}
open.value = true;
};
const onConfirm = async () => {
em('update:withDockerRestart', restart.value);
em('submit');
open.value = false;
};
defineExpose({
acceptParams,
});
</script>