feat: 概览页重启按钮优化 (#2926)

Refs #2921
pull/2933/head
ssongliu 1 year ago committed by GitHub
parent 78576a3724
commit fb556d6149
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -31,7 +31,7 @@ func NewIDashboardService() IDashboardService {
}
func (u *DashboardService) Restart(operation string) error {
if operation != "panel" && operation != "system" {
if operation != "1panel" && operation != "system" {
return fmt.Errorf("handle restart operation %s failed, err: nonsupport such operation", operation)
}
itemCmd := fmt.Sprintf("%s 1pctl restart", cmd.SudoHandleCmd())

@ -6,8 +6,8 @@
</div>
</template>
<div>
<span style="font-size: 12px">{{ operationInfo }}</span>
<div style="margin-top: 10px">
<span v-if="operationInfo" style="font-size: 12px">{{ operationInfo }}</span>
<div :style="{ 'margin-top': operationInfo ? '10px' : '0px' }">
<span style="font-size: 12px">{{ $t('commons.msg.operateConfirm') }}</span>
<span style="font-size: 12px; color: red; font-weight: 500">'{{ submitInputInfo }}'</span>
</div>

@ -286,9 +286,6 @@ const message = {
home: {
restart_1panel: 'Restart Panel',
restart_system: 'Restart Server',
panel: '1Panel',
system: '1Panel Server',
restartHelper: 'About to restart {0}, do you want to continue?',
operationSuccess: 'Operation successful! Restarting, please wait...',
overview: 'Overview',
entranceHelper:

@ -284,9 +284,6 @@ const message = {
home: {
restart_1panel: '',
restart_system: '',
panel: '1Panel ',
system: '1Panel ',
restartHelper: ' {0}',
operationSuccess: '...',
overview: '',
entranceHelper: ' - ',

@ -284,9 +284,6 @@ const message = {
home: {
restart_1panel: '',
restart_system: '',
panel: '1Panel ',
system: '1Panel ',
restartHelper: ' {0}',
operationSuccess: '...',
overview: '',
entranceHelper: ' - ',

@ -10,11 +10,11 @@
>
<template #route-button>
<div class="router-button">
<el-button link type="primary" @click="restart('panel')">
<el-button link type="primary" @click="onRestart('1panel')">
{{ $t('home.restart_1panel') }}
</el-button>
<el-divider direction="vertical" />
<el-button link type="primary" @click="restart('system')">
<el-button link type="primary" @click="onRestart('system')">
{{ $t('home.restart_system') }}
</el-button>
</div>
@ -230,10 +230,13 @@
</CardWithHeader>
</el-col>
</el-row>
<ConfirmDialog ref="confirmDialogRef" @confirm="onSave"></ConfirmDialog>
</div>
</template>
<script lang="ts" setup>
import ConfirmDialog from '@/components/confirm-dialog/index.vue';
import { onMounted, onBeforeUnmount, ref, reactive } from 'vue';
import Status from '@/views/home/status/index.vue';
import App from '@/views/home/app/index.vue';
@ -252,6 +255,8 @@ const router = useRouter();
const globalStore = GlobalStore();
const statusRef = ref();
const restartType = ref();
const confirmDialogRef = ref();
const appRef = ref();
const isSafety = ref();
@ -540,20 +545,19 @@ const loadSafeStatus = async () => {
isSafety.value = res.data.securityEntrance;
};
const restart = async (type: string) => {
ElMessageBox.confirm(
i18n.global.t('home.restartHelper', [i18n.global.t('home.' + type)]),
i18n.global.t('commons.msg.operate'),
{
confirmButtonText: i18n.global.t('commons.button.confirm'),
cancelButtonText: i18n.global.t('commons.button.cancel'),
type: 'info',
},
).then(async () => {
globalStore.isOnRestart = true;
MsgSuccess(i18n.global.t('home.operationSuccess'));
await systemRestart(type);
});
const onRestart = (type: string) => {
restartType.value = type;
let params = {
header: i18n.global.t('home.restart_' + type),
operationInfo: '',
submitInputInfo: i18n.global.t('database.restartNow'),
};
confirmDialogRef.value!.acceptParams(params);
};
const onSave = async () => {
globalStore.isOnRestart = true;
MsgSuccess(i18n.global.t('home.operationSuccess'));
await systemRestart(restartType.value);
};
const onFocus = () => {

Loading…
Cancel
Save