From 767bca8dd7df4bcf7c8839d08156f6a258fd5517 Mon Sep 17 00:00:00 2001 From: gaoyan Date: Fri, 17 Nov 2023 16:45:56 +0800 Subject: [PATCH] Fixed the issue that jobs could still be edited after they went online (#2540) * Optimize the process * fix editor bug * fix bug * fix bug --- .../java/org/dinky/service/impl/TaskServiceImpl.java | 4 ++-- .../src/components/CustomEditor/CodeEdit/index.tsx | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java b/dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java index c62f9069db..4aa78a9210 100644 --- a/dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java +++ b/dinky-admin/src/main/java/org/dinky/service/impl/TaskServiceImpl.java @@ -444,8 +444,8 @@ public boolean changeTaskLifeRecyle(Integer taskId, JobLifeCycle lifeCycle) thro @Override public boolean saveOrUpdateTask(Task task) { - - if (JobLifeCycle.PUBLISH.equalsValue(task.getStep())) { + Task byId = getById(task.getId()); + if (byId != null && JobLifeCycle.PUBLISH.equalsValue(byId.getStep())) { throw new BusException(Status.TASK_IS_ONLINE.getMessage()); } diff --git a/dinky-web/src/components/CustomEditor/CodeEdit/index.tsx b/dinky-web/src/components/CustomEditor/CodeEdit/index.tsx index 5b7855c033..bc625617d0 100644 --- a/dinky-web/src/components/CustomEditor/CodeEdit/index.tsx +++ b/dinky-web/src/components/CustomEditor/CodeEdit/index.tsx @@ -73,9 +73,7 @@ const CodeEdit = (props: CodeEditFormProps & connect) => { height = '100%', // if null or undefined, set default value width = '100%', // if null or undefined, set default value language, // edit language - options = { - ...MonacoEditorOptions // set default options - }, + options, onChange, // edit change callback code, // content readOnly = false, // is readOnly @@ -215,7 +213,7 @@ const CodeEdit = (props: CodeEditFormProps & connect) => { }; const finalEditorOptions = { - ...options, + ...MonacoEditorOptions, // set default options tabCompletion: 'on', // tab 补全 cursorSmoothCaretAnimation: true, // 光标动画 screenReaderAnnounceInlineSuggestion: true, // 屏幕阅读器提示 @@ -293,9 +291,9 @@ const CodeEdit = (props: CodeEditFormProps & connect) => { }, wordWrap: autoWrap, autoDetectHighContrast: true, - lineNumbers + lineNumbers, + ...options, }; - return ( <>