From ef0def3108c093b665eb54581ef95df0340e5b80 Mon Sep 17 00:00:00 2001 From: break60 <790061044@qq.com> Date: Mon, 1 Feb 2021 13:28:53 +0800 Subject: [PATCH] [Feature-3826]sql node adds alarm group field (#4602) * [Feature-3826]sql node adds alarm group field --- .../formModel/tasks/_source/warningGroups.vue | 76 ++++++++++++++++++ .../pages/dag/_source/formModel/tasks/sql.vue | 80 +++++-------------- .../pages/dag/_source/startingParam/index.vue | 2 +- .../conf/home/pages/dag/definitionDetails.vue | 4 +- .../src/js/conf/home/pages/dag/index.vue | 4 +- .../conf/home/pages/dag/instanceDetails.vue | 4 +- .../definition/pages/list/_source/list.vue | 1 + .../definition/pages/list/_source/start.vue | 6 +- .../js/conf/home/store/security/actions.js | 13 +++ .../src/js/conf/home/store/security/state.js | 1 + .../src/js/module/i18n/locale/en_US.js | 2 + .../src/js/module/i18n/locale/zh_CN.js | 2 + 12 files changed, 128 insertions(+), 67 deletions(-) create mode 100644 dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/warningGroups.vue diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/warningGroups.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/warningGroups.vue new file mode 100644 index 0000000000..30bcc522fb --- /dev/null +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/warningGroups.vue @@ -0,0 +1,76 @@ +/* + * 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. + */ + + diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sql.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sql.vue index 706edcda6a..5f58d29021 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sql.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sql.vue @@ -30,16 +30,7 @@
{{$t('SQL Type')}}
- - -
-
- - {{$t('TableMode')}} - {{$t('Attachment')}} - +
@@ -51,10 +42,17 @@ type="input" size="small" v-model="title" + :disabled="isDetails" :placeholder="$t('Please enter the title of email')"> + +
*{{$t('Alarm group')}}
+
+ +
+
{{$t('SQL Parameter')}}
@@ -142,6 +140,7 @@ import mDatasource from './_source/datasource' import mLocalParams from './_source/localParams' import mStatementList from './_source/statementList' + import mWarningGroups from './_source/warningGroups' import disabledState from '@/module/mixin/disabledState' import codemirror from '@/conf/home/pages/resource/pages/file/pages/_source/codemirror' @@ -167,8 +166,6 @@ sqlType: '0', // Email title title: '', - // Form/attachment - showType: ['TABLE'], // Sql parameter connParams: '', // Pre statements @@ -176,7 +173,8 @@ // Post statements postStatements: [], item: '', - scriptBoxDialog: false + scriptBoxDialog: false, + groupId: null } }, mixins: [disabledState], @@ -197,9 +195,6 @@ */ _onSqlType (a) { this.sqlType = a - if (a === 0) { - this.showType = ['TABLE'] - } }, /** * return udfs @@ -245,16 +240,12 @@ if (!this.$refs.refDs._verifDatasource()) { return false } - if (this.sqlType === 0 && !this.showType.length) { - this.$message.warning(`${i18n.$t('One form or attachment must be selected')}`) - return false - } - if (this.sqlType === 0 && !this.title) { + if (this.sqlType === '0' && !this.title) { this.$message.warning(`${i18n.$t('Mail subject required')}`) return false } - if (this.sqlType === 0 && !this.receivers.length) { - this.$message.warning(`${i18n.$t('Recipient required')}`) + if (this.sqlType === '0' && (this.groupId === '' || this.groupId === null)) { + this.$message.warning(`${i18n.$t('Alarm group required')}`) return false } // udfs Subcomponent verification Verification only if the data type is HIVE @@ -287,18 +278,7 @@ udfs: this.udfs, sqlType: this.sqlType, title: this.title, - showType: (() => { - /** - * Special processing return order TABLE,ATTACHMENT - * Handling checkout sequence - */ - let showType = this.showType - if (showType.length === 2 && showType[0] === 'ATTACHMENT') { - return [showType[1], showType[0]].join(',') - } else { - return showType.join(',') - } - })(), + groupId: this.groupId, localParams: this.localParams, connParams: this.connParams, preStatements: this.preStatements, @@ -347,14 +327,7 @@ udfs: this.udfs, sqlType: this.sqlType, title: this.title, - showType: (() => { - let showType = this.showType - if (showType.length === 2 && showType[0] === 'ATTACHMENT') { - return [showType[1], showType[0]].join(',') - } else { - return showType.join(',') - } - })(), + groupId: this.groupId, localParams: this.localParams, connParams: this.connParams, preStatements: this.preStatements, @@ -372,11 +345,9 @@ watch: { // Listening to sqlType sqlType (val) { - if (val === 0) { - this.showType = [] - } if (val !== 0) { this.title = '' + this.groupId = null } }, // Listening data source @@ -403,14 +374,10 @@ this.sqlType = o.params.sqlType this.connParams = o.params.connParams || '' this.localParams = o.params.localParams || [] - if (o.params.showType === '') { - this.showType = [] - } else { - this.showType = o.params.showType.split(',') || [] - } this.preStatements = o.params.preStatements || [] this.postStatements = o.params.postStatements || [] this.title = o.params.title || '' + this.groupId = o.params.groupId } }, mounted () { @@ -436,14 +403,7 @@ udfs: this.udfs, sqlType: this.sqlType, title: this.title, - showType: (() => { - let showType = this.showType - if (showType.length === 2 && showType[0] === 'ATTACHMENT') { - return [showType[1], showType[0]].join(',') - } else { - return showType.join(',') - } - })(), + groupId: this.groupId, localParams: this.localParams, connParams: this.connParams, preStatements: this.preStatements, @@ -451,6 +411,6 @@ } } }, - components: { mListBox, mDatasource, mLocalParams, mUdfs, mSqlType, mStatementList, mScriptBox } + components: { mListBox, mDatasource, mLocalParams, mUdfs, mSqlType, mStatementList, mScriptBox, mWarningGroups } } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/startingParam/index.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/startingParam/index.vue index bcc91524ff..de42199a1a 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/startingParam/index.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/startingParam/index.vue @@ -26,7 +26,7 @@
  • {{$t('Process priority')}}:{{startupParam.processInstancePriority}}
  • {{$t('Worker group')}}:{{startupParam.workerGroup}}
  • {{$t('Notification strategy')}}:{{_rtWarningType(startupParam.warningType)}}
  • -
  • {{$t('Notification group')}}:{{_rtNotifyGroupName(startupParam.warningGroupId)}}
  • +
  • {{$t('Alarm group')}}:{{_rtNotifyGroupName(startupParam.warningGroupId)}}
  • diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue index d9acb38453..65510bf69b 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue @@ -42,7 +42,7 @@ methods: { ...mapMutations('dag', ['resetParams', 'setIsDetails']), ...mapActions('dag', ['getProcessList', 'getProjectList', 'getResourcesList', 'getProcessDetails', 'getResourcesListJar']), - ...mapActions('security', ['getTenantList', 'getWorkerGroupsAll']), + ...mapActions('security', ['getTenantList', 'getWorkerGroupsAll', 'getAlarmGroupsAll']), /** * init */ @@ -64,6 +64,8 @@ this.getResourcesListJar(), // get worker group list this.getWorkerGroupsAll(), + // get alarm group list + this.getAlarmGroupsAll(), this.getTenantList() ]).then((data) => { let item = data[0] diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/index.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/index.vue index d232e2dd86..81d129a47e 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/index.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/index.vue @@ -41,7 +41,7 @@ methods: { ...mapMutations('dag', ['resetParams']), ...mapActions('dag', ['getProcessList', 'getProjectList', 'getResourcesList', 'getResourcesListJar', 'getResourcesListJar']), - ...mapActions('security', ['getTenantList', 'getWorkerGroupsAll']), + ...mapActions('security', ['getTenantList', 'getWorkerGroupsAll', 'getAlarmGroupsAll']), /** * init */ @@ -63,6 +63,8 @@ this.getResourcesListJar(), // get worker group list this.getWorkerGroupsAll(), + // get alarm group list + this.getAlarmGroupsAll(), this.getTenantList() ]).then((data) => { this.isLoading = false diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue index 0727d12eed..f9561bd52c 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue @@ -44,7 +44,7 @@ methods: { ...mapMutations('dag', ['setIsDetails', 'resetParams']), ...mapActions('dag', ['getProcessList', 'getProjectList', 'getResourcesList', 'getInstancedetail', 'getResourcesListJar']), - ...mapActions('security', ['getTenantList', 'getWorkerGroupsAll']), + ...mapActions('security', ['getTenantList', 'getWorkerGroupsAll', 'getAlarmGroupsAll']), /** * init */ @@ -66,6 +66,8 @@ this.getResourcesListJar(), // get worker group list this.getWorkerGroupsAll(), + // get alarm group list + this.getAlarmGroupsAll(), this.getTenantList() ]).then((data) => { let item = data[0] 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 64c3f880b5..32612213ac 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 @@ -129,6 +129,7 @@ diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/start.vue b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/start.vue index e2ab711528..e9f615d340 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/start.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/start.vue @@ -78,15 +78,16 @@
    - {{$t('Notification group')}} + {{$t('Alarm group')}}
    - + @@ -263,7 +264,6 @@ }) }, _getGlobalParams () { - this.setIsDetails(true) this.store.dispatch('dag/getProcessDetails', this.startData.id).then(res => { this.definitionGlobalParams = _.cloneDeep(this.store.state.dag.globalParams) this.udpList = _.cloneDeep(this.store.state.dag.globalParams) diff --git a/dolphinscheduler-ui/src/js/conf/home/store/security/actions.js b/dolphinscheduler-ui/src/js/conf/home/store/security/actions.js index 9405d264a4..97df05d7bc 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/security/actions.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/security/actions.js @@ -600,6 +600,19 @@ export default { }) }) }, + /** + * get alarm groups all + */ + getAlarmGroupsAll ({ state }, payload) { + return new Promise((resolve, reject) => { + io.get('alert-group/list', payload, res => { + state.alarmGroupsListAll = res.data + resolve(res) + }).catch(e => { + reject(e) + }) + }) + }, saveWorkerGroups ({ state }, payload) { return new Promise((resolve, reject) => { io.post('worker-group/save', payload, res => { diff --git a/dolphinscheduler-ui/src/js/conf/home/store/security/state.js b/dolphinscheduler-ui/src/js/conf/home/store/security/state.js index f3533265a9..a959d9431f 100644 --- a/dolphinscheduler-ui/src/js/conf/home/store/security/state.js +++ b/dolphinscheduler-ui/src/js/conf/home/store/security/state.js @@ -16,5 +16,6 @@ */ export default { workerGroupsListAll: [], + alarmGroupsListAll: [], tenantAllList: [] } 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 168258a9f6..34145e7132 100755 --- a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js +++ b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js @@ -207,6 +207,8 @@ export default { 'UDF resources': 'UDF resources', 'UDF resources directory': 'UDF resources directory', 'Please select UDF resources directory': 'Please select UDF resources directory', + 'Alarm group': 'Alarm group', + 'Alarm group required': 'Alarm group required', 'Edit alarm group': 'Edit alarm group', 'Create alarm group': 'Create alarm group', 'Create Alarm Instance': 'Create Alarm Instance', 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 fb3bd3fb5b..7cafa9dec1 100755 --- a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js +++ b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js @@ -207,6 +207,8 @@ export default { 'UDF resources': 'UDF资源', 'UDF resources directory': 'UDF资源目录', 'Please select UDF resources directory': '请选择UDF资源目录', + 'Alarm group': '告警组', + 'Alarm group required': '告警组必填', 'Edit alarm group': '编辑告警组', 'Create alarm group': '创建告警组', 'Create Alarm Instance': '创建告警实例',