Browse Source

dag connection add check

break60 4 years ago
parent
commit
ba43c8c3f7

+ 1 - 6
dolphinscheduler-ui/build/webpack.config.prod.js

@@ -51,12 +51,7 @@ const config = merge.smart(baseConfig, {
     minimizer: [
       new TerserPlugin({
         terserOptions: {
-          compress: {
-            warnings: false,
-            drop_console: true,
-            drop_debugger: true,
-            pure_funcs: ['console.log']
-          }
+          compress: {}
         },
         cache: true,
         parallel: true,

+ 11 - 2
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js

@@ -36,7 +36,7 @@ import {
 } from './util'
 import mStart from '@/conf/home/pages/projects/pages/definition/pages/list/_source/start'
 
-const JSP = function () {
+let JSP = function () {
   this.dag = {}
   this.selectedElement = {}
 
@@ -687,8 +687,17 @@ JSP.prototype.saveStore = function () {
 
 JSP.prototype.handleEvent = function () {
   this.JspInstance.bind('beforeDrop', function (info) {
+    console.log(info)
     let sourceId = info['sourceId']// 出
     let targetId = info['targetId']// 入
+    console.log(sourceId,targetId)
+    /**
+    * When connecting, connection is prohibited when the sourceId and target nodes are empty
+    */
+    if(!sourceId && !targetId) {
+      Vue.$message.warning(`${i18n.$t('This canvas is abnormal and the node connection cannot be made. Please save or exit the current workflow')}`)
+      return false
+    }
     /**
      * Recursive search for nodes
      */
@@ -730,7 +739,7 @@ JSP.prototype.handleEvent = function () {
   })
 }
 /**
- * Backfill data processing
+ * Backfill data processingJSP
  */
 JSP.prototype.jspBackfill = function ({ connects, locations, largeJson }) {
   // Backfill nodes

+ 1 - 0
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js

@@ -34,6 +34,7 @@ const saveTargetarr = (valId, domId) => {
   let $target = $(`#${domId}`)
   let targetStr = $target.attr('data-targetarr') ? $target.attr('data-targetarr') + `,${valId}` : `${valId}`;
   $target.attr('data-targetarr', targetStr)
+  console.log(targetStr)
 }
 
 const rtBantpl = () => {

+ 2 - 1
dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js

@@ -600,5 +600,6 @@ export default {
   'Directory detail': 'Directory detail',
   'Connection name': 'Connection name',
   'Current connection settings': 'Current connection settings',
-  'Please save the DAG before formatting': 'Please save the DAG before formatting'
+  'Please save the DAG before formatting': 'Please save the DAG before formatting',
+  'This canvas is abnormal and the node connection cannot be made. Please save or exit the current workflow': 'This canvas is abnormal and the node connection cannot be made. Please save or exit the current workflow'
 }

+ 2 - 1
dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js

@@ -606,5 +606,6 @@ export default {
   'Directory detail': '查看目录详情',
   'Connection name': '连线名',
   'Current connection settings': '当前连线设置',
-  'Please save the DAG before formatting': '格式化前请先保存DAG'
+  'Please save the DAG before formatting': '格式化前请先保存DAG',
+  'This canvas is abnormal and the node connection cannot be made. Please save or exit the current workflow': '此画布异常,无法进行节点连线,请保存或退出当前工作流'
 }