This is an automated email from the ASF dual-hosted git repository.
lgcareer pushed a commit to branch dev-resource-tree
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git
The following commit(s) were added to refs/heads/dev-resource-tree by this push:
new ca81841 Shell task resources and authorization resources (#1989)
ca81841 is described below
commit ca81841b9a9f36853a42d810ff6a2d5b6c1d9ca5
Author: break60 <[email protected]>
AuthorDate: Fri Feb 21 19:34:03 2020 +0800
Shell task resources and authorization resources (#1989)
* File management list modification
* Shell task resources and authorization resources
---
dolphinscheduler-ui/package.json | 1 +
.../pages/dag/_source/formModel/tasks/shell.vue | 47 +++++++++++++++-----
.../pages/security/pages/users/_source/list.vue | 50 +++++++++++-----------
.../src/js/module/components/transfer/resource.vue | 49 ++++++++++-----------
4 files changed, 84 insertions(+), 63 deletions(-)
diff --git a/dolphinscheduler-ui/package.json b/dolphinscheduler-ui/package.json
index 421fd39..4e91494 100644
--- a/dolphinscheduler-ui/package.json
+++ b/dolphinscheduler-ui/package.json
@@ -11,6 +11,7 @@
"build:release": "npm run clean && cross-env NODE_ENV=production
PUBLIC_PATH=/dolphinscheduler/ui webpack --config
./build/webpack.config.release.js"
},
"dependencies": {
+ "@riophae/vue-treeselect": "^0.4.0",
"ans-ui": "1.1.7",
"axios": "^0.16.2",
"bootstrap": "3.3.7",
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
index ad40c58..96955b2 100644
---
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/shell.vue
@@ -34,6 +34,14 @@
<m-list-box>
<div slot="text">{{$t('Resources')}}</div>
<div slot="content">
+ <treeselect v-model="resourceList" :multiple="true" :options="options"
:normalizer="normalizer">
+ <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName
}}</div>
+ </treeselect>
+ </div>
+ </m-list-box>
+ <!-- <m-list-box>
+ <div slot="text">{{$t('Resources')}}</div>
+ <div slot="content">
<m-resources
ref="refResources"
@on-resourcesData="_onResourcesData"
@@ -41,7 +49,7 @@
:resource-list="resourceList">
</m-resources>
</div>
- </m-list-box>
+ </m-list-box> -->
<m-list-box>
<div slot="text">{{$t('Custom Parameters')}}</div>
<div slot="content">
@@ -63,6 +71,8 @@
import mResources from './_source/resources'
import mLocalParams from './_source/localParams'
import disabledState from '@/module/mixin/disabledState'
+ import Treeselect from '@riophae/vue-treeselect'
+ import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import codemirror from
'@/conf/home/pages/resource/pages/file/pages/_source/codemirror'
let editor
@@ -78,7 +88,16 @@
// resource(list)
resourceList: [],
// Cache ResourceList
- cacheResourceList: []
+ cacheResourceList: [],
+ // define default value
+ value: null,
+ // define options
+ options: [],
+ normalizer(node) {
+ return {
+ label: node.name
+ }
+ },
}
},
mixins: [disabledState],
@@ -143,17 +162,23 @@
return false
}
- if (!this.$refs.refResources._verifResources()) {
- return false
- }
+ // if (!this.$refs.refResources._verifResources()) {
+ // return false
+ // }
// localParams Subcomponent verification
if (!this.$refs.refLocalParams._verifProp()) {
return false
}
+ // Process resourcelist
+ let dataProcessing= _.map(this.resourceList, v => {
+ return {
+ id: v
+ }
+ })
// storage
this.$emit('on-params', {
- resourceList: this.resourceList,
+ resourceList: dataProcessing,
localParams: this.localParams,
rawScript: editor.getValue()
})
@@ -193,15 +218,15 @@
computed: {
cacheParams () {
return {
- resourceList: this.cacheResourceList,
+ // resourceList: this.cacheResourceList,
localParams: this.localParams,
rawScript: editor ? editor.getValue() : ''
}
}
},
created () {
+ this.options = this.store.state.dag.resourcesListS
let o = this.backfillItem
-
// Non-null objects represent backfill
if (!_.isEmpty(o)) {
this.rawScript = o.params.rawScript || ''
@@ -209,7 +234,9 @@
// backfill resourceList
let resourceList = o.params.resourceList || []
if (resourceList.length) {
- this.resourceList = resourceList
+ this.resourceList = _.map(resourceList, v => {
+ return v.id
+ })
this.cacheResourceList = resourceList
}
@@ -231,7 +258,7 @@
editor.off($('.code-shell-mirror'), 'keypress', this.keypress)
}
},
- components: { mLocalParams, mListBox, mResources, mScriptBox }
+ components: { mLocalParams, mListBox, mResources, mScriptBox, Treeselect }
}
</script>
<style lang="scss" rel="stylesheet/scss" scope>
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/list.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/list.vue
index 6e8887b..ecd6d97 100644
---
a/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/list.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/security/pages/users/_source/list.vue
@@ -222,38 +222,36 @@
type: 'file',
category: 'resources'
}).then(data => {
- let sourceListPrs = _.map(data[0], v => {
- return {
- id: v.id,
- name: v.alias,
- type: v.type
- }
- })
+ // let sourceListPrs = _.map(data[0], v => {
+ // return {
+ // id: v.id,
+ // name: v.alias,
+ // type: v.type
+ // }
+ // })
let fileSourceList = []
let udfSourceList = []
- sourceListPrs.forEach((value,index,array)=>{
- if(value.type =='FILE'){
- fileSourceList.push(value)
- } else{
- udfSourceList.push(value)
- }
- })
+ fileSourceList = data[1].concat(data[0])
+ // sourceListPrs.forEach((value,index,array)=>{
+ // if(value.type =='FILE'){
+ // fileSourceList.push(value)
+ // } else{
+ // udfSourceList.push(value)
+ // }
+ // })
let targetListPrs = _.map(data[1], v => {
- return {
- id: v.id,
- name: v.alias,
- type: v.type
- }
+ return v.id
})
let fileTargetList = []
let udfTargetList = []
- targetListPrs.forEach((value,index,array)=>{
- if(value.type =='FILE'){
- fileTargetList.push(value)
- } else{
- udfTargetList.push(value)
- }
- })
+ fileTargetList = targetListPrs
+ // targetListPrs.forEach((value,index,array)=>{
+ // if(value.type =='FILE'){
+ // fileTargetList.push(value)
+ // } else{
+ // udfTargetList.push(value)
+ // }
+ // })
let self = this
let modal = this.$modal.dialog({
closable: false,
diff --git a/dolphinscheduler-ui/src/js/module/components/transfer/resource.vue
b/dolphinscheduler-ui/src/js/module/components/transfer/resource.vue
index 1192ab2..e39bd67 100644
--- a/dolphinscheduler-ui/src/js/module/components/transfer/resource.vue
+++ b/dolphinscheduler-ui/src/js/module/components/transfer/resource.vue
@@ -24,22 +24,14 @@
<x-button type="ghost" value="udfResource"
@click="_ckUDf">{{$t('UDF resources')}}</x-button>
</x-button-group>
</div>
- <div class="select-list-box">
+ <treeselect v-model="selectFileSource" :multiple="true"
:options="fileSourceList" :normalizer="normalizer">
+ <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName
}}</div>
+ </treeselect>
+ <!-- <div class="select-list-box">
<div class="tf-header">
<div class="title">{{type.name}}{{$t('List')}}</div>
<div class="count">({{cacheSourceList.length}})</div>
</div>
- <!--<div class="tf-search">
- <x-input v-model="searchSourceVal"
- @on-enterkey="_sourceQuery"
- @on-click-icon="_sourceQuery"
- size="small"
- placeholder="Please enter keyword"
- type="text"
- style="width:202px;">
- <em slot="suffix" class="ans-icon-search"></em>
- </x-input>
- </div>-->
<div class="scrollbar tf-content">
<ul>
<li v-for="(item,$index) in sourceList" :key="$index"
@click="_ckSource(item)">
@@ -55,23 +47,12 @@
<div class="title">{{$t('Selected')}}{{type.name}}</div>
<div class="count">({{cacheTargetList.length}})</div>
</div>
- <!--<div class="tf-search">
- <x-input v-model="searchTargetVal"
- @on-enterkey="_targetQuery"
- @on-click-icon="_targetQuery"
- size="small"
- placeholder="Please enter keyword"
- type="text"
- style="width:202px;">
- <em slot="suffix" class="ans-icon-search"></em>
- </x-input>
- </div>-->
<div class="scrollbar tf-content">
<ul>
<li v-for="(item,$index) in targetList" :key="$index"
@click="_ckTarget(item)"><span :title="item.name">{{item.name}}</span></li>
</ul>
</div>
- </div>
+ </div> -->
</div>
</template>
</m-popup>
@@ -80,6 +61,9 @@
import _ from 'lodash'
import mPopup from '@/module/components/popup/popup'
import mListBoxF from '@/module/components/listBoxF/listBoxF'
+ import Treeselect from '@riophae/vue-treeselect'
+ import '@riophae/vue-treeselect/dist/vue-treeselect.css'
+
export default {
name: 'transfer',
@@ -92,11 +76,19 @@
cacheTargetList: this.fileTargetList,
fileSource: this.fileSourceList,
+ selectFileSource: [],
fileTarget: this.fileTargetList,
udfSource: this.udfSourceList,
udfTarget: this.udfTargetList,
searchSourceVal: '',
- searchTargetVal: ''
+ searchTargetVal: '',
+ // define default value
+ value: null,
+ normalizer(node) {
+ return {
+ label: node.name
+ }
+ },
}
},
props: {
@@ -106,12 +98,15 @@
fileTargetList: Array,
udfTargetList: Array,
},
+ created() {
+ this.selectFileSource = this.fileTargetList
+ },
methods: {
_ok () {
this.$refs['popup'].spinnerLoading = true
setTimeout(() => {
this.$refs['popup'].spinnerLoading = false
- this.$emit('onUpdate', _.map(this.fileTarget.concat(this.udfTarget),
v => v.id).join(','))
+ this.$emit('onUpdate', _.map(this.selectFileSource, v =>
v).join(','))
}, 800)
},
_ckFile() {
@@ -187,7 +182,7 @@
this._targetQuery()
}
},
- components: { mPopup, mListBoxF }
+ components: { mPopup, mListBoxF, Treeselect }
}
</script>