This is an automated email from the ASF dual-hosted git repository.
kerwin pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 2a59ed0 [Improvement-#3476][UI]Resource files support copy path
operations (#5348)
2a59ed0 is described below
commit 2a59ed092ca1eea733a28f3ceb7f03776582ecb6
Author: BoYiZhang <[email protected]>
AuthorDate: Thu Apr 29 16:29:29 2021 +0800
[Improvement-#3476][UI]Resource files support copy path operations (#5348)
* Improvement-5346 : Resource files support copy path operations
* Improvement-5346 : Resource files support copy path operations
* this close #5346
The current resource file does not support copying paths
When using the path is very easy to output errors. Add copy button. Support
copy operation
* fix code smell
---
.../pages/dag/_source/formModel/tasks/flink.vue | 22 ++++++++++++++++++++-
.../home/pages/dag/_source/formModel/tasks/mr.vue | 23 +++++++++++++++++++++-
.../pages/dag/_source/formModel/tasks/python.vue | 23 ++++++++++++++++++++--
.../pages/dag/_source/formModel/tasks/shell.vue | 23 ++++++++++++++++++++--
.../pages/dag/_source/formModel/tasks/spark.vue | 23 ++++++++++++++++++++--
.../src/js/module/i18n/locale/en_US.js | 1 +
.../src/js/module/i18n/locale/zh_CN.js | 1 +
7 files changed, 108 insertions(+), 8 deletions(-)
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue
index 518e324..3031dcc 100644
---
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/flink.vue
@@ -177,7 +177,7 @@
<div slot="text">{{$t('Resources')}}</div>
<div slot="content">
<treeselect v-model="resourceList" :multiple="true" maxHeight="200"
:options="mainJarList" :normalizer="normalizer" :disabled="isDetails"
:value-consists-of="valueConsistsOf" :placeholder="$t('Please select
resources')">
- <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName
}}</div>
+ <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName
}}<span class="copy-path" @mousedown="_copyPath($event, node)" > <em
class="el-icon-copy-document" data-container="body" data-toggle="tooltip"
:title="$t('Copy path')" ></em> </span></div>
</treeselect>
</div>
</m-list-box>
@@ -203,6 +203,7 @@
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import disabledState from '@/module/mixin/disabledState'
+ import Clipboard from 'clipboard'
export default {
name: 'flink',
@@ -263,6 +264,25 @@
},
mixins: [disabledState],
methods: {
+ _copyPath (e, node) {
+ e.stopPropagation()
+ let clipboard = new Clipboard('.copy-path', {
+ text: function () {
+ return node.raw.fullName
+ }
+ })
+ clipboard.on('success', handler => {
+ this.$message.success(`${i18n.$t('Copy success')}`)
+ // Free memory
+ clipboard.destroy()
+ })
+ clipboard.on('error', handler => {
+ // Copy is not supported
+ this.$message.warning(`${i18n.$t('The browser does not support
automatic copying')}`)
+ // Free memory
+ clipboard.destroy()
+ })
+ },
/**
* getResourceId
*/
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue
index ba50195..253a596 100644
---
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/mr.vue
@@ -91,7 +91,7 @@
<div slot="text">{{$t('Resources')}}</div>
<div slot="content">
<treeselect v-model="resourceList" :multiple="true" maxHeight="200"
:options="mainJarList" :normalizer="normalizer" :disabled="isDetails"
:value-consists-of="valueConsistsOf" :placeholder="$t('Please select
resources')">
- <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName
}}</div>
+ <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName
}}<span class="copy-path" @mousedown="_copyPath($event, node)" > <em
class="el-icon-copy-document" data-container="body" data-toggle="tooltip"
:title="$t('Copy path')" ></em> </span></div>
</treeselect>
</div>
</m-list-box>
@@ -116,6 +116,8 @@
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import disabledState from '@/module/mixin/disabledState'
+ import Clipboard from 'clipboard'
+
export default {
name: 'mr',
data () {
@@ -158,6 +160,25 @@
},
mixins: [disabledState],
methods: {
+ _copyPath (e, node) {
+ e.stopPropagation()
+ let clipboard = new Clipboard('.copy-path', {
+ text: function () {
+ return node.raw.fullName
+ }
+ })
+ clipboard.on('success', handler => {
+ this.$message.success(`${i18n.$t('Copy success')}`)
+ // Free memory
+ clipboard.destroy()
+ })
+ clipboard.on('error', handler => {
+ // Copy is not supported
+ this.$message.warning(`${i18n.$t('The browser does not support
automatic copying')}`)
+ // Free memory
+ clipboard.destroy()
+ })
+ },
/**
* getResourceId
*/
diff --git
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue
index d5322ea..78b4985 100644
---
a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue
+++
b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/python.vue
@@ -32,7 +32,7 @@
<div slot="text">{{$t('Resources')}}</div>
<div slot="content">
<treeselect v-model="resourceList" :multiple="true" maxHeight="200"
:options="resourceOptions" :normalizer="normalizer"
:value-consists-of="valueConsistsOf" :disabled="isDetails"
:placeholder="$t('Please select resources')">
- <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName
}}</div>
+ <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName
}}<span class="copy-path" @mousedown="_copyPath($event, node)" > <em
class="el-icon-copy-document" data-container="body" data-toggle="tooltip"
:title="$t('Copy path')" ></em> </span></div>
</treeselect>
</div>
</m-list-box>
@@ -65,7 +65,7 @@
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import disabledState from '@/module/mixin/disabledState'
import codemirror from
'@/conf/home/pages/resource/pages/file/pages/_source/codemirror'
-
+ import Clipboard from 'clipboard'
let editor
export default {
@@ -98,6 +98,25 @@
backfillItem: Object
},
methods: {
+ _copyPath (e, node) {
+ e.stopPropagation()
+ let clipboard = new Clipboard('.copy-path', {
+ text: function () {
+ return node.raw.fullName
+ }
+ })
+ clipboard.on('success', handler => {
+ this.$message.success(`${i18n.$t('Copy success')}`)
+ // Free memory
+ clipboard.destroy()
+ })
+ clipboard.on('error', handler => {
+ // Copy is not supported
+ this.$message.warning(`${i18n.$t('The browser does not support
automatic copying')}`)
+ // Free memory
+ clipboard.destroy()
+ })
+ },
/**
* return localParams
*/
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 4c61ed2..6418191 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
@@ -35,7 +35,7 @@
<div slot="text">{{$t('Resources')}}</div>
<div slot="content">
<treeselect v-model="resourceList" :multiple="true" maxHeight="200"
:options="options" :normalizer="normalizer" :disabled="isDetails"
:value-consists-of="valueConsistsOf" :placeholder="$t('Please select
resources')">
- <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName
}}</div>
+ <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName
}} <span class="copy-path" @mousedown="_copyPath($event, node)" > <em
class="el-icon-copy-document" data-container="body" data-toggle="tooltip"
:title="$t('Copy path')" ></em> </span></div>
</treeselect>
</div>
</m-list-box>
@@ -68,7 +68,7 @@
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'
-
+ import Clipboard from 'clipboard'
let editor
export default {
@@ -102,6 +102,25 @@
backfillItem: Object
},
methods: {
+ _copyPath (e, node) {
+ e.stopPropagation()
+ let clipboard = new Clipboard('.copy-path', {
+ text: function () {
+ return node.raw.fullName
+ }
+ })
+ clipboard.on('success', handler => {
+ this.$message.success(`${i18n.$t('Copy success')}`)
+ // Free memory
+ clipboard.destroy()
+ })
+ clipboard.on('error', handler => {
+ // Copy is not supported
+ this.$message.warning(`${i18n.$t('The browser does not support
automatic copying')}`)
+ // Free memory
+ clipboard.destroy()
+ })
+ },
/**
* return localParams
*/
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 5fbc767..bc299a3 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
@@ -178,7 +178,7 @@
<div slot="text">{{$t('Resources')}}</div>
<div slot="content">
<treeselect v-model="resourceList" :multiple="true" maxHeight="200"
:options="mainJarList" :normalizer="normalizer"
:value-consists-of="valueConsistsOf" :disabled="isDetails"
:placeholder="$t('Please select resources')">
- <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName
}}</div>
+ <div slot="value-label" slot-scope="{ node }">{{ node.raw.fullName
}}<span class="copy-path" @mousedown="_copyPath($event, node)" > <em
class="el-icon-copy-document" data-container="body" data-toggle="tooltip"
:title="$t('Copy path')" ></em> </span></div>
</treeselect>
</div>
</m-list-box>
@@ -204,7 +204,7 @@
import Treeselect from '@riophae/vue-treeselect'
import '@riophae/vue-treeselect/dist/vue-treeselect.css'
import disabledState from '@/module/mixin/disabledState'
-
+ import Clipboard from 'clipboard'
export default {
name: 'spark',
data () {
@@ -263,6 +263,25 @@
},
mixins: [disabledState],
methods: {
+ _copyPath (e, node) {
+ e.stopPropagation()
+ let clipboard = new Clipboard('.copy-path', {
+ text: function () {
+ return node.raw.fullName
+ }
+ })
+ clipboard.on('success', handler => {
+ this.$message.success(`${i18n.$t('Copy success')}`)
+ // Free memory
+ clipboard.destroy()
+ })
+ clipboard.on('error', handler => {
+ // Copy is not supported
+ this.$message.warning(`${i18n.$t('The browser does not support
automatic copying')}`)
+ // Free memory
+ clipboard.destroy()
+ })
+ },
/**
* getResourceId
*/
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 8d8ccbe..7c9eb08 100755
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
+++ b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
@@ -366,6 +366,7 @@ export default {
Start: 'Start',
Copy: 'Copy',
'Copy name': 'Copy name',
+ 'Copy path': 'Copy path',
'Please enter keyword': 'Please enter keyword',
'File Upload': 'File Upload',
'Drag the file into the current upload window': 'Drag the file into the
current upload window',
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 4ebf4c2..e18b6a8 100755
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
+++ b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
@@ -366,6 +366,7 @@ export default {
Start: '运行',
Copy: '复制节点',
'Copy name': '复制名称',
+ 'Copy path': '复制路径',
'Please enter keyword': '请输入关键词',
'File Upload': '文件上传',
'Drag the file into the current upload window': '请将文件拖拽到当前上传窗口内!',