diff --git a/frontend/desktop/src/config/i18n/cn.js b/frontend/desktop/src/config/i18n/cn.js index d462ed049d..5618782f1d 100644 --- a/frontend/desktop/src/config/i18n/cn.js +++ b/frontend/desktop/src/config/i18n/cn.js @@ -1793,7 +1793,8 @@ const cn = { 'exFailedText': '节点执行失败,请前往{0}查看错误原因', 'exFailedText_调用日志': '调用日志', '任务还未执行,暂无执行历史': '任务还未执行,暂无执行历史', - '空分支': '空分支' + '空分支': '空分支', + '代理人仅可设置为本人': '代理人仅可设置为本人' } export default cn diff --git a/frontend/desktop/src/config/i18n/en.js b/frontend/desktop/src/config/i18n/en.js index ecee08b4c1..45b4fc8030 100644 --- a/frontend/desktop/src/config/i18n/en.js +++ b/frontend/desktop/src/config/i18n/en.js @@ -1827,7 +1827,8 @@ const en = { 'exFailedText': 'Node execution failed. Please go to the {0} to check the error reason.', 'exFailedText_调用日志': 'call log', '任务还未执行,暂无执行历史': 'Task not executed, no history available.', - '空分支': 'Empty branch' + '空分支': 'Empty branch', + '代理人仅可设置为本人': 'The executor proxy can only set yourself' } export default en diff --git a/frontend/desktop/src/pages/project/config.vue b/frontend/desktop/src/pages/project/config.vue index 94f2373149..cc2217fc04 100644 --- a/frontend/desktop/src/pages/project/config.vue +++ b/frontend/desktop/src/pages/project/config.vue @@ -198,15 +198,17 @@ data-test-id="projectConfig_form_executeAgentDialog" :cancel-text="$t('取消')" @confirm="updateAgentData" - @cancel="isAgentDialogShow = false"> + @cancel="closeAgentDialog"> + :multiple="false" + @change="onSelectedExecutorProxy"> +

{{ $t('代理人仅可设置为本人') }}

+

{{ $t('代理人仅可设置为本人') }}

@@ -450,6 +451,7 @@ :multiple="false" @change="onUserSelectChange"> +

{{ $t('代理人仅可设置为本人') }}

@@ -562,6 +564,7 @@ } ] }, + isProxyValidateError: false, errorHandleTipsConfig: { allowHtml: true, theme: 'light', @@ -581,6 +584,7 @@ }, computed: { ...mapState({ + 'username': state => state.username, 'subprocessInfo': state => state.template.subprocess_info }), subflowHasUpdate () { @@ -819,6 +823,7 @@ onUserSelectChange (tags) { this.formData.executor_proxy = tags this.updateData() + this.isProxyValidateError = tags.length === 1 && tags[0] !== this.username }, async onAlwaysUseLatestChange (val) { this.formData.alwaysUseLatest = val @@ -1117,6 +1122,7 @@ } } .user-selector { + display: block; width: 100%; .disabled::before { content: ''; diff --git a/frontend/desktop/src/pages/template/TemplateEdit/NodeConfig/NodeConfig.vue b/frontend/desktop/src/pages/template/TemplateEdit/NodeConfig/NodeConfig.vue index 7c7f8de187..9bbedd0316 100644 --- a/frontend/desktop/src/pages/template/TemplateEdit/NodeConfig/NodeConfig.vue +++ b/frontend/desktop/src/pages/template/TemplateEdit/NodeConfig/NodeConfig.vue @@ -1368,6 +1368,9 @@ // 节点配置面板表单校验,基础信息和输入参数 validate () { return this.$refs.basicInfo.validate().then(validator => { + if (this.$refs.basicInfo.isProxyValidateError) { + return false + } if (this.$refs.inputParams) { return this.$refs.inputParams.validate() } else if (this.$refs.jsonSchemaParams) { diff --git a/frontend/desktop/src/pages/template/TemplateEdit/TemplateSetting/TabTemplateConfig.vue b/frontend/desktop/src/pages/template/TemplateEdit/TemplateSetting/TabTemplateConfig.vue index f8eadc168e..f50befdb2f 100644 --- a/frontend/desktop/src/pages/template/TemplateEdit/TemplateSetting/TabTemplateConfig.vue +++ b/frontend/desktop/src/pages/template/TemplateEdit/TemplateSetting/TabTemplateConfig.vue @@ -141,8 +141,9 @@ :disabled="isViewMode" :placeholder="proxyPlaceholder" :value="formData.executorProxy" - @change="formData.executorProxy = $event"> + @change="onSelectedExecutorProxy"> +

{{ $t('代理人仅可设置为本人') }}

{{ $t('推荐留空使用') }} { - if (!result) { + if (!result || this.isProxyValidateError) { return } diff --git a/frontend/desktop/src/store/modules/template.js b/frontend/desktop/src/store/modules/template.js index 0399ce2eb3..b807bc808d 100644 --- a/frontend/desktop/src/store/modules/template.js +++ b/frontend/desktop/src/store/modules/template.js @@ -193,6 +193,7 @@ const template = { category: '', description: '', executor_proxy: '', + init_executor_proxy: '', template_labels: '', subprocess_info: { details: [], @@ -316,6 +317,7 @@ const template = { state.notify_type = typeof notify_type === 'string' ? { success: JSON.parse(notify_type), fail: [] } : notify_type state.description = description state.executor_proxy = executor_proxy + state.init_executor_proxy = executor_proxy state.template_labels = template_labels || [] state.time_out = time_out state.category = category @@ -353,6 +355,7 @@ const template = { } state.description = '' state.executor_proxy = '' + state.init_executor_proxy = '' state.template_labels = [] state.default_flow_type = 'common' }, @@ -377,6 +380,7 @@ const template = { } state.description = '' state.executor_proxy = '' + state.init_executor_proxy = '' state.template_labels = [] state.default_flow_type = 'common' }, @@ -926,7 +930,8 @@ const template = { saveTemplateData ({ state }, { templateId, projectId, common }) { const { activities, constants, end_event, flows, gateways, line, location, outputs, start_event, notify_receivers, notify_type, - time_out, category, description, executor_proxy, template_labels, default_flow_type + time_out, category, description, executor_proxy, template_labels, default_flow_type, + init_executor_proxy } = state // 剔除 location 的冗余字段 const pureLocation = location.map(item => ({ @@ -986,9 +991,7 @@ const template = { url = `${url}${templateId}/` headers['X-HTTP-Method-Override'] = 'PATCH' } - - // 新增用post, 编辑用put - return axios[templateId === undefined ? 'post' : 'put'](url, { + const params = { name, project, category, @@ -1000,9 +1003,20 @@ const template = { notify_type, pipeline_tree: pipelineTree, notify_receivers: notifyReceivers - }, { + } + // 更新时如果执行代理人没有修改则不传 + if (templateId && init_executor_proxy === executor_proxy) { + delete params.executor_proxy + } + + // 新增用post, 编辑用patch + const method = templateId === undefined ? 'post' : common ? 'put' : 'patch' + return axios[method](url, params, { headers - }).then(response => response.data) + }).then(response => { + state.init_executor_proxy = state.executor_proxy + return response.data + }) }, // 自动排版 getLayoutedPipeline ({ commit }, data) {