From 3918a958d0e6a334dbd736428ac644fc73f4a1be Mon Sep 17 00:00:00 2001 From: gongzijian Date: Thu, 23 May 2019 10:22:10 +0800 Subject: [PATCH] =?UTF-8?q?dag=E5=90=8D=E7=A7=B0=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E5=A4=8D=E5=88=B6=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/conf/home/pages/dag/_source/dag.scss | 15 ++++++++++++++- .../src/js/conf/home/pages/dag/_source/dag.vue | 18 +++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/escheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss b/escheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss index dcfa6b7d5d..bcff822a2e 100644 --- a/escheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss +++ b/escheduler-ui/src/js/conf/home/pages/dag/_source/dag.scss @@ -138,11 +138,24 @@ .assist-btn { position: absolute; left: 10px; - top: 8px; + top: 4px; >.name { padding-left: 6px; vertical-align: middle; } + >.copy-name { + cursor: pointer; + padding-left: 4px; + &:hover { + i { + color: #47c3ff; + } + } + i { + color: #333; + font-size: 18px; + } + } } .save-btn { position: absolute; diff --git a/escheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue b/escheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue index dd573d0d56..990b9bc0ab 100644 --- a/escheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue +++ b/escheduler-ui/src/js/conf/home/pages/dag/_source/dag.vue @@ -28,7 +28,8 @@ @click="_toggleView" icon="fa fa-code"> - {{name}} + {{name}} +
@@ -88,6 +89,7 @@ import mUdp from './udp/udp' import i18n from '@/module/i18n' import { jsPlumb } from 'jsplumb' + import Clipboard from 'clipboard' import { allNodesId } from './plugIn/util' import { toolOper, tasksType } from './config' import mFormModel from './formModel/formModel' @@ -139,6 +141,20 @@ Dag.create() } }, + _copyName(){ + let clipboard = new Clipboard(`.copy-name`) + clipboard.on('success', e => { + this.$message.success(`${i18n.$t('Copy success')}`) + // Free memory + clipboard.destroy() + }) + clipboard.on('error', e => { + // Copy is not supported + this.$message.warning(`${i18n.$t('The browser does not support automatic copying')}`) + // Free memory + clipboard.destroy() + }) + }, /** * Get state interface * @param isReset Whether to manually refresh