From feb169e8d295ca0b997937ca491879c3486fac23 Mon Sep 17 00:00:00 2001 From: break60 <790061044@qq.com> Date: Thu, 28 May 2020 10:28:02 +0800 Subject: [PATCH 1/2] Add tips for download workflow --- .../src/js/conf/home/pages/dag/_source/dag.js | 21 ++++++++++++++++--- .../pages/dag/_source/plugIn/downChart.js | 10 ++++----- .../src/js/module/i18n/locale/en_US.js | 3 ++- .../src/js/module/i18n/locale/zh_CN.js | 3 ++- 4 files changed, 27 insertions(+), 10 deletions(-) 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 3f47076ce3..e70a6473ce 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 @@ -14,7 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - +import Vue from 'vue' +let v = new Vue() import _ from 'lodash' import { jsPlumb } from 'jsplumb' import JSP from './plugIn/jsPlumbHandle' @@ -73,6 +74,7 @@ Dag.prototype.create = function () { * Action event on the right side of the toolbar */ Dag.prototype.toolbarEvent = function ({ item, code, is }) { + let self = this switch (code) { case 'pointer': JSP.handleEventPointer(is) @@ -87,8 +89,21 @@ Dag.prototype.toolbarEvent = function ({ item, code, is }) { JSP.handleEventScreen({ item, is }) break case 'download': - DownChart.download({ - dagThis: this.dag + v.$modal.dialog({ + width: 350, + closable: false, + showMask: true, + maskClosable: true, + title: $t('Download'), + content: $t('Please confirm whether the workflow has been saved before downloading'), + ok: { + handle (e) { + DownChart.download({ + dagThis: self.dag + }) + } + }, + cancel: {} }) break } 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 d2051c2c86..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 @@ -19,7 +19,7 @@ import _ from 'lodash' import canvg from 'canvg' import { tasksAll } from './util' import html2canvas from 'html2canvas' -// import { findComponentDownward } from '@/module/util/' +import { findComponentDownward } from '@/module/util/' const DownChart = function () { this.dag = {} @@ -111,10 +111,10 @@ DownChart.prototype.download = function ({ dagThis }) { }, 100) // To refresh the dag instance, otherwise you can't re-plot - // setTimeout(() => { - // // Refresh current dag - // findComponentDownward(this.dag.$root, `${this.dag.type}-details`).init() - // }, 500) + setTimeout(() => { + // Refresh current dag + findComponentDownward(this.dag.$root, `${this.dag.type}-details`).init() + }, 500) }) }) } 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 fdb897fc9c..aeba322855 100755 --- a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js +++ b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js @@ -593,5 +593,6 @@ export default { 'Successful branch flow and failed branch flow are required': 'conditions node Successful and failed branch flow are required', 'Unauthorized or deleted resources': 'Unauthorized or deleted resources', 'Please delete all non-existent resources': 'Please delete all non-existent resources', - 'The Worker group no longer exists, please select the correct Worker group!': 'The Worker group no longer exists, please select the correct Worker group!' + 'The Worker group no longer exists, please select the correct Worker group!': 'The Worker group no longer exists, please select the correct Worker group!', + 'Please confirm whether the workflow has been saved before downloading': 'Please confirm whether the workflow has been saved before downloading' } 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 777173f6ce..6567d38429 100755 --- a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js +++ b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js @@ -593,5 +593,6 @@ export default { 'Successful branch flow and failed branch flow are required': 'conditions节点成功和失败分支流转必填', 'Unauthorized or deleted resources': '未授权或已删除资源', 'Please delete all non-existent resources': '请删除所有未授权或已删除资源', - 'The Worker group no longer exists, please select the correct Worker group!': '该Worker分组已经不存在,请选择正确的Worker分组!' + 'The Worker group no longer exists, please select the correct Worker group!': '该Worker分组已经不存在,请选择正确的Worker分组!', + 'Please confirm whether the workflow has been saved before downloading': '下载前请确定工作流是否已保存' } From ce405ddf8f8a50aa9af0f7e2d29617d5dd8e98b1 Mon Sep 17 00:00:00 2001 From: break60 <790061044@qq.com> Date: Thu, 28 May 2020 10:34:51 +0800 Subject: [PATCH 2/2] fix --- .../src/js/conf/home/pages/dag/_source/dag.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 e70a6473ce..ff8a4528d5 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 @@ -17,6 +17,7 @@ import Vue from 'vue' let v = new Vue() import _ from 'lodash' +import i18n from '@/module/i18n' import { jsPlumb } from 'jsplumb' import JSP from './plugIn/jsPlumbHandle' import DownChart from './plugIn/downChart' @@ -94,8 +95,8 @@ Dag.prototype.toolbarEvent = function ({ item, code, is }) { closable: false, showMask: true, maskClosable: true, - title: $t('Download'), - content: $t('Please confirm whether the workflow has been saved before downloading'), + title: i18n.$t('Download'), + content: i18n.$t('Please confirm whether the workflow has been saved before downloading'), ok: { handle (e) { DownChart.download({