diff --git a/backend/app/service/host_tool.go b/backend/app/service/host_tool.go index 9699623dd..40f164a9c 100644 --- a/backend/app/service/host_tool.go +++ b/backend/app/service/host_tool.go @@ -110,7 +110,7 @@ func (h *HostToolService) GetToolStatus(req request.HostToolReq) (*response.Host if !fileOp.Stat(configPath) { configPath = "/etc/supervisor/supervisord.conf" if !fileOp.Stat(configPath) { - return nil, errors.New("ErrConfigNotFound") + return nil, buserr.New("ErrConfigNotFound") } } } @@ -125,7 +125,7 @@ func (h *HostToolService) CreateToolConfig(req request.HostToolCreate) error { case constant.Supervisord: fileOp := files.NewFileOp() if !fileOp.Stat(req.ConfigPath) { - return errors.New("ErrConfigNotFound") + return buserr.New("ErrConfigNotFound") } cfg, err := ini.Load(req.ConfigPath) if err != nil { @@ -281,7 +281,7 @@ func (h *HostToolService) OperateSupervisorProcess(req request.SupervisorProcess iniPath = path.Join(includeDir, fmt.Sprintf("%s.ini", req.Name)) fileOp = files.NewFileOp() ) - if req.Operate == "edit" || req.Operate == "create" { + if req.Operate == "update" || req.Operate == "create" { if !fileOp.Stat(req.Dir) { return buserr.New("ErrConfigDirNotFound") } @@ -318,7 +318,7 @@ func (h *HostToolService) OperateSupervisorProcess(req request.SupervisorProcess return err } return operateSupervisorCtl("reload", "", "") - case "edit": + case "update": configFile, err := ini.Load(iniPath) if err != nil { return err diff --git a/frontend/src/views/host/tool/supervisor/create/index.vue b/frontend/src/views/host/tool/supervisor/create/index.vue index 1ab888e10..e6e3f1f42 100644 --- a/frontend/src/views/host/tool/supervisor/create/index.vue +++ b/frontend/src/views/host/tool/supervisor/create/index.vue @@ -21,7 +21,7 @@ - + @@ -54,7 +54,7 @@ const open = ref(false); const loading = ref(false); const processForm = ref(); const rules = ref({ - name: [Rules.requiredInput], + name: [Rules.requiredInput, Rules.simpleName], dir: [Rules.requiredInput], command: [Rules.requiredInput], user: [Rules.requiredInput], @@ -64,7 +64,7 @@ const initData = () => ({ operate: 'create', name: '', command: '', - user: '', + user: 'root', dir: '', numprocsNum: 1, numprocs: '1', @@ -89,9 +89,9 @@ const resetForm = () => { const acceptParams = (operate: string, config: HostTool.SupersivorProcess) => { process.value = initData(); - if (operate == 'edit') { + if (operate == 'update') { process.value = { - operate: 'edit', + operate: 'update', name: config.name, command: config.command, user: config.user, diff --git a/frontend/src/views/host/tool/supervisor/file/index.vue b/frontend/src/views/host/tool/supervisor/file/index.vue index 5e31c389b..844ce23af 100644 --- a/frontend/src/views/host/tool/supervisor/file/index.vue +++ b/frontend/src/views/host/tool/supervisor/file/index.vue @@ -52,6 +52,7 @@ import { useDeleteData } from '@/hooks/use-delete-data'; import { OperateSupervisorProcessFile } from '@/api/modules/host-tool'; import i18n from '@/lang'; import { TabsPaneContext } from 'element-plus'; +import { MsgSuccess } from '@/utils/message'; const extensions = [javascript(), oneDark]; const loading = ref(false); @@ -113,6 +114,7 @@ const submit = () => { loading.value = true; OperateSupervisorProcessFile(updateReq) .then(() => { + MsgSuccess(i18n.global.t('commons.msg.updateSuccess')); getContent(); }) .finally(() => { diff --git a/frontend/src/views/host/tool/supervisor/index.vue b/frontend/src/views/host/tool/supervisor/index.vue index e8517e5bf..8fcf39b51 100644 --- a/frontend/src/views/host/tool/supervisor/index.vue +++ b/frontend/src/views/host/tool/supervisor/index.vue @@ -20,15 +20,19 @@