You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by lg...@apache.org on 2019/12/25 10:51:27 UTC

[incubator-dolphinscheduler] branch 1.2.0-release updated: Remove 1.2.0 useless code (#1573)

This is an automated email from the ASF dual-hosted git repository.

lgcareer pushed a commit to branch 1.2.0-release
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git


The following commit(s) were added to refs/heads/1.2.0-release by this push:
     new 9338f22  Remove 1.2.0 useless code (#1573)
9338f22 is described below

commit 9338f2261d1f38d5b2f815431f5ea58a2bcc9733
Author: break60 <79...@qq.com>
AuthorDate: Wed Dec 25 18:51:20 2019 +0800

    Remove 1.2.0 useless code (#1573)
    
    * Front-end compliance modification
    
    * Front-end supplemental license
    
    * Modify naming
    
    * Repair license
    
    * replace cookie.js with js-cookie, add js-cookie license
    
    * License Corrected Version
    
    * Remove 1.2.0 useless code
---
 .../src/js/conf/home/pages/dag/_source/dag.js      | 238 ++-------------------
 .../src/js/conf/home/pages/dag/_source/dag.vue     |  43 +---
 .../_source/formModel/tasks/_source/sqlType.vue    |   1 -
 .../pages/dag/_source/formModel/tasks/spark.vue    |  26 +--
 .../pages/list/_source/createDataSource.vue        |   4 -
 .../src/js/conf/home/store/dag/state.js            |   5 -
 .../src/js/module/i18n/locale/en_US.js             |   3 +-
 .../src/js/module/i18n/locale/zh_CN.js             |   3 +-
 8 files changed, 22 insertions(+), 301 deletions(-)

diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.js
index 11f2213..0a86186 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.js
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.js
@@ -91,232 +91,22 @@ Dag.prototype.toolbarEvent = function ({ item, code, is }) {
 /**
  * Echo data display
  */
-Dag.prototype.backfill = function (arg) {
-  if(arg) {
-    let locationsValue = store.state.dag.locations
-    let locationsValue1 = store.state.dag.locations
-    let locationsValue2 = store.state.dag.locations
-    let arr = []
-    for (let i in locationsValue1) {
-      let objs = new Object();
-      objs.id = i
-      arr.push(Object.assign(objs,locationsValue1[i])); //Attributes
-    }
-    let tmp = []
-    for(let i in locationsValue2) {
-      if(locationsValue2[i].targetarr !='' && locationsValue2[i].targetarr.split(',').length>1) {
-        tmp.push(locationsValue2[i])
-      }
-    }
-    
-    function copy (array) {
-      let newArray = []
-      for(let item of array) {
-        newArray.push(item);
-      }
-      return  newArray;
-    }
-
-    
-    let newArr = copy(arr)
-    function getNewArr() {
-      for(let i= 0; i<newArr.length; i++) {
-        if(newArr[i].targetarr !='' && newArr[i].targetarr.split(',').length>1) {
-          newArr[i].targetarr = newArr[i].targetarr.split(',').shift()
-        }
-      }
-      return newArr
-    }
-    getNewArr()
-    /**
-    * @description Transform flat data into a tree structure
-    * @param {Array} arr Flat data
-    * @param {String} pidStr targetarr key name
-    * @param {String} idStr id key name
-    * @param {String} childrenStr children key name
-    */
-    function fommat({arrayList, pidStr = 'targetarr', idStr = 'id', childrenStr = 'children'}) {
-        let listOjb = {}; // Used to store objects of the form {key: obj}
-        let treeList = []; // An array to store the final tree structure data
-        // Transform the data into {key: obj} format, which is convenient for the following data processing
-        for (let i = 0; i < arrayList.length; i++) {
-            listOjb[arrayList[i][idStr]] = arrayList[i]
-        }
-        // Format data based on pid
-        for (let j = 0; j < arrayList.length; j++) {
-            // Determine if the parent exists
-            // let haveParent = arrayList[j].targetarr.split(',').length>1?listOjb[arrayList[j].targetarr.split(',')[0]]:listOjb[arrayList[j][pidStr]]
-            let haveParent = listOjb[arrayList[j][pidStr]]
-            if (haveParent) {
-                // If there is no parent children field, create a children field
-                !haveParent[childrenStr] && (haveParent[childrenStr] = [])
-                // Insert child in parent
-                haveParent[childrenStr].push(arrayList[j])
-            } else {
-                // If there is no parent, insert directly into the outermost layer
-                treeList.push(arrayList[j])
-            }
-        }
-        return treeList
-      }
-      let datas = fommat({arrayList: newArr,pidStr: 'targetarr'})
-    // Count the number of leaf nodes
-      function getLeafCountTree(json) {
-        if(!json.children) {
-          json.colspan = 1;
-          return 1;
-        } else {
-          let leafCount = 0;
-          for(let i = 0 ; i < json.children.length ; i++){
-            leafCount = leafCount + getLeafCountTree(json.children[i]);
-          }
-          json.colspan = leafCount;
-          return leafCount;
-        }
-      }
-      // Number of tree node levels
-      let countTree = getLeafCountTree(datas[0])
-      function getMaxFloor(treeData) {
-        let floor = 0
-        let v = this
-        let max = 0
-        function each (data, floor) {
-          data.forEach(e => {
-            e.floor = floor
-            e.x=floor*170
-            if (floor > max) {
-              max = floor
-            }
-            if (e.children) {
-              each(e.children, floor + 1)
-            }
-          })
-        }
-          each(treeData,1)
-          return max
-        }
-        getMaxFloor(datas)
-        // The last child of each node
-        let lastchildren = [];
-        forxh(datas);
-        function forxh(list) {
-          for (let i = 0; i < list.length; i++) {
-            let chlist = list[i];
-            if (chlist.children) {
-              forxh(chlist.children);
-            } else {
-              lastchildren.push(chlist);
-            }
-          }
-        }
-        // Get all parent nodes above the leaf node
-        function treeFindPath (tree, func, path,n) {
-          if (!tree) return []
-          for (const data of tree) {
-            path.push(data.name)
-            if (func(data)) return path
-            if (data.children) {
-            const findChildren = treeFindPath(data.children, func, path,n)
-            if (findChildren.length) return findChildren
-            }
-            path.pop()
-          }
-          return []
-        }
-        function toLine(data){
-          return data.reduce((arr, {id, name, targetarr, x, y, children = []}) =>
-          arr.concat([{id, name, targetarr, x, y}], toLine(children)), [])
-          return result;
-        }
-        let listarr = toLine(datas);
-        let listarrs = toLine(datas)
-        let dataObject = {}
-        for(let i = 0; i<listarrs.length; i++) {
-          delete(listarrs[i].id)
-        }
-        
-        for(let a = 0; a<listarr.length; a++) {
-          dataObject[listarr[a].id] = listarrs[a]
-        }
-        // Comparison function
-        function createComparisonFunction(propertyName) {
-          return function (object1,object2) {
-            let value1 = object1[propertyName];
-            let value2 = object2[propertyName];
-
-            if (value1 < value2) {
-              return -1;
-            } else if (value1 > value2) {
-              return 1;
-            } else {
-              return 0;
-            }
-          };
-        }
-        
-        lastchildren = lastchildren.sort(createComparisonFunction('x'))
-        
-        // Coordinate value of each leaf node
-        for(let a = 0; a<lastchildren.length; a++) {
-          dataObject[lastchildren[a].id].y = (a+1)*120
-        }
-        for(let i =0 ; i<lastchildren.length; i++) {
-          let node = treeFindPath(datas, data=> data.targetarr===lastchildren[i].targetarr,[],i+1)
-          for(let j = 0; j<node.length; j++) {
-            for(let k= 0; k<listarrs.length; k++) {
-              if(node[j] == listarrs[k].name) {
-                listarrs[k].y = (i+1)*120
-              }
-            }
-          }
-        }
-        for(let i = 0; i<tmp.length; i++) {
-          for(let objs in dataObject) {
-           if(tmp[i].name == dataObject[objs].name) {
-            dataObject[objs].targetarr = tmp[i].targetarr
-           }
-          }
-        }
-        for(let a = 0; a<lastchildren.length; a++) {
-          dataObject[lastchildren[a].id].y = (a+1)*120
-        }
-        if(countTree>1) {
-          dataObject[Object.keys(locationsValue1)[0]].y = (countTree/2)*120+50
-        }
-    
-    locationsValue = dataObject
-    jsPlumb.ready(() => {
-      JSP.init({
-        dag: this.dag,
-        instance: this.instance
-      })
-      // Backfill
-      JSP.jspBackfill({
-        // connects
-        connects: _.cloneDeep(store.state.dag.connects),
-        // Node location information
-        locations: _.cloneDeep(locationsValue),
-        // Node data
-        largeJson: _.cloneDeep(store.state.dag.tasks)
-      })
+Dag.prototype.backfill = function () {
+  jsPlumb.ready(() => {
+    JSP.init({
+      dag: this.dag,
+      instance: this.instance
     })
-  } else {
-    jsPlumb.ready(() => {
-      JSP.init({
-        dag: this.dag,
-        instance: this.instance
-      })
-      // Backfill
-      JSP.jspBackfill({
-        // connects
-        connects: _.cloneDeep(store.state.dag.connects),
-        // Node location information
-        locations: _.cloneDeep(store.state.dag.locations),
-        // Node data
-        largeJson: _.cloneDeep(store.state.dag.tasks)
-      })
+    // Backfill
+    JSP.jspBackfill({
+      // connects
+      connects: _.cloneDeep(store.state.dag.connects),
+      // Node location information
+      locations: _.cloneDeep(store.state.dag.locations),
+      // Node data
+      largeJson: _.cloneDeep(store.state.dag.tasks)
     })
-  }
+  })
 }
 
 /**
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue
index 545fd4a..8e4c80b 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue
@@ -144,8 +144,7 @@
         isRtTasks: false,
         isRefresh: false,
         isLoading: false,
-        taskId: null,
-        arg: false,
+        taskId: null
       }
     },
     mixins: [disabledState],
@@ -157,43 +156,9 @@
       ...mapActions('dag', ['saveDAGchart', 'updateInstance', 'updateDefinition', 'getTaskState']),
       ...mapMutations('dag', ['addTasks', 'resetParams', 'setIsEditDag', 'setName']),
       
-      // DAG automatic layout
-      dagAutomaticLayout() {
-        $('#canvas').html('')
-
-      // Destroy round robin
-        Dag.init({
-        dag: this,
-        instance: jsPlumb.getInstance({
-          Endpoint: [
-            'Dot', { radius: 1, cssClass: 'dot-style' }
-          ],
-          Connector: 'Straight',
-          PaintStyle: { lineWidth: 2, stroke: '#456' }, // Connection style
-          ConnectionOverlays: [
-            [
-              'Arrow',
-              {
-                location: 1,
-                id: 'arrow',
-                length: 12,
-                foldback: 0.8
-              }
-            ]
-          ],
-          Container: 'canvas'
-        })
-      })
-        if (this.tasks.length) {
-          Dag.backfill(true)
-        } else {
-          Dag.create()
-        }
-      },
-
-      init (args) {
+      init () {
         if (this.tasks.length) {
-          Dag.backfill(args)
+          Dag.backfill()
           // Process instances can view status
           if (this.type === 'instance') {
             this._getTaskState(false).then(res => {})
@@ -551,7 +516,7 @@
       })
     },
     mounted () {
-      this.init(this.arg)
+      this.init()
     },
     beforeDestroy () {
       this.resetParams()
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/sqlType.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/sqlType.vue
index 6cad8f1..49fb4a2 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/sqlType.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/sqlType.vue
@@ -60,7 +60,6 @@
     },
     created () {
       this.$nextTick(() => {
-        console.log(this.sqlType)
         if (this.sqlType != 0) {
           this.sqlTypeId = this.sqlType
         } else {
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue
index 2457a23..939dccb 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue
@@ -32,22 +32,6 @@
         </x-select>
       </div>
     </m-list-box>
-    <m-list-box>
-      <div slot="text">{{$t('Spark Version')}}</div>
-      <div slot="content">
-        <x-select
-                style="width: 130px;"
-                v-model="sparkVersion"
-                :disabled="isDetails">
-          <x-option
-                  v-for="city in sparkVersionList"
-                  :key="city.code"
-                  :value="city.code"
-                  :label="city.code">
-          </x-option>
-        </x-select>
-      </div>
-    </m-list-box>
     <m-list-box v-if="programType !== 'PYTHON'">
       <div slot="text">{{$t('Main class')}}</div>
       <div slot="content">
@@ -240,11 +224,7 @@
         // Program type
         programType: 'SCALA',
         // Program type(List)
-        programTypeList: [{ code: 'JAVA' }, { code: 'SCALA' }, { code: 'PYTHON' }],
-        // Spark version
-        sparkVersion: 'SPARK2',
-        // Spark version(LIst)
-        sparkVersionList: [{ code: 'SPARK2' }, { code: 'SPARK1' }]
+        programTypeList: [{ code: 'JAVA' }, { code: 'SCALA' }, { code: 'PYTHON' }]
       }
     },
     props: {
@@ -338,8 +318,7 @@
           executorCores: this.executorCores,
           mainArgs: this.mainArgs,
           others: this.others,
-          programType: this.programType,
-          sparkVersion: this.sparkVersion
+          programType: this.programType
         })
         return true
       },
@@ -387,7 +366,6 @@
           this.mainArgs = o.params.mainArgs || ''
           this.others = o.params.others
           this.programType = o.params.programType || 'SCALA'
-          this.sparkVersion = o.params.sparkVersion || 'SPARK2'
 
           // backfill resourceList
           let resourceList = o.params.resourceList || []
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/datasource/pages/list/_source/createDataSource.vue b/dolphinscheduler-ui/src/js/conf/home/pages/datasource/pages/list/_source/createDataSource.vue
index d308cee..6f3727c 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/datasource/pages/list/_source/createDataSource.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/datasource/pages/list/_source/createDataSource.vue
@@ -32,7 +32,6 @@
               <x-radio :label="'CLICKHOUSE'">CLICKHOUSE</x-radio>
               <x-radio :label="'ORACLE'">ORACLE</x-radio>
               <x-radio :label="'SQLSERVER'">SQLSERVER</x-radio>
-              <x-radio :label="'DB2'" class="radio-label-last" >DB2</x-radio>
             </x-radio-group>
           </template>
         </m-list-box-f>
@@ -384,9 +383,6 @@
           case 'SQLSERVER':
             defaultPort = '1433'
             break
-          case 'DB2':
-            defaultPort = '50000'
-            break
           default:
             break
 
diff --git a/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js b/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js
index 9eb4d74..1228399 100644
--- a/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js
+++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/state.js
@@ -87,11 +87,6 @@ export default {
       id: 6,
       code: 'SQLSERVER',
       disabled: false
-    },
-    {
-      id: 7,
-      code: 'DB2',
-      disabled: false
     }
   ],
   // Alarm interface
diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
index 64c6376..ae9448e 100644
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
+++ b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
@@ -506,6 +506,5 @@ export default {
   'There is no data for this period of time': 'There is no data for this period of time',
   'IP address cannot be empty': 'IP address cannot be empty',
   'Please enter the correct IP': 'Please enter the correct IP',
-  'Please generate token': 'Please generate token',
-  'Spark Version': 'Spark Version'
+  'Please generate token': 'Please generate token'
 }
diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
index 8c7fac6..0acf0e7 100644
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
+++ b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
@@ -506,6 +506,5 @@ export default {
   'There is no data for this period of time': '该时间段无数据',
   'IP address cannot be empty': 'IP地址不能为空',
   'Please enter the correct IP': '请输入正确的IP',
-  'Please generate token': '请生成Token',
-  'Spark Version': 'Spark版本'
+  'Please generate token': '请生成Token'
 }