From 03458234c3982bbdce59b85872b6243585ae539c Mon Sep 17 00:00:00 2001 From: break60 <790061044@qq.com> Date: Wed, 26 Aug 2020 13:52:02 +0800 Subject: [PATCH] [Feture-2753][ui]batch copy or move process --- .../definition/pages/list/_source/list.vue | 85 ++++++++++++++++- .../pages/list/_source/relatedItems.vue | 94 +++++++++++++++++++ .../src/js/conf/home/store/dag/actions.js | 32 ++++++- .../src/js/module/i18n/locale/en_US.js | 5 +- .../src/js/module/i18n/locale/zh_CN.js | 5 +- 5 files changed, 215 insertions(+), 6 deletions(-) create mode 100644 dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/relatedItems.vue diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue index 5de30e90b4..01b478f6bd 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue @@ -139,6 +139,8 @@ @@ -147,6 +149,7 @@ import _ from 'lodash' import mStart from './start' import mTiming from './timing' + import mRelatedItems from './relatedItems' import { mapActions } from 'vuex' import { publishStatus } from '@/conf/home/pages/dag/_source/config' import mVersions from './versions' @@ -166,7 +169,7 @@ pageSize: Number }, methods: { - ...mapActions('dag', ['editProcessState', 'getStartCheck', 'getReceiver', 'deleteDefinition', 'batchDeleteDefinition', 'exportDefinition', 'getProcessDefinitionVersionsPage', 'copyProcess', 'switchProcessDefinitionVersion', 'deleteProcessDefinitionVersion']), + ...mapActions('dag', ['editProcessState', 'getStartCheck', 'getReceiver', 'deleteDefinition', 'batchDeleteDefinition', 'exportDefinition', 'getProcessDefinitionVersionsPage', 'copyProcess', 'switchProcessDefinitionVersion', 'deleteProcessDefinitionVersion', 'moveProcess']), ...mapActions('security', ['getWorkerGroupsAll']), _rtPublishStatus (code) { return _.filter(publishStatus, v => v.code === code)[0].desc @@ -317,8 +320,27 @@ */ _copyProcess (item) { this.copyProcess({ - processId: item.id + processDefinitionIds: item.id, + targetProjectId: item.projectId + }).then(res => { + this.strSelectIds = '' + this.$message.success(res.msg) + $('body').find('.tooltip.fade.top.in').remove() + this._onUpdate() + }).catch(e => { + this.$message.error(e.msg || '') + }) + }, + + /** + * move + */ + _moveProcess (item) { + this.moveProcess({ + processDefinitionIds: item.id, + targetProjectId: item.projectId }).then(res => { + this.strSelectIds = '' this.$message.success(res.msg) $('body').find('.tooltip.fade.top.in').remove() this._onUpdate() @@ -469,7 +491,64 @@ this.$message.error(e.msg) }) }, - + /** + * Batch Copy + */ + _batchCopy () { + let self = this + let modal = this.$modal.dialog({ + closable: false, + showMask: true, + escClose: true, + className: 'v-modal-custom', + transitionName: 'opacityp', + render (h) { + return h(mRelatedItems, { + on: { + onBatchCopy (item) { + self._copyProcess({id: self.strSelectIds,projectId: item}) + modal.remove() + }, + close () { + modal.remove() + } + }, + props: { + tmp: false + } + }) + } + }) + }, + /** + * _batchMove + */ + _batchMove() { + let self = this + let modal = this.$modal.dialog({ + closable: false, + showMask: true, + escClose: true, + className: 'v-modal-custom', + transitionName: 'opacityp', + render (h) { + return h(mRelatedItems, { + on: { + onBatchMove (item) { + self._moveProcess({id: self.strSelectIds,projectId: item}) + modal.remove() + }, + close () { + modal.remove() + } + }, + props: { + tmp: true + } + }) + } + }) + }, /** * Edit state */ diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/relatedItems.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/relatedItems.vue new file mode 100644 index 0000000000..9090bbd771 --- /dev/null +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/relatedItems.vue @@ -0,0 +1,94 @@ +/* + * 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. + */ + + \ No newline at end of file diff --git a/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js b/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js index be516042b0..93fab5a224 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/dag/actions.js @@ -196,7 +196,8 @@ export default { copyProcess ({ state }, payload) { return new Promise((resolve, reject) => { io.post(`projects/${state.projectName}/process/copy`, { - processId: payload.processId + processDefinitionIds: payload.processDefinitionIds, + targetProjectId: payload.targetProjectId }, res => { resolve(res) }).catch(e => { @@ -205,6 +206,35 @@ export default { }) }, + /** + * Get process definition DAG diagram details + */ + moveProcess ({ state }, payload) { + return new Promise((resolve, reject) => { + io.post(`projects/${state.projectName}/process/move`, { + processDefinitionIds: payload.processDefinitionIds, + targetProjectId: payload.targetProjectId + }, res => { + resolve(res) + }).catch(e => { + reject(e) + }) + }) + }, + + /** + * Get all the items created by the logged in user + */ + getAllItems ({ state }, payload) { + return new Promise((resolve, reject) => { + io.get(`projects/login-user-created-project`, {}, res => { + resolve(res) + }).catch(e => { + reject(e) + }) + }) + }, + /** * Get the process instance DAG diagram details */ 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 ae66bc4bae..b0f315a539 100755 --- a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js +++ b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js @@ -638,5 +638,8 @@ export default { 'Connection name': 'Connection name', 'Current connection settings': 'Current connection settings', 'Please save the DAG before formatting': 'Please save the DAG before formatting', - 'Batch copy': 'Batch copy' + 'Batch copy': 'Batch copy', + 'Related items': 'Related items', + 'Project name is required': 'Project name is required', + 'Batch move': 'Batch move' } 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 bb3924c6e1..53f0e3e483 100755 --- a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js +++ b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js @@ -638,5 +638,8 @@ export default { 'Connection name': '连线名', 'Current connection settings': '当前连线设置', 'Please save the DAG before formatting': '格式化前请先保存DAG', - 'Batch copy': '批量复制' + 'Batch copy': '批量复制', + 'Related items': '关联项目', + 'Project name is required': '项目名称必填', + 'Batch move': '批量移动' }