diff --git a/.github/workflows/ci_frontend.yml b/.github/workflows/ci_frontend.yml index 494d12dbae..b8e11252c8 100644 --- a/.github/workflows/ci_frontend.yml +++ b/.github/workflows/ci_frontend.yml @@ -50,6 +50,7 @@ jobs: cd dolphinscheduler-ui npm install node-sass --unsafe-perm npm install + npm run lint npm run build License-check: diff --git a/.github/workflows/ci_ut.yml b/.github/workflows/ci_ut.yml index 1c2952b440..6d0b2a2a1d 100644 --- a/.github/workflows/ci_ut.yml +++ b/.github/workflows/ci_ut.yml @@ -75,6 +75,7 @@ jobs: -Dsonar.core.codeCoveragePlugin=jacoco -Dsonar.projectKey=apache-dolphinscheduler -Dsonar.login=e4058004bc6be89decf558ac819aa1ecbee57682 + -Dsonar.exclusions=dolphinscheduler-ui/src/**/i18n/locale/*.js env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} @@ -83,4 +84,4 @@ jobs: mkdir -p ${LOG_DIR} cd ${DOCKER_DIR} docker-compose logs db > ${LOG_DIR}/db.txt - continue-on-error: true \ No newline at end of file + continue-on-error: true diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java index 4fdafa46fa..3ec6d20414 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionService.java @@ -782,6 +782,16 @@ public class ProcessDefinitionService extends BaseDAGService { processDefinitionName, 1); } + //unique check + Map checkResult = verifyProcessDefinitionName(loginUser, currentProjectName, processDefinitionName); + Status status = (Status) checkResult.get(Constants.STATUS); + if (Status.SUCCESS.equals(status)) { + putMsg(result, Status.SUCCESS); + } else { + result.putAll(checkResult); + return false; + } + // get create process result Map createProcessResult = getCreateProcessResult(loginUser, diff --git a/dolphinscheduler-server/src/main/resources/config/install_config.conf b/dolphinscheduler-server/src/main/resources/config/install_config.conf index cba117e048..fab6b32d51 100644 --- a/dolphinscheduler-server/src/main/resources/config/install_config.conf +++ b/dolphinscheduler-server/src/main/resources/config/install_config.conf @@ -27,6 +27,9 @@ dbhost="192.168.xx.xx:3306" # db username username="xx" +# database name +dbname="dolphinscheduler" + # db passwprd # NOTICE: if there are special characters, please use the \ to escape, for example, `[` escape to `\[` password="xx" diff --git a/dolphinscheduler-ui/.eslintrc b/dolphinscheduler-ui/.eslintrc deleted file mode 100644 index e1d1a03e1c..0000000000 --- a/dolphinscheduler-ui/.eslintrc +++ /dev/null @@ -1,6 +0,0 @@ -globals: - $: true - expect: true -rules: - "no-new": "off" - "no-labels": [2, {"allowLoop": true}] diff --git a/dolphinscheduler-ui/.eslintrc.yml b/dolphinscheduler-ui/.eslintrc.yml new file mode 100644 index 0000000000..8d4020f7c4 --- /dev/null +++ b/dolphinscheduler-ui/.eslintrc.yml @@ -0,0 +1,34 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +env: + browser: true + es6: true + jquery: true +extends: + - 'plugin:vue/essential' + - standard +globals: + Atomics: readonly + SharedArrayBuffer: readonly + PUBLIC_PATH: readonly +parserOptions: + ecmaVersion: 2018 + sourceType: module +plugins: + - vue +rules: {} diff --git a/dolphinscheduler-ui/package.json b/dolphinscheduler-ui/package.json index 5dc1cb44db..1f5170637e 100644 --- a/dolphinscheduler-ui/package.json +++ b/dolphinscheduler-ui/package.json @@ -8,6 +8,7 @@ "dev": "cross-env NODE_ENV=development webpack-dev-server --config ./build/webpack.config.dev.js", "clean": "rimraf dist", "start": "npm run dev", + "lint": "eslint ./src --fix", "build:release": "npm run clean && cross-env NODE_ENV=production PUBLIC_PATH=/dolphinscheduler/ui webpack --config ./build/webpack.config.release.js" }, "dependencies": { @@ -50,6 +51,13 @@ "css-loader": "^0.28.8", "cssnano": "4.1.10", "env-parse": "^1.0.5", + "eslint": "^6.8.0", + "eslint-config-standard": "^14.1.1", + "eslint-plugin-import": "^2.20.2", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-promise": "^4.2.1", + "eslint-plugin-standard": "^4.0.1", + "eslint-plugin-vue": "^6.2.2", "file-loader": "^5.0.2", "globby": "^8.0.1", "html-loader": "^0.5.5", diff --git a/dolphinscheduler-ui/src/js/conf/home/index.js b/dolphinscheduler-ui/src/js/conf/home/index.js index 1913088eca..3c518d8952 100644 --- a/dolphinscheduler-ui/src/js/conf/home/index.js +++ b/dolphinscheduler-ui/src/js/conf/home/index.js @@ -31,15 +31,15 @@ import Permissions from '@/module/permissions' import 'ans-ui/lib/ans-ui.min.css' import ans from 'ans-ui/lib/ans-ui.min' import en_US from 'ans-ui/lib/locale/en' // eslint-disable-line -import'normalize.css/normalize.css' +import 'normalize.css/normalize.css' import 'sass/conf/home/index.scss' -import'bootstrap/dist/css/bootstrap.min.css' +import 'bootstrap/dist/css/bootstrap.min.css' -import'bootstrap/dist/js/bootstrap.min.js' +import 'bootstrap/dist/js/bootstrap.min.js' import 'canvg/dist/browser/canvg.min.js' // Component internationalization -let useOpt = i18n.globalScope.LOCALE === 'en_US' ? { locale: en_US } : {} +const useOpt = i18n.globalScope.LOCALE === 'en_US' ? { locale: en_US } : {} // Vue.use(ans) Vue.use(ans, useOpt) @@ -74,7 +74,7 @@ Permissions.request().then(res => { methods: { initApp () { $('.global-loading').hide() - let bootstrapTooltip = $.fn.tooltip.noConflict() + const bootstrapTooltip = $.fn.tooltip.noConflict() $.fn.tooltip = bootstrapTooltip $('body').tooltip({ selector: '[data-toggle="tooltip"]', diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/config.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/config.js index db8acf3073..56d0168893 100755 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/config.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/config.js @@ -16,7 +16,6 @@ */ import i18n from '@/module/i18n' -import Permissions from '@/module/permissions' /** * Operation bar config @@ -26,7 +25,7 @@ import Permissions from '@/module/permissions' * @desc tooltip */ const toolOper = (dagThis) => { - let disabled =!!dagThis.$store.state.dag.isDetails// Permissions.getAuth() === false ? false : !dagThis.$store.state.dag.isDetails + const disabled = !!dagThis.$store.state.dag.isDetails// Permissions.getAuth() === false ? false : !dagThis.$store.state.dag.isDetails return [ { code: 'pointer', @@ -67,7 +66,7 @@ const toolOper = (dagThis) => { * @desc tooltip * @code Backend definition identifier */ -let publishStatus = [ +const publishStatus = [ { id: 0, desc: `${i18n.$t('Unpublished')}`, @@ -90,7 +89,7 @@ let publishStatus = [ * @desc tooltip * @code identifier */ -let runningType = [ +const runningType = [ { desc: `${i18n.$t('Start Process')}`, code: 'START_PROCESS' @@ -146,85 +145,85 @@ let runningType = [ * @icoUnicode iconfont * @isSpin is loading (Need to execute the code block to write if judgment) */ -let tasksState = { - 'SUBMITTED_SUCCESS': { +const tasksState = { + SUBMITTED_SUCCESS: { id: 0, desc: `${i18n.$t('Submitted successfully')}`, color: '#A9A9A9', icoUnicode: 'ans-icon-dot-circle', isSpin: false }, - 'RUNNING_EXEUTION': { + RUNNING_EXEUTION: { id: 1, desc: `${i18n.$t('Executing')}`, color: '#0097e0', icoUnicode: 'ans-icon-gear', isSpin: true }, - 'READY_PAUSE': { + READY_PAUSE: { id: 2, desc: `${i18n.$t('Ready to pause')}`, color: '#07b1a3', icoUnicode: 'ans-icon-pause-solid', isSpin: false }, - 'PAUSE': { + PAUSE: { id: 3, desc: `${i18n.$t('Pause')}`, color: '#057c72', icoUnicode: 'ans-icon-pause', isSpin: false }, - 'READY_STOP': { + READY_STOP: { id: 4, desc: `${i18n.$t('Ready to stop')}`, color: '#FE0402', icoUnicode: 'ans-icon-coin', isSpin: false }, - 'STOP': { + STOP: { id: 5, desc: `${i18n.$t('Stop')}`, color: '#e90101', icoUnicode: 'ans-icon-stop', isSpin: false }, - 'FAILURE': { + FAILURE: { id: 6, desc: `${i18n.$t('failed')}`, color: '#000000', icoUnicode: 'ans-icon-fail-empty', isSpin: false }, - 'SUCCESS': { + SUCCESS: { id: 7, desc: `${i18n.$t('success')}`, color: '#33cc00', icoUnicode: 'ans-icon-success-empty', isSpin: false }, - 'NEED_FAULT_TOLERANCE': { + NEED_FAULT_TOLERANCE: { id: 8, desc: `${i18n.$t('Need fault tolerance')}`, color: '#FF8C00', icoUnicode: 'ans-icon-pen', isSpin: false }, - 'KILL': { + KILL: { id: 9, desc: `${i18n.$t('kill')}`, color: '#a70202', icoUnicode: 'ans-icon-minus-circle-empty', isSpin: false }, - 'WAITTING_THREAD': { + WAITTING_THREAD: { id: 10, desc: `${i18n.$t('Waiting for thread')}`, color: '#912eed', icoUnicode: 'ans-icon-sand-clock', isSpin: false }, - 'WAITTING_DEPEND': { + WAITTING_DEPEND: { id: 11, desc: `${i18n.$t('Waiting for dependence')}`, color: '#5101be', @@ -239,62 +238,61 @@ let tasksState = { * @desc tooltip * @color color (tree and gantt) */ -let tasksType = { - 'SHELL': { +const tasksType = { + SHELL: { desc: 'SHELL', color: '#646464' }, - 'SUB_PROCESS': { + SUB_PROCESS: { desc: 'SUB_PROCESS', color: '#0097e0' }, - 'PROCEDURE': { + PROCEDURE: { desc: 'PROCEDURE', color: '#525CCD' }, - 'SQL': { + SQL: { desc: 'SQL', color: '#7A98A1' }, - 'SPARK': { + SPARK: { desc: 'SPARK', color: '#E46F13' }, - 'FLINK': { + FLINK: { desc: 'FLINK', color: '#E46F13' }, - 'MR': { + MR: { desc: 'MapReduce', color: '#A0A5CC' }, - 'PYTHON': { + PYTHON: { desc: 'PYTHON', color: '#FED52D' }, - 'DEPENDENT': { + DEPENDENT: { desc: 'DEPENDENT', color: '#2FBFD8' }, - 'HTTP': { + HTTP: { desc: 'HTTP', color: '#E46F13' }, - 'DATAX': { + DATAX: { desc: 'DataX', color: '#1fc747' }, - 'SQOOP': { + SQOOP: { desc: 'SQOOP', color: '#E46F13' }, - 'CONDITIONS': { + CONDITIONS: { desc: 'CONDITIONS', color: '#E46F13' } } - export { toolOper, publishStatus, 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 240f3246aa..3f47076ce3 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 @@ -24,7 +24,7 @@ import store from '@/conf/home/store' /** * Prototype method */ -let Dag = function () { +const Dag = function () { this.dag = {} this.instance = {} } @@ -49,7 +49,7 @@ Dag.prototype.setConfig = function (o) { * create dag */ Dag.prototype.create = function () { - let self = this + const self = this jsPlumb.ready(() => { JSP.init({ dag: this.dag, @@ -98,36 +98,35 @@ Dag.prototype.toolbarEvent = function ({ item, code, is }) { * Echo data display */ Dag.prototype.backfill = function (arg) { - if(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(); + const locationsValue1 = store.state.dag.locations + const locationsValue2 = store.state.dag.locations + const arr = [] + for (const i in locationsValue1) { + const objs = {} objs.id = i - arr.push(Object.assign(objs,locationsValue1[i])); //Attributes + 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) { + const tmp = [] + for (const 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); + const copy = function (array) { + const newArray = [] + for (const item of array) { + newArray.push(item) } - return newArray; + return newArray } - - let newArr = copy(arr) - function getNewArr() { - for(let i= 0; i1) { + const newArr = copy(arr) + const getNewArr = function () { + 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() } } @@ -141,154 +140,154 @@ Dag.prototype.backfill = function (arg) { * @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 + const fommat = function ({ arrayList, pidStr = 'targetarr', idStr = 'id', childrenStr = 'children' }) { + const listOjb = {} // Used to store objects of the form {key: obj} + const 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] } - let datas = fommat({arrayList: newArr,pidStr: 'targetarr'}) - // Count the number of leaf nodes - function getLeafCountTree(json) { - if(!json.children) { - json.colspan = 1; - return 1; + // 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]] + const 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 { - let leafCount = 0; - for(let i = 0 ; i < json.children.length ; i++){ - leafCount = leafCount + getLeafCountTree(json.children[i]); - } - json.colspan = leafCount; - return leafCount; + // If there is no parent, insert directly into the outermost layer + treeList.push(arrayList[j]) } } - // Number of tree node levels - let countTree = getLeafCountTree(datas[0]) - function getMaxFloor(treeData) { - 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 + return treeList + } + const datas = fommat({ arrayList: newArr, pidStr: 'targetarr' }) + // Count the number of leaf nodes + const getLeafCountTree = function (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]) } - 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); - } + json.colspan = leafCount + return leafCount + } + } + // Number of tree node levels + const countTree = getLeafCountTree(datas[0]) + const getMaxFloor = function (treeData) { + let max = 0 + function each (data, floor) { + data.forEach(e => { + e.floor = floor + e.x = floor * 170 + if (floor > max) { + max = floor } - } - // 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() + if (e.children) { + each(e.children, floor + 1) } - return [] - } - function toLine(data){ - return data.reduce((arrData, {id, name, targetarr, x, y, children = []}) => - arrData.concat([{id, name, targetarr, x, y}], toLine(children)), []) + }) + } + each(treeData, 1) + return max + } + getMaxFloor(datas) + // The last child of each node + let lastchildren = [] + const forxh = function (list) { + for (let i = 0; i < list.length; i++) { + const chlist = list[i] + if (chlist.children) { + forxh(chlist.children) + } else { + lastchildren.push(chlist) } - let listarr = toLine(datas); - let listarrs = toLine(datas) - let dataObject = {} - for(let i = 0; i + arrData.concat([{ id, name, targetarr, x, y }], toLine(children)), []) + } + const listarr = toLine(datas) + const listarrs = toLine(datas) + const dataObject = {} + for (let i = 0; i < listarrs.length; i++) { + delete (listarrs[i].id) + } - for(let a = 0; a value2) { - return 1; - } else { - return 0; - } - }; + if (value1 < value2) { + return -1 + } else if (value1 > value2) { + return 1 + } else { + return 0 } + } + } - lastchildren = lastchildren.sort(createComparisonFunction('x')) + lastchildren = lastchildren.sort(createComparisonFunction('x')) - // Coordinate value of each leaf node - for(let a = 0; a data.targetarr===lastchildren[i].targetarr,[],i+1) - for(let j = 0; j 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 a = 0; a1) { - dataObject[Object.keys(locationsValue1)[0]].y = (countTree/2)*120+50 + } + } + for (let i = 0; i < tmp.length; i++) { + for (const 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 - let self = this + const self = this jsPlumb.ready(() => { JSP.init({ dag: this.dag, @@ -310,7 +309,7 @@ Dag.prototype.backfill = function (arg) { }) }) } else { - let self = this + const self = this jsPlumb.ready(() => { JSP.init({ dag: this.dag, diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/commcon.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/commcon.js index cdf632f13d..37d471cccb 100755 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/commcon.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/commcon.js @@ -43,7 +43,7 @@ const cycleList = [ * cycle value */ const dateValueList = { - 'hour': [ + hour: [ { value: 'last1Hour', label: `${i18n.$t('Last1Hour')}` @@ -57,7 +57,7 @@ const dateValueList = { label: `${i18n.$t('Last3Hours')}` } ], - 'day': [ + day: [ { value: 'today', label: `${i18n.$t('today')}` @@ -79,7 +79,7 @@ const dateValueList = { label: `${i18n.$t('Last7Days')}` } ], - 'week': [ + week: [ { value: 'thisWeek', label: `${i18n.$t('ThisWeek')}` @@ -117,7 +117,7 @@ const dateValueList = { label: `${i18n.$t('LastSunday')}` } ], - 'month': [ + month: [ { value: 'thisMonth', label: `${i18n.$t('ThisMonth')}` @@ -221,15 +221,15 @@ const sqlTypeList = [ const positionList = [ { id: 'PARAMETER', - code: "Parameter" + code: 'Parameter' }, { id: 'BODY', - code: "Body" + code: 'Body' }, { id: 'HEADERS', - code: "Headers" + code: 'Headers' } ] const nodeStatusList = [ diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/jumpAffirm/index.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/jumpAffirm/index.js index 88a258c6fe..360a0fb356 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/jumpAffirm/index.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/jumpAffirm/index.js @@ -21,7 +21,7 @@ import store from '@/conf/home/store' import router from '@/conf/home/router' import { uuid, findComponentDownward } from '@/module/util/' -let Affirm = {} +const Affirm = {} let $root = {} let $routerType = '' let $isPop = true @@ -59,7 +59,7 @@ Affirm.paramVerification = (name) => { if (!$isPop) { return true } - let dagStore = store.state.dag + const dagStore = store.state.dag let flag = false if ($routerType === 'definition-create') { // No nodes jump out directly @@ -100,7 +100,7 @@ Affirm.isPop = (fn) => { Vue.$modal.destroy() }) }, - close () { + close () { fn() Vue.$modal.destroy() } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/downChart.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/downChart.js index 3dd13895b0..1c851a175f 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/downChart.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/downChart.js @@ -21,7 +21,7 @@ import { tasksAll } from './util' import html2canvas from 'html2canvas' import { findComponentDownward } from '@/module/util/' -let DownChart = function () { +const DownChart = function () { this.dag = {} } @@ -31,10 +31,10 @@ let DownChart = function () { DownChart.prototype.maxVal = function () { return new Promise((resolve, reject) => { // All nodes - let tasksAllList = tasksAll() - let dom = $('.dag-container') - let y = parseInt(_.maxBy(tasksAllList, 'y').y + 60) - let x = parseInt(_.maxBy(tasksAllList, 'x').x + 100) + const tasksAllList = tasksAll() + const dom = $('.dag-container') + const y = parseInt(_.maxBy(tasksAllList, 'y').y + 60) + const x = parseInt(_.maxBy(tasksAllList, 'x').x + 100) resolve({ width: (x > 600 ? x : dom.width()) + 100, @@ -60,9 +60,9 @@ DownChart.prototype.download = function ({ dagThis }) { // svg handle const nodesToRecover = [] const nodesToRemove = [] - let parentNode = node.parentNode - let svg = node.outerHTML.trim() - let canvas = document.createElement('canvas') + const parentNode = node.parentNode + const svg = node.outerHTML.trim() + const canvas = document.createElement('canvas') canvg(canvas, svg) if (node.style.position) { canvas.style.position += node.style.position @@ -102,10 +102,10 @@ DownChart.prototype.download = function ({ dagThis }) { heigth: height, useCORS: true // Enable cross-domain configuration }).then((canvas) => { - let name = `${this.dag.name}.png` - let url = canvas.toDataURL('image/png', 1) + const name = `${this.dag.name}.png` + const url = canvas.toDataURL('image/png', 1) setTimeout(() => { - let triggerDownload = $('').attr('href', url).attr('download', name).appendTo('body') + const triggerDownload = $('').attr('href', url).attr('download', name).appendTo('body') triggerDownload[0].click() triggerDownload.remove() }, 100) diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/dragZoom.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/dragZoom.js index b084e2e9c8..2027f8e1ea 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/dragZoom.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/dragZoom.js @@ -23,7 +23,7 @@ const DragZoom = function () { } DragZoom.prototype.init = function () { - let $canvas = $('#canvas') + const $canvas = $('#canvas') this.element = d3.select('#canvas') this.zoom = d3.behavior.zoom() .scaleExtent([0.5, 2]) @@ -35,5 +35,4 @@ DragZoom.prototype.init = function () { this.element.call(this.zoom).on('dblclick.zoom', null) } - export default new DragZoom() diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js index c77127d49a..b0bc0fe7c1 100755 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/jsPlumbHandle.js @@ -24,7 +24,6 @@ import { jsPlumb } from 'jsplumb' import DragZoom from './dragZoom' import store from '@/conf/home/store' import router from '@/conf/home/router' -import Permissions from '@/module/permissions' import { uuid, findComponentDownward } from '@/module/util/' import { @@ -32,10 +31,11 @@ import { rtTasksTpl, setSvgColor, saveTargetarr, - rtTargetarrArr } from './util' + rtTargetarrArr +} from './util' import mStart from '@/conf/home/pages/projects/pages/definition/pages/list/_source/start' -let JSP = function () { +const JSP = function () { this.dag = {} this.selectedElement = {} @@ -75,7 +75,7 @@ JSP.prototype.init = function ({ dag, instance, options }) { this.setConfig({ isDrag: !store.state.dag.isDetails, isAttachment: false, - isNewNodes: !store.state.dag.isDetails,//Permissions.getAuth() === false ? false : !store.state.dag.isDetails, + isNewNodes: !store.state.dag.isDetails, // Permissions.getAuth() === false ? false : !store.state.dag.isDetails, isDblclick: true, isContextmenu: true, isClick: false @@ -105,7 +105,7 @@ JSP.prototype.setConfig = function (o) { * Node binding event */ JSP.prototype.tasksEvent = function (selfId) { - let tasks = $(`#${selfId}`) + const tasks = $(`#${selfId}`) // Bind right event tasks.on('contextmenu', e => { this.tasksContextmenu(e) @@ -129,7 +129,7 @@ JSP.prototype.tasksEvent = function (selfId) { JSP.prototype.draggable = function () { if (this.config.isNewNodes) { let selfId - let self = this + const self = this $('.toolbar-btn .roundedRect').draggable({ scope: 'plant', helper: 'clone', @@ -146,7 +146,7 @@ JSP.prototype.draggable = function () { drop: function (ev, ui) { let id = 'tasks-' + Math.ceil(Math.random() * 100000) // eslint-disable-line // Get mouse coordinates - let left = parseInt(ui.offset.left - $(this).offset().left) + const left = parseInt(ui.offset.left - $(this).offset().left) let top = parseInt(ui.offset.top - $(this).offset().top) - 10 if (top < 25) { top = 25 @@ -162,7 +162,7 @@ JSP.prototype.draggable = function () { })) // Get the generated node - let thisDom = jsPlumb.getSelector('.statemachine-demo .w') + const thisDom = jsPlumb.getSelector('.statemachine-demo .w') // Generating a connection node self.JspInstance.batch(() => { @@ -193,13 +193,13 @@ JSP.prototype.jsonHandle = function ({ largeJson, locations }) { $('#canvas').append(rtTasksTpl({ id: v.id, name: v.name, - x: locations[v.id]['x'], - y: locations[v.id]['y'], - targetarr: locations[v.id]['targetarr'], + x: locations[v.id].x, + y: locations[v.id].y, + targetarr: locations[v.id].targetarr, isAttachment: this.config.isAttachment, taskType: v.type, runFlag: v.runFlag, - nodenumber: locations[v.id]['nodenumber'], + nodenumber: locations[v.id].nodenumber })) // contextmenu event @@ -263,29 +263,29 @@ JSP.prototype.initNode = function (el) { */ JSP.prototype.tasksContextmenu = function (event) { if (this.config.isContextmenu) { - let routerName = router.history.current.name + const routerName = router.history.current.name // state - let isOne = routerName === 'projects-definition-details' && this.dag.releaseState !== 'NOT_RELEASE' + const isOne = routerName === 'projects-definition-details' && this.dag.releaseState !== 'NOT_RELEASE' // hide - let isTwo = store.state.dag.isDetails + const isTwo = store.state.dag.isDetails - let html = [ + const html = [ `${i18n.$t('Start')}`, `${i18n.$t('Edit')}`, `${i18n.$t('Copy')}`, `${i18n.$t('Delete')}` ] - let operationHtml = () => { + const operationHtml = () => { return html.splice(',') } - let e = event - let $id = e.currentTarget.id - let $contextmenu = $('#contextmenu') - let $name = $(`#${$id}`).find('.name-p').text() - let $left = e.pageX + document.body.scrollLeft - 5 - let $top = e.pageY + document.body.scrollTop - 5 + const e = event + const $id = e.currentTarget.id + const $contextmenu = $('#contextmenu') + const $name = $(`#${$id}`).find('.name-p').text() + const $left = e.pageX + document.body.scrollLeft - 5 + const $top = e.pageY + document.body.scrollTop - 5 $contextmenu.css({ left: $left, top: $top, @@ -297,10 +297,10 @@ JSP.prototype.tasksContextmenu = function (event) { if (isOne) { // start run $('#startRunning').on('click', () => { - let name = store.state.dag.name - let id = router.history.current.params.id + const name = store.state.dag.name + const id = router.history.current.params.id store.dispatch('dag/getStartCheck', { processDefinitionId: id }).then(res => { - let modal = Vue.$modal.dialog({ + const modal = Vue.$modal.dialog({ closable: false, showMask: true, escClose: true, @@ -332,9 +332,9 @@ JSP.prototype.tasksContextmenu = function (event) { }) }) } - if (!isTwo) { + if (!isTwo) { // edit node - $(`#editNodes`).click(ev => { + $('#editNodes').click(ev => { findComponentDownward(this.dag.$root, 'dag-chart')._createNodes({ id: $id, type: $(`#${$id}`).attr('data-tasks-type') @@ -359,7 +359,7 @@ JSP.prototype.tasksContextmenu = function (event) { JSP.prototype.tasksDblclick = function (e) { // Untie event if (this.config.isDblclick) { - let id = $(e.currentTarget.offsetParent).attr('id') + const id = $(e.currentTarget.offsetParent).attr('id') findComponentDownward(this.dag.$root, 'dag-chart')._createNodes({ id: id, @@ -373,10 +373,10 @@ JSP.prototype.tasksDblclick = function (e) { */ JSP.prototype.tasksClick = function (e) { let $id - let self = this - let $body = $(`body`) + const self = this + const $body = $('body') if (this.config.isClick) { - let $connect = this.selectedElement.connect + const $connect = this.selectedElement.connect $('.w').removeClass('jtk-tasks-active') $(e.currentTarget).addClass('jtk-tasks-active') if ($connect) { @@ -406,7 +406,7 @@ JSP.prototype.tasksClick = function (e) { * paste */ JSP.prototype.removePaste = function () { - let $body = $(`body`) + const $body = $('body') // Unbind copy and paste events $body.unbind('copy').unbind('paste') // Remove selected node parameters @@ -421,7 +421,7 @@ JSP.prototype.removePaste = function () { JSP.prototype.connectClick = function (e) { // Set svg color setSvgColor(e, '#0097e0') - let $id = this.selectedElement.id + const $id = this.selectedElement.id if ($id) { $(`#${$id}`).removeClass('jtk-tasks-active') this.selectedElement.id = null @@ -434,24 +434,10 @@ JSP.prototype.connectClick = function (e) { * @param {Pointer} */ JSP.prototype.handleEventPointer = function (is) { - let wDom = $('.w') this.setConfig({ isClick: is, isAttachment: false }) - // wDom.removeClass('jtk-ep') - // if (!is) { - // wDom.removeClass('jtk-tasks-active') - // this.selectedElement = {} - // _.map($('#canvas svg'), v => { - // if ($(v).attr('class')) { - // _.map($(v).find('path'), v1 => { - // $(v1).attr('fill', '#555') - // $(v1).attr('stroke', '#555') - // }) - // } - // }) - // } } /** @@ -459,7 +445,7 @@ JSP.prototype.handleEventPointer = function (is) { * @param {Line} */ JSP.prototype.handleEventLine = function (is) { - let wDom = $('.w') + const wDom = $('.w') this.setConfig({ isAttachment: is }) @@ -471,8 +457,8 @@ JSP.prototype.handleEventLine = function (is) { * @param {Remove} */ JSP.prototype.handleEventRemove = function () { - let $id = this.selectedElement.id || null - let $connect = this.selectedElement.connect || null + const $id = this.selectedElement.id || null + const $connect = this.selectedElement.connect || null if ($id) { this.removeNodes(this.selectedElement.id) } else { @@ -489,9 +475,9 @@ JSP.prototype.handleEventRemove = function () { JSP.prototype.removeNodes = function ($id) { // Delete node processing(data-targetarr) _.map(tasksAll(), v => { - let targetarr = v.targetarr.split(',') + const targetarr = v.targetarr.split(',') if (targetarr.length) { - let newArr = _.filter(targetarr, v1 => v1 !== $id) + const newArr = _.filter(targetarr, v1 => v1 !== $id) $(`#${v.id}`).attr('data-targetarr', newArr.toString()) } }) @@ -502,7 +488,7 @@ JSP.prototype.removeNodes = function ($id) { $(`#${$id}`).remove() // callback onRemoveNodes event - this.options&&this.options.onRemoveNodes&&this.options.onRemoveNodes($id) + this.options && this.options.onRemoveNodes && this.options.onRemoveNodes($id) } /** @@ -513,15 +499,15 @@ JSP.prototype.removeConnect = function ($connect) { return } // Remove connections and remove node and node dependencies - let targetId = $connect.targetId - let sourceId = $connect.sourceId + const targetId = $connect.targetId + const sourceId = $connect.sourceId let targetarr = rtTargetarrArr(targetId) if (targetarr.length) { targetarr = _.filter(targetarr, v => v !== sourceId) $(`#${targetId}`).attr('data-targetarr', targetarr.toString()) } - if ($(`#${sourceId}`).attr('data-tasks-type')=='CONDITIONS') { - $(`#${sourceId}`).attr('data-nodenumber',Number($(`#${sourceId}`).attr('data-nodenumber'))-1) + if ($(`#${sourceId}`).attr('data-tasks-type') === 'CONDITIONS') { + $(`#${sourceId}`).attr('data-nodenumber', Number($(`#${sourceId}`).attr('data-nodenumber')) - 1) } this.JspInstance.deleteConnection($connect) @@ -533,24 +519,24 @@ JSP.prototype.removeConnect = function ($connect) { */ JSP.prototype.copyNodes = function ($id) { let newNodeInfo = _.cloneDeep(_.find(store.state.dag.tasks, v => v.id === $id)) - let newNodePors = store.state.dag.locations[$id] + const newNodePors = store.state.dag.locations[$id] // Unstored nodes do not allow replication if (!newNodePors) { return } // Generate random id - let newUuId = `${uuid() + uuid()}` - let id = newNodeInfo.id.length > 8 ? newNodeInfo.id.substr(0, 7) : newNodeInfo.id - let name = newNodeInfo.name.length > 8 ? newNodeInfo.name.substr(0, 7) : newNodeInfo.name + const newUuId = `${uuid() + uuid()}` + const id = newNodeInfo.id.length > 8 ? newNodeInfo.id.substr(0, 7) : newNodeInfo.id + const name = newNodeInfo.name.length > 8 ? newNodeInfo.name.substr(0, 7) : newNodeInfo.name // new id - let newId = `${id || ''}-${newUuId}` + const newId = `${id || ''}-${newUuId}` // new name - let newName = `${name || ''}-${newUuId}` + const newName = `${name || ''}-${newUuId}` // coordinate x - let newX = newNodePors.x + 100 + const newX = newNodePors.x + 100 // coordinate y - let newY = newNodePors.y + 40 + const newY = newNodePors.y + 40 // Generate template node $('#canvas').append(rtTasksTpl({ @@ -563,7 +549,7 @@ JSP.prototype.copyNodes = function ($id) { })) // Get the generated node - let thisDom = jsPlumb.getSelector('.statemachine-demo .w') + const thisDom = jsPlumb.getSelector('.statemachine-demo .w') // Copy node information newNodeInfo = Object.assign(newNodeInfo, { @@ -604,7 +590,7 @@ JSP.prototype.handleEventScreen = function ({ item, is }) { item.icon = 'ans-icon-max' screenOpen = false } - let $mainLayoutModel = $('.main-layout-model') + const $mainLayoutModel = $('.main-layout-model') if (screenOpen) { $mainLayoutModel.addClass('dag-screen') } else { @@ -619,21 +605,21 @@ JSP.prototype.handleEventScreen = function ({ item, is }) { */ JSP.prototype.saveStore = function () { return new Promise((resolve, reject) => { - let connects = [] - let locations = {} - let tasks = [] + const connects = [] + const locations = {} + const tasks = [] - let is = (id) => { + const is = (id) => { return !!_.filter(tasksAll(), v => v.id === id).length } // task _.map(_.cloneDeep(store.state.dag.tasks), v => { if (is(v.id)) { - let preTasks = [] - let id = $(`#${v.id}`) - let tar = id.attr('data-targetarr') - let idDep = tar ? id.attr('data-targetarr').split(',') : [] + const preTasks = [] + const id = $(`#${v.id}`) + const tar = id.attr('data-targetarr') + const idDep = tar ? id.attr('data-targetarr').split(',') : [] if (idDep.length) { _.map(idDep, v1 => { preTasks.push($(`#${v1}`).find('.name-p').text()) @@ -655,12 +641,11 @@ JSP.prototype.saveStore = function () { _.map(this.JspInstance.getConnections(), v => { connects.push({ - 'endPointSourceId': v.sourceId, - 'endPointTargetId': v.targetId + endPointSourceId: v.sourceId, + endPointTargetId: v.targetId }) }) - _.map(tasksAll(), v => { locations[v.id] = { name: v.name, @@ -671,7 +656,6 @@ JSP.prototype.saveStore = function () { } }) - // Storage node store.commit('dag/setTasks', tasks) // Store coordinate information @@ -692,14 +676,14 @@ JSP.prototype.saveStore = function () { JSP.prototype.handleEvent = function () { this.JspInstance.bind('beforeDrop', function (info) { - let sourceId = info['sourceId']// 出 - let targetId = info['targetId']// 入 + const sourceId = info.sourceId// 出 + const targetId = info.targetId// 入 /** * Recursive search for nodes */ let recursiveVal const recursiveTargetarr = (arr, targetId) => { - for (let i in arr) { + for (const i in arr) { if (arr[i] === targetId) { recursiveVal = targetId } else { @@ -719,10 +703,10 @@ JSP.prototype.handleEvent = function () { return false } - if ($(`#${sourceId}`).attr('data-tasks-type')=='CONDITIONS' && $(`#${sourceId}`).attr('data-nodenumber')==2) { + if ($(`#${sourceId}`).attr('data-tasks-type') === 'CONDITIONS' && $(`#${sourceId}`).attr('data-nodenumber') === 2) { return false } else { - $(`#${sourceId}`).attr('data-nodenumber',Number($(`#${sourceId}`).attr('data-nodenumber'))+1) + $(`#${sourceId}`).attr('data-nodenumber', Number($(`#${sourceId}`).attr('data-nodenumber')) + 1) } // Storage node dependency information @@ -744,7 +728,7 @@ JSP.prototype.jspBackfill = function ({ connects, locations, largeJson }) { locations: locations }) - let wNodes = jsPlumb.getSelector('.statemachine-demo .w') + const wNodes = jsPlumb.getSelector('.statemachine-demo .w') // Backfill line this.JspInstance.batch(() => { diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js index 17e7faf477..e44363911b 100755 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/plugIn/util.js @@ -23,7 +23,7 @@ import store from '@/conf/home/store' * Node, to array */ const rtTargetarrArr = (id) => { - let ids = $(`#${id}`).attr('data-targetarr') + const ids = $(`#${id}`).attr('data-targetarr') return ids ? ids.split(',') : [] } @@ -31,8 +31,8 @@ const rtTargetarrArr = (id) => { * Store node id to targetarr */ const saveTargetarr = (valId, domId) => { - let $target = $(`#${domId}`) - let targetStr = $target.attr('data-targetarr') ? $target.attr('data-targetarr') + `,${valId}` : `${valId}` + const $target = $(`#${domId}`) + const targetStr = $target.attr('data-targetarr') ? $target.attr('data-targetarr') + `,${valId}` : `${valId}` $target.attr('data-targetarr', targetStr) } @@ -44,20 +44,20 @@ const rtBantpl = () => { * return node html */ const rtTasksTpl = ({ id, name, x, y, targetarr, isAttachment, taskType, runFlag, nodenumber }) => { - let tpl = `` + let tpl = '' tpl += `
` - tpl += `
` - tpl += `
` + tpl += '
' + tpl += '
' tpl += `
` tpl += `${name}` - tpl += `
` - tpl += `
` - tpl += `
` + tpl += '
' + tpl += '
' + tpl += '
' if (runFlag === 'FORBIDDEN') { tpl += rtBantpl() } - tpl += `
` - tpl += `
` + tpl += '
' + tpl += '' return tpl } @@ -66,9 +66,9 @@ const rtTasksTpl = ({ id, name, x, y, targetarr, isAttachment, taskType, runFlag * Get all tasks nodes */ const tasksAll = () => { - let a = [] + const a = [] $('#canvas .w').each(function (idx, elem) { - let e = $(elem) + const e = $(elem) a.push({ id: e.attr('id'), name: e.find('.name-p').text(), @@ -117,10 +117,10 @@ const setSvgColor = (e, color) => { * Get all node ids */ const allNodesId = () => { - let idArr = [] + const idArr = [] $('.w').each((i, o) => { - let $obj = $(o) - let $span = $obj.find('.name-p').text() + const $obj = $(o) + const $span = $obj.find('.name-p').text() if ($span) { idArr.push({ id: $obj.attr('id'), diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/monitor/pages/servers/_source/gaugeOption.js b/dolphinscheduler-ui/src/js/conf/home/pages/monitor/pages/servers/_source/gaugeOption.js index 6d64db5e02..a61f80f530 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/monitor/pages/servers/_source/gaugeOption.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/monitor/pages/servers/_source/gaugeOption.js @@ -30,21 +30,21 @@ export default function (value) { color: [ [ 0.5, new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ // eslint-disable-line offset: 1, - color: '#1CAD52'// 50% Color in place + color: '#1CAD52'// 50% Color in place }, { offset: 0.8, - color: '#1CAD52'// 40% Color in place - }], false) ], // 100% Color in place + color: '#1CAD52'// 40% Color in place + }], false)], // 100% Color in place [ 0.7, new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ // eslint-disable-line offset: 1, - color: '#FFC539'// 70% Color in place + color: '#FFC539'// 70% Color in place }, { offset: 0.8, - color: '#FEEC49'// 66% Color in place + color: '#FEEC49'// 66% Color in place }, { offset: 0, - color: '#C7DD6B'// 50% Color in place - }], false) ], + color: '#C7DD6B'// 50% Color in place + }], false)], [ 0.9, new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ // eslint-disable-line offset: 1, color: '#E75F25' // 90% Color in place @@ -54,14 +54,14 @@ export default function (value) { }, { offset: 0, color: '#FFC539' // 70% Color in place - }], false) ], + }], false)], [1, new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { // eslint-disable-line offset: 0.2, color: '#E75F25' // 92% Color in place }, { offset: 0, color: '#D9452C' // 90% Color in place - }], false) ] + }], false)] ], width: 10 } @@ -92,10 +92,10 @@ export default function (value) { show: true, lineStyle: { // Property linestyle controls line style color: [ // Dial Color - [ 0.5, '#20AE51' ], // 0-50%Color in place - [ 0.7, '#FFED44' ], // 51%-70%Color in place - [ 0.9, '#FF9618' ], // 70%-90%Color in place - [ 1, '#DA462C']// 90%-100%Color in place + [0.5, '#20AE51'], // 0-50%Color in place + [0.7, '#FFED44'], // 51%-70%Color in place + [0.9, '#FF9618'], // 70%-90%Color in place + [1, '#DA462C']// 90%-100%Color in place ], width: 30// Dial width } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/_source/instanceConditions/common.js b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/_source/instanceConditions/common.js index 091b8178f9..254098a65b 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/_source/instanceConditions/common.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/_source/instanceConditions/common.js @@ -20,7 +20,7 @@ import i18n from '@/module/i18n' /** * State code table */ -let stateType = [ +const stateType = [ { code: '', label: `${i18n.$t('none')}` diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue index efb7ea31ce..1a07fae037 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue @@ -92,7 +92,7 @@ - + v.code === code)[0].desc }, @@ -176,6 +177,7 @@ * Start */ _start (item) { + this.getWorkerGroupsAll() this.getStartCheck({ processDefinitionId: item.id }).then(res => { let self = this let modal = this.$modal.dialog({ diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/util.js b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/util.js index 2259dea9cd..308af45a48 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/util.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/util.js @@ -17,7 +17,7 @@ import i18n from '@/module/i18n' -let warningTypeList = [ +const warningTypeList = [ { id: 'NONE', code: `${i18n.$t('none_1')}` @@ -42,9 +42,9 @@ const isEmial = (val) => { } const fuzzyQuery = (list, keyWord) => { - let len = list.length - let arr = [] - let reg = new RegExp(keyWord) + const len = list.length + const arr = [] + const reg = new RegExp(keyWord) for (let i = 0; i < len; i++) { if (list[i].match(reg)) { arr.push(list[i]) diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/_source/tree.js b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/_source/tree.js index 5ff02e869f..af2d26831b 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/_source/tree.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/_source/tree.js @@ -21,7 +21,7 @@ import { tasksType, tasksState } from '@/conf/home/pages/dag/_source/config' let self = this -let Tree = function () { +const Tree = function () { self = this this.selfTree = {} this.tree = function () {} @@ -57,7 +57,7 @@ Tree.prototype.init = function ({ data, limit, selfTree }) { this.duration = 400 this.i = 0 this.tree = d3.layout.tree().nodeSize([0, 46]) - let tasks = this.tree.nodes(data) + const tasks = this.tree.nodes(data) this.diagonal = d3.svg .diagonal() @@ -142,9 +142,9 @@ Tree.prototype.treeToggles = function (clicked_d) { // eslint-disable-line */ Tree.prototype.treeUpdate = function (source) { return new Promise((resolve, reject) => { - let tasks = this.tree.nodes(this.root) - let height = Math.max(500, tasks.length * this.config.barHeight + this.config.margin.top + this.config.margin.bottom) - let width = (this.config.nodesMax * 70) + (this.squareNum * (this.config.squareSize + this.config.squarePading)) + this.config.margin.left + this.config.margin.right + 50 + const tasks = this.tree.nodes(this.root) + const height = Math.max(500, tasks.length * this.config.barHeight + this.config.margin.top + this.config.margin.bottom) + const width = (this.config.nodesMax * 70) + (this.squareNum * (this.config.squareSize + this.config.squarePading)) + this.config.margin.left + this.config.margin.right + 50 d3.select('svg') .transition() @@ -156,12 +156,12 @@ Tree.prototype.treeUpdate = function (source) { n.x = i * this.config.barHeight }) - let task = this.svg.selectAll('g.node') + const task = this.svg.selectAll('g.node') .data(tasks, (d) => { return d.id || (d.id = ++this.i) }) - let nodeEnter = task.enter() + const nodeEnter = task.enter() .append('g') .attr('class', this.nodesClass) .attr('transform', () => 'translate(' + source.y0 + ',' + source.x0 + ')') @@ -201,7 +201,7 @@ Tree.prototype.treeUpdate = function (source) { } }) .attr('class', 'state') - .style('fill', d => d.state && tasksState[d.state].color || '#ffffff') + .style('fill', d => (d.state && tasksState[d.state].color) || '#ffffff') .attr('data-toggle', 'tooltip') .attr('rx', d => d.type ? 0 : 12) .attr('ry', d => d.type ? 0 : 12) @@ -231,7 +231,6 @@ Tree.prototype.treeUpdate = function (source) { .attr('transform', d => 'translate(' + d.y + ',' + d.x + ')') .style('opacity', 1) - // Convert the exit node to the new location of the parent node。 task.exit().transition() .duration(this.duration) @@ -240,14 +239,14 @@ Tree.prototype.treeUpdate = function (source) { .remove() // Update link - let link = this.svg.selectAll('path.link') + const link = this.svg.selectAll('path.link') .data(this.tree.links(tasks), d => d.target.id) // Enter any new links in the previous location of the parent node。 link.enter().insert('path', 'g') .attr('class', 'link') .attr('d', (d) => { - let o = { x: source.x0, y: source.y0 } + const o = { x: source.x0, y: source.y0 } return this.diagonal({ source: o, target: o }) }) .transition() @@ -263,7 +262,7 @@ Tree.prototype.treeUpdate = function (source) { link.exit().transition() .duration(this.duration) .attr('d', (d) => { - let o = { x: source.x, y: source.y } + const o = { x: source.x, y: source.y } return this.diagonal({ source: o, target: o }) }) .remove() diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/_source/util.js b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/_source/util.js index eb37e82a6c..2df1783593 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/_source/util.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/tree/_source/util.js @@ -22,7 +22,7 @@ import { tasksState } from '@/conf/home/pages/dag/_source/config' * Node prompt dom */ const rtInstancesTooltip = (data) => { - let str = `
` + let str = '
' str += `id : ${data.id}
` str += `host : ${data.host}
` str += `name : ${data.name}
` @@ -33,7 +33,7 @@ const rtInstancesTooltip = (data) => { str += `startTime : ${data.startTime ? formatDate(data.startTime) : '-'}
` str += `endTime : ${data.endTime ? formatDate(data.endTime) : '-'}
` str += `duration : ${data.duration}
` - str += `
` + str += '
' return str } @@ -42,7 +42,7 @@ const rtInstancesTooltip = (data) => { * Easy to calculate the width dynamically */ const rtCountMethod = list => { - let arr = [] + const arr = [] function count (list, t) { let toggle = false list.forEach(v => { diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/chartConfig.js b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/chartConfig.js index b8601a69c9..9fb18eaa91 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/chartConfig.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/chartConfig.js @@ -18,7 +18,7 @@ import _ from 'lodash' import { tasksState } from '@/conf/home/pages/dag/_source/config' -let pie = { +const pie = { series: [ { type: 'pie', @@ -37,7 +37,7 @@ let pie = { ] } -let bar = { +const bar = { title: { text: '' }, @@ -56,7 +56,7 @@ let bar = { }, tooltip: { formatter (v) { - let val = v[0].name.split(',') + const val = v[0].name.split(',') return `${val[0]} (${v[0].value})` } }, @@ -66,7 +66,7 @@ let bar = { }] } -let simple = { +const simple = { xAxis: { splitLine: { show: false @@ -93,7 +93,6 @@ let simple = { }, color: ['#D5050B', '#0398E1'] - } export { pie, bar, simple } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/gantt/_source/gantt.js b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/gantt/_source/gantt.js index e808c94627..5a4366b06f 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/gantt/_source/gantt.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/gantt/_source/gantt.js @@ -19,13 +19,13 @@ import * as d3 from 'd3' import { formatDate } from '@/module/filter/filter' import { tasksState } from '@/conf/home/pages/dag/_source/config' -let Gantt = function () { +const Gantt = function () { this.el = '' this.tasks = [] this.width = null this.height = null this.taskNames = [] - this.tickFormat = `%H:%M:%S` + this.tickFormat = '%H:%M:%S' this.margin = { top: 10, right: 40, @@ -41,20 +41,20 @@ Gantt.prototype.init = function ({ el, tasks }) { this.tasks = tasks this.taskNames = _.map(_.cloneDeep(tasks), v => v.taskName) this.taskNames = this.taskNames.reduce(function (prev, cur) { - prev.indexOf(cur) === -1 && prev.push(cur); - return prev; - },[]) + prev.indexOf(cur) === -1 && prev.push(cur) + return prev + }, []) this.height = parseInt(this.taskNames.length * 30) this.width = $(this.el).width() - this.margin.right - this.margin.left - 5 this.x = d3.time.scale() - .domain([ this.startTimeXAxis, this.endTimeXAxis ]) - .range([ 0, this.width ]) + .domain([this.startTimeXAxis, this.endTimeXAxis]) + .range([0, this.width]) .clamp(true) this.y = d3.scale.ordinal() .domain(this.taskNames) - .rangeRoundBands([ 0, this.height - this.margin.top - this.margin.bottom ], 0.1) + .rangeRoundBands([0, this.height - this.margin.top - this.margin.bottom], 0.1) this.xAxis = d3.svg.axis() .scale(this.x) @@ -97,13 +97,13 @@ Gantt.prototype.compXAxisTimes = function () { */ Gantt.prototype.initializeXAxis = function () { this.x = d3.time.scale() - .domain([ this.startTimeXAxis, this.endTimeXAxis ]) - .range([ 0, this.width ]) + .domain([this.startTimeXAxis, this.endTimeXAxis]) + .range([0, this.width]) .clamp(true) this.y = d3.scale.ordinal() .domain(this.taskNames) - .rangeRoundBands([ 0, this.height - this.margin.top - this.margin.bottom ], 0.1) + .rangeRoundBands([0, this.height - this.margin.top - this.margin.bottom], 0.1) this.xAxis = d3.svg.axis() .scale(this.x) @@ -151,9 +151,9 @@ Gantt.prototype.drawChart = function () { .attr('transform', 'translate(0, ' + (this.height - this.margin.top - this.margin.bottom) + ')') .transition() .call(this.xAxis) - .selectAll("text") - .attr("transform", `rotate(-${this.width / ($('.tick').length - 1) > 50 ? 0 : Math.acos(this.width / ($('.tick').length - 1) / 50) * 57 })`) - .style("text-anchor", `${this.width / ($('.tick').length - 1) > 50 ? 'middle' : 'end'}`) + .selectAll('text') + .attr('transform', `rotate(-${this.width / ($('.tick').length - 1) > 50 ? 0 : Math.acos(this.width / ($('.tick').length - 1) / 50) * 57})`) + .style('text-anchor', `${this.width / ($('.tick').length - 1) > 50 ? 'middle' : 'end'}`) svg.append('g') .attr('class', 'y axis') @@ -169,15 +169,14 @@ Gantt.prototype.drawChart = function () { * Tip prompt */ Gantt.prototype.tip = function (d) { - let str = `
` + let str = '
' str += `taskName : ${d.taskName}
` str += `status : ${tasksState[d.status].desc} (${d.status})
` str += `startTime : ${formatDate(d.isoStart)}
` str += `endTime : ${formatDate(d.isoEnd)}
` str += `duration : ${d.duration}
` - str += `
` + str += '
' return str } - export default new Gantt() diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/_source/common.js b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/_source/common.js index 8e534f9237..595217397e 100755 --- a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/_source/common.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/_source/common.js @@ -18,6 +18,6 @@ /** * Create file type */ -let filtTypeArr = ['txt', 'log', 'sh', 'conf', 'cfg', 'py', 'java', 'sql', 'xml', 'hql', 'properties'] +const filtTypeArr = ['txt', 'log', 'sh', 'conf', 'cfg', 'py', 'java', 'sql', 'xml', 'hql', 'properties'] export { filtTypeArr } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/_source/utils.js b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/_source/utils.js index bf20a8c5ff..283931edc3 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/_source/utils.js +++ b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/_source/utils.js @@ -32,7 +32,6 @@ const handlerSuffix = { '.properties': 'textile' } - export { handlerSuffix } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/createUser.vue b/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/createUser.vue index 7a1cf5bca4..866fb4e0e7 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/createUser.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/createUser.vue @@ -46,7 +46,7 @@