Browse Source

[Fix-5825][BUG][WEB] the resource tree in the process definition of latest dev branch can't display correctly (#5826)

* resoures-shows-error

* fix codestyle error

* add license header for new js

* fix codesmell
2.0.7-release
kyoty 3 years ago committed by GitHub
parent
commit
6964c090c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 44
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/resourceTree.js
  2. 39
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue
  3. 39
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue
  4. 38
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue
  5. 38
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
  6. 40
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue
  7. 37
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/waterdrop.vue

44
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/resourceTree.js

@ -0,0 +1,44 @@
/*
* 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.
*/
export function diGuiTree (items) { // Recursive convenience tree structure
items.forEach(item => {
item.children === '' || item.children === undefined || item.children === null || item.children.length === 0
? operationTree(item) : diGuiTree(item.children)
})
}
export function operationTree (item) {
if (item.dirctory) {
item.isDisabled = true
}
delete item.children
}
export function searchTree (element, id) {
// 根据id查找节点
if (element.id === id) {
return element
} else if (element.children) {
let i
let result = null
for (i = 0; result === null && i < element.children.length; i++) {
result = searchTree(element.children[i], id)
}
return result
}
return null
}

39
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue

@ -204,6 +204,7 @@
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import disabledState from '@/module/mixin/disabledState' import disabledState from '@/module/mixin/disabledState'
import Clipboard from 'clipboard' import Clipboard from 'clipboard'
import { diGuiTree, searchTree } from './_source/resourceTree'
export default { export default {
name: 'flink', name: 'flink',
@ -398,40 +399,14 @@
}) })
return true return true
}, },
diGuiTree (item) { // Recursive convenience tree structure
item.forEach(item => {
item.children === '' || item.children === undefined || item.children === null || item.children.length === 0
? this.operationTree(item) : this.diGuiTree(item.children)
})
},
operationTree (item) {
if (item.dirctory) {
item.isDisabled = true
}
delete item.children
},
searchTree (element, id) {
// id
if (element.id === id) {
return element
} else if (element.children !== null) {
let i
let result = null
for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id)
}
return result
}
return null
},
dataProcess (backResource) { dataProcess (backResource) {
let isResourceId = [] let isResourceId = []
let resourceIdArr = [] let resourceIdArr = []
if (this.resourceList.length > 0) { if (this.resourceList.length > 0) {
this.resourceList.forEach(v => { this.resourceList.forEach(v => {
this.mainJarList.forEach(v1 => { this.mainJarList.forEach(v1 => {
if (this.searchTree(v1, v)) { if (searchTree(v1, v)) {
isResourceId.push(this.searchTree(v1, v)) isResourceId.push(searchTree(v1, v))
} }
}) })
}) })
@ -503,8 +478,8 @@
if (this.resourceList.length > 0) { if (this.resourceList.length > 0) {
this.resourceList.forEach(v => { this.resourceList.forEach(v => {
this.mainJarList.forEach(v1 => { this.mainJarList.forEach(v1 => {
if (this.searchTree(v1, v)) { if (searchTree(v1, v)) {
isResourceId.push(this.searchTree(v1, v)) isResourceId.push(searchTree(v1, v))
} }
}) })
}) })
@ -538,8 +513,8 @@
created () { created () {
let item = this.store.state.dag.resourcesListS let item = this.store.state.dag.resourcesListS
let items = this.store.state.dag.resourcesListJar let items = this.store.state.dag.resourcesListJar
this.diGuiTree(item) diGuiTree(item)
this.diGuiTree(items) diGuiTree(items)
this.mainJarList = item this.mainJarList = item
this.mainJarLists = items this.mainJarLists = items
let o = this.backfillItem let o = this.backfillItem

39
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue

@ -117,6 +117,7 @@
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import disabledState from '@/module/mixin/disabledState' import disabledState from '@/module/mixin/disabledState'
import Clipboard from 'clipboard' import Clipboard from 'clipboard'
import { diGuiTree, searchTree } from './_source/resourceTree'
export default { export default {
name: 'mr', name: 'mr',
@ -210,40 +211,14 @@
_onCacheResourcesData (a) { _onCacheResourcesData (a) {
this.cacheResourceList = a this.cacheResourceList = a
}, },
diGuiTree (item) { // Recursive convenience tree structure
item.forEach(item => {
item.children === '' || item.children === undefined || item.children === null || item.children.length === 0
? this.operationTree(item) : this.diGuiTree(item.children)
})
},
operationTree (item) {
if (item.dirctory) {
item.isDisabled = true
}
delete item.children
},
searchTree (element, id) {
// id
if (element.id === id) {
return element
} else if (element.children !== null) {
let i
let result = null
for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id)
}
return result
}
return null
},
dataProcess (backResource) { dataProcess (backResource) {
let isResourceId = [] let isResourceId = []
let resourceIdArr = [] let resourceIdArr = []
if (this.resourceList.length > 0) { if (this.resourceList.length > 0) {
this.resourceList.forEach(v => { this.resourceList.forEach(v => {
this.mainJarList.forEach(v1 => { this.mainJarList.forEach(v1 => {
if (this.searchTree(v1, v)) { if (searchTree(v1, v)) {
isResourceId.push(this.searchTree(v1, v)) isResourceId.push(searchTree(v1, v))
} }
}) })
}) })
@ -359,8 +334,8 @@
if (this.resourceList.length > 0) { if (this.resourceList.length > 0) {
this.resourceList.forEach(v => { this.resourceList.forEach(v => {
this.mainJarList.forEach(v1 => { this.mainJarList.forEach(v1 => {
if (this.searchTree(v1, v)) { if (searchTree(v1, v)) {
isResourceId.push(this.searchTree(v1, v)) isResourceId.push(searchTree(v1, v))
} }
}) })
}) })
@ -388,8 +363,8 @@
created () { created () {
let item = this.store.state.dag.resourcesListS let item = this.store.state.dag.resourcesListS
let items = this.store.state.dag.resourcesListJar let items = this.store.state.dag.resourcesListJar
this.diGuiTree(item) diGuiTree(item)
this.diGuiTree(items) diGuiTree(items)
this.mainJarList = item this.mainJarList = item
this.mainJarLists = items this.mainJarLists = items
let o = this.backfillItem let o = this.backfillItem

38
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue

@ -66,6 +66,8 @@
import disabledState from '@/module/mixin/disabledState' import disabledState from '@/module/mixin/disabledState'
import codemirror from '@/conf/home/pages/resource/pages/file/pages/_source/codemirror' import codemirror from '@/conf/home/pages/resource/pages/file/pages/_source/codemirror'
import Clipboard from 'clipboard' import Clipboard from 'clipboard'
import { diGuiTree, searchTree } from './_source/resourceTree'
let editor let editor
export default { export default {
@ -198,40 +200,14 @@
return editor return editor
}, },
diGuiTree (item) { // Recursive convenience tree structure
item.forEach(item => {
item.children === '' || item.children === undefined || item.children === null || item.children.length === 0
? this.operationTree(item) : this.diGuiTree(item.children)
})
},
operationTree (item) {
if (item.dirctory) {
item.isDisabled = true
}
delete item.children
},
searchTree (element, id) {
// id
if (element.id === id) {
return element
} else if (element.children !== null) {
let i
let result = null
for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id)
}
return result
}
return null
},
dataProcess (backResource) { dataProcess (backResource) {
let isResourceId = [] let isResourceId = []
let resourceIdArr = [] let resourceIdArr = []
if (this.resourceList.length > 0) { if (this.resourceList.length > 0) {
this.resourceList.forEach(v => { this.resourceList.forEach(v => {
this.resourceOptions.forEach(v1 => { this.resourceOptions.forEach(v1 => {
if (this.searchTree(v1, v)) { if (searchTree(v1, v)) {
isResourceId.push(this.searchTree(v1, v)) isResourceId.push(searchTree(v1, v))
} }
}) })
}) })
@ -297,8 +273,8 @@
if (this.resourceList.length > 0) { if (this.resourceList.length > 0) {
this.resourceList.forEach(v => { this.resourceList.forEach(v => {
this.resourceOptions.forEach(v1 => { this.resourceOptions.forEach(v1 => {
if (this.searchTree(v1, v)) { if (searchTree(v1, v)) {
isResourceId.push(this.searchTree(v1, v)) isResourceId.push(searchTree(v1, v))
} }
}) })
}) })
@ -317,7 +293,7 @@
}, },
created () { created () {
let item = this.store.state.dag.resourcesListS let item = this.store.state.dag.resourcesListS
this.diGuiTree(item) diGuiTree(item)
this.resourceOptions = item this.resourceOptions = item
let o = this.backfillItem let o = this.backfillItem

38
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue

@ -69,6 +69,8 @@
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import codemirror from '@/conf/home/pages/resource/pages/file/pages/_source/codemirror' import codemirror from '@/conf/home/pages/resource/pages/file/pages/_source/codemirror'
import Clipboard from 'clipboard' import Clipboard from 'clipboard'
import { diGuiTree, searchTree } from './_source/resourceTree'
let editor let editor
export default { export default {
@ -208,40 +210,14 @@
return editor return editor
}, },
diGuiTree (item) { // Recursive convenience tree structure
item.forEach(item => {
item.children === '' || item.children === undefined || item.children === null || item.children.length === 0
? this.operationTree(item) : this.diGuiTree(item.children)
})
},
operationTree (item) {
if (item.dirctory) {
item.isDisabled = true
}
delete item.children
},
searchTree (element, id) {
// id
if (element.id === id) {
return element
} else if (element.children !== null) {
let i
let result = null
for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id)
}
return result
}
return null
},
dataProcess (backResource) { dataProcess (backResource) {
let isResourceId = [] let isResourceId = []
let resourceIdArr = [] let resourceIdArr = []
if (this.resourceList.length > 0) { if (this.resourceList.length > 0) {
this.resourceList.forEach(v => { this.resourceList.forEach(v => {
this.options.forEach(v1 => { this.options.forEach(v1 => {
if (this.searchTree(v1, v)) { if (searchTree(v1, v)) {
isResourceId.push(this.searchTree(v1, v)) isResourceId.push(searchTree(v1, v))
} }
}) })
}) })
@ -307,8 +283,8 @@
if (this.resourceList.length > 0) { if (this.resourceList.length > 0) {
this.resourceList.forEach(v => { this.resourceList.forEach(v => {
this.options.forEach(v1 => { this.options.forEach(v1 => {
if (this.searchTree(v1, v)) { if (searchTree(v1, v)) {
isResourceId.push(this.searchTree(v1, v)) isResourceId.push(searchTree(v1, v))
} }
}) })
}) })
@ -327,7 +303,7 @@
}, },
created () { created () {
let item = this.store.state.dag.resourcesListS let item = this.store.state.dag.resourcesListS
this.diGuiTree(item) diGuiTree(item)
this.options = item this.options = item
let o = this.backfillItem let o = this.backfillItem

40
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/spark.vue

@ -205,6 +205,8 @@
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import disabledState from '@/module/mixin/disabledState' import disabledState from '@/module/mixin/disabledState'
import Clipboard from 'clipboard' import Clipboard from 'clipboard'
import { diGuiTree, searchTree } from './_source/resourceTree'
export default { export default {
name: 'spark', name: 'spark',
data () { data () {
@ -313,40 +315,14 @@
_onCacheResourcesData (a) { _onCacheResourcesData (a) {
this.cacheResourceList = a this.cacheResourceList = a
}, },
diGuiTree (item) { // Recursive convenience tree structure
item.forEach(item => {
item.children === '' || item.children === undefined || item.children === null || item.children.length === 0
? this.operationTree(item) : this.diGuiTree(item.children)
})
},
operationTree (item) {
if (item.dirctory) {
item.isDisabled = true
}
delete item.children
},
searchTree (element, id) {
// id
if (element.id === id) {
return element
} else if (element.children !== null) {
let i
let result = null
for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id)
}
return result
}
return null
},
dataProcess (backResource) { dataProcess (backResource) {
let isResourceId = [] let isResourceId = []
let resourceIdArr = [] let resourceIdArr = []
if (this.resourceList.length > 0) { if (this.resourceList.length > 0) {
this.resourceList.forEach(v => { this.resourceList.forEach(v => {
this.mainJarList.forEach(v1 => { this.mainJarList.forEach(v1 => {
if (this.searchTree(v1, v)) { if (searchTree(v1, v)) {
isResourceId.push(this.searchTree(v1, v)) isResourceId.push(searchTree(v1, v))
} }
}) })
}) })
@ -521,8 +497,8 @@
if (this.resourceList.length > 0) { if (this.resourceList.length > 0) {
this.resourceList.forEach(v => { this.resourceList.forEach(v => {
this.mainJarList.forEach(v1 => { this.mainJarList.forEach(v1 => {
if (this.searchTree(v1, v)) { if (searchTree(v1, v)) {
isResourceId.push(this.searchTree(v1, v)) isResourceId.push(searchTree(v1, v))
} }
}) })
}) })
@ -557,8 +533,8 @@
created () { created () {
let item = this.store.state.dag.resourcesListS let item = this.store.state.dag.resourcesListS
let items = this.store.state.dag.resourcesListJar let items = this.store.state.dag.resourcesListJar
this.diGuiTree(item) diGuiTree(item)
this.diGuiTree(items) diGuiTree(items)
this.mainJarList = item this.mainJarList = item
this.mainJarLists = items this.mainJarLists = items
let o = this.backfillItem let o = this.backfillItem

37
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/waterdrop.vue

@ -99,6 +99,7 @@
import disabledState from '@/module/mixin/disabledState' import disabledState from '@/module/mixin/disabledState'
import Treeselect from '@riophae/vue-treeselect' import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css' import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import { diGuiTree, searchTree } from './_source/resourceTree'
export default { export default {
name: 'waterdrop', name: 'waterdrop',
@ -228,40 +229,14 @@
return true return true
}, },
diGuiTree (item) { // Recursive convenience tree structure
item.forEach(item => {
item.children === '' || item.children === undefined || item.children === null || item.children.length === 0
? this.operationTree(item) : this.diGuiTree(item.children)
})
},
operationTree (item) {
if (item.dirctory) {
item.isDisabled = true
}
delete item.children
},
searchTree (element, id) {
// id
if (element.id === id) {
return element
} else if (element.children !== null) {
let i
let result = null
for (i = 0; result === null && i < element.children.length; i++) {
result = this.searchTree(element.children[i], id)
}
return result
}
return null
},
dataProcess (backResource) { dataProcess (backResource) {
let isResourceId = [] let isResourceId = []
let resourceIdArr = [] let resourceIdArr = []
if (this.resourceList.length > 0) { if (this.resourceList.length > 0) {
this.resourceList.forEach(v => { this.resourceList.forEach(v => {
this.options.forEach(v1 => { this.options.forEach(v1 => {
if (this.searchTree(v1, v)) { if (searchTree(v1, v)) {
isResourceId.push(this.searchTree(v1, v)) isResourceId.push(searchTree(v1, v))
} }
}) })
}) })
@ -340,8 +315,8 @@
if (this.resourceList.length > 0) { if (this.resourceList.length > 0) {
this.resourceList.forEach(v => { this.resourceList.forEach(v => {
this.options.forEach(v1 => { this.options.forEach(v1 => {
if (this.searchTree(v1, v)) { if (searchTree(v1, v)) {
isResourceId.push(this.searchTree(v1, v)) isResourceId.push(searchTree(v1, v))
} }
}) })
}) })
@ -364,7 +339,7 @@
}, },
created () { created () {
let item = this.store.state.dag.resourcesListS let item = this.store.state.dag.resourcesListS
this.diGuiTree(item) diGuiTree(item)
this.options = item this.options = item
let o = this.backfillItem let o = this.backfillItem

Loading…
Cancel
Save