1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-13 17:24:44 +08:00

style: 修改初始化 Supervisor 的提示文字 (#1838)

This commit is contained in:
zhengkunwang 2023-08-04 18:22:01 +08:00 committed by GitHub
parent a516ba9d63
commit ac7e47bdf1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 42 additions and 11 deletions

View File

@ -185,12 +185,10 @@ func (h *HostToolService) CreateToolConfig(req request.HostToolCreate) error {
return err
}
}
go func() {
if err = systemctl.Restart(req.ServiceName); err != nil {
global.LOG.Errorf("[init] restart %s failed err %s", req.ServiceName, err.Error())
}
}()
if err = systemctl.Restart(req.ServiceName); err != nil {
global.LOG.Errorf("[init] restart %s failed err %s", req.ServiceName, err.Error())
return err
}
}
return nil
}

View File

@ -1671,13 +1671,16 @@ const message = {
dir: 'run directory',
numprocs: 'Number of processes',
initWarn:
'Because it is not compatible with the original configuration, initializing Supervisor will modify the files parameter of the configuration file, causing all existing processes to stop, please confirm the risk in advance. The modified process configuration folder is in <1Panel installation directory>/1panel/tools/supervisord/supervisor.d',
'The initialization operation needs to modify the [include] files parameter of the configuration file, the directory where the modified service configuration file is located: 1panel installation directory/1panel/tools/supervisord/supervisor.d/',
operatorHelper: 'Operation {1} will be performed on {0}, continue? ',
uptime: 'running time',
notStartWarn: 'Supervisor is not started, please start it first',
serviceName: 'Service name',
initHelper:
'The initialization process will modify the configuration file, causing all existing processes to stop, please confirm the risk in advance',
serviceNameHelper: 'Currently only supports the Supervisor service managed by systemctl',
restartHelper:
'Initialization will restart the service, causing all the original daemon processes to close',
},
},
};

View File

@ -1586,12 +1586,14 @@ const message = {
dir: '運行目錄',
numprocs: '進程數量',
initWarn:
'由於無法兼容原有配置初始化 Supervisor 會修改配置文件的 files 參數導致已有的進程全部停止請提前確認風險修改後的進程配置文件夾在 <1Panel安裝目錄>/1panel/tools/supervisord/supervisor.d ',
'初始化操作需要修改配置文件的 [include] files 參數修改後的服務配置文件所在目錄: 1panel安裝目錄/1panel/tools/supervisord/supervisor.d/',
operatorHelper: '將對 {0} 進行 {1} 操作是否繼續 ',
uptime: '運行時長',
notStartWarn: 'Supervisor 未啟動請先啟動',
serviceName: '服務名稱',
initHelper: '尚未初始化 Supervisor 請先初始化',
serviceNameHelper: '當前僅支持 systemctl 管理的 Supervisor 服務',
restartHelper: '初始化會重啟服務導致原有的守護進程全部關閉',
},
},
};

View File

@ -1588,12 +1588,14 @@ const message = {
dir: '运行目录',
numprocs: '进程数量',
initWarn:
'由于无法兼容原有配置初始化 Supervisor 会修改配置文件的 files 参数导致已有的进程全部停止请提前确认风险修改后的进程配置文件夹在 <1Panel安装目录>/1panel/tools/supervisord/supervisor.d ',
'初始化操作需要修改配置文件的 [include] files 参数修改后的服务配置文件所在目录: 1panel安装目录/1panel/tools/supervisord/supervisor.d/',
operatorHelper: '将对 {0} 进行 {1} 操作是否继续',
uptime: '运行时长',
notStartWarn: '当前未开启 Supervisor 请先启动',
serviceName: '服务名称',
initHelper: '尚未初始化 Supervisor 请先初始化',
serviceNameHelper: '当前仅支持 systemctl 管理的 Supervisor 服务',
restartHelper: '初始化会重启服务导致原有的守护进程全部关闭',
},
},
};

View File

@ -34,6 +34,7 @@
:title="$t('tool.supervisor.list')"
:divider="true"
v-if="!data.isExist || !data.ctlExist || data.init"
v-loading="loading"
>
<template #main>
<div class="app-warn">
@ -79,6 +80,7 @@ const data = ref({
ctlExist: false,
serviceName: '',
});
const loading = ref(false);
const em = defineEmits(['setting', 'getStatus', 'update:loading', 'update:maskShow']);
@ -126,6 +128,7 @@ const onOperate = async (operation: string) => {
const getStatus = async () => {
try {
loading.value = true;
em('update:loading', true);
const res = await GetSupervisorStatus();
data.value = res.data.config as HostTool.Supersivor;
@ -138,6 +141,7 @@ const getStatus = async () => {
em('getStatus', status);
} catch (error) {}
em('update:loading', false);
loading.value = false;
};
onMounted(() => {

View File

@ -11,6 +11,7 @@
</el-form-item>
<el-form-item :label="$t('tool.supervisor.serviceName')" prop="serviceName">
<el-input v-model.trim="initModel.serviceName"></el-input>
<span class="input-help">{{ $t('tool.supervisor.serviceNameHelper') }}</span>
</el-form-item>
<el-alert
:title="$t('tool.supervisor.initWarn')"
@ -18,6 +19,13 @@
:closable="false"
type="error"
/>
<el-alert
:title="$t('tool.supervisor.restartHelper')"
class="common-prompt"
:closable="false"
type="error"
effect="dark"
/>
</el-form>
</el-col>
</el-row>
@ -26,11 +34,12 @@
<el-button @click="handleClose()" :disabled="loading">
{{ $t('commons.button.cancel') }}
</el-button>
<el-button type="primary" @click="submit(initForm)" :disabled="loading">
<el-button type="primary" @click="openSubmit(initForm)" :disabled="loading">
{{ $t('commons.button.confirm') }}
</el-button>
</span>
</template>
<ConfirmDialog ref="confirmDialogRef" @confirm="submit(initForm)"></ConfirmDialog>
</el-drawer>
</template>
@ -53,7 +62,7 @@ const initModel = ref({
primaryConfig: '',
serviceName: '',
});
const confirmDialogRef = ref();
const em = defineEmits(['close']);
const acceptParams = (primaryConfig: string, serviceName: string) => {
@ -67,6 +76,19 @@ const handleClose = () => {
em('close', false);
};
const openSubmit = async (formEl: FormInstance | undefined) => {
if (!formEl) return;
formEl.validate(async (valid) => {
if (!valid) return;
let params = {
header: i18n.global.t('commons.button.init'),
operationInfo: i18n.global.t('tool.supervisor.restartHelper'),
submitInputInfo: i18n.global.t('database.restartNow'),
};
confirmDialogRef.value!.acceptParams(params);
});
};
const submit = async (formEl: FormInstance | undefined) => {
if (!formEl) return;
await formEl.validate((valid) => {