Browse Source

[Feature-3826]sql node adds alarm group field (#4602)

* [Feature-3826]sql node adds alarm group field
pull/3/MERGE
break60 4 years ago committed by GitHub
parent
commit
ef0def3108
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 76
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/_source/warningGroups.vue
  2. 80
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sql.vue
  3. 2
      dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/startingParam/index.vue
  4. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue
  5. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/index.vue
  6. 4
      dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue
  7. 1
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue
  8. 6
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/start.vue
  9. 13
      dolphinscheduler-ui/src/js/conf/home/store/security/actions.js
  10. 1
      dolphinscheduler-ui/src/js/conf/home/store/security/state.js
  11. 2
      dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
  12. 2
      dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js

76
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.
*/
<template>
<el-select
clearable
@change="_onChange"
v-model="selectedValue"
size="small"
style="width: 100%">
<el-option
v-for="item in alarmGroupsList"
:key="item.id"
:value="item.id"
:label="item.groupName">
</el-option>
</el-select>
</template>
<script>
import disabledState from '@/module/mixin/disabledState'
export default {
name: 'form-warning-group',
data () {
return {
selectedValue: this.value,
workerGroupsList: []
}
},
mixins: [disabledState],
props: {
value: {
type: Number,
default: null
}
},
model: {
prop: 'value',
event: 'warningGroupsEvent'
},
methods: {
_onChange (o) {
this.$emit('warningGroupsEvent', o)
}
},
watch: {
value (val) {
this.selectedValue = val
}
},
created () {
let stateAlarmGroupsList = this.store.state.security.alarmGroupsListAll || []
if (stateAlarmGroupsList.length) {
this.alarmGroupsList = stateAlarmGroupsList
} else {
this.store.dispatch('security/getAlarmGroupsAll').then(res => {
this.$nextTick(() => {
this.alarmGroupsList = res
})
})
}
}
}
</script>

80
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sql.vue

@ -30,16 +30,7 @@
<div slot="text">{{$t('SQL Type')}}</div> <div slot="text">{{$t('SQL Type')}}</div>
<div slot="content"> <div slot="content">
<div style="display: inline-block;"> <div style="display: inline-block;">
<m-sql-type <m-sql-type @on-sqlType="_onSqlType" :sql-type="sqlType"></m-sql-type>
@on-sqlType="_onSqlType"
:sql-type="sqlType">
</m-sql-type>
</div>
<div v-if="sqlType==0" style="display: inline-block;padding-left: 10px;margin-top: 2px;">
<el-checkbox-group v-model="showType" size="small">
<el-checkbox :label="'TABLE'" :disabled="isDetails">{{$t('TableMode')}}</el-checkbox>
<el-checkbox :label="'ATTACHMENT'" :disabled="isDetails">{{$t('Attachment')}}</el-checkbox>
</el-checkbox-group>
</div> </div>
</div> </div>
</m-list-box> </m-list-box>
@ -51,10 +42,17 @@
type="input" type="input"
size="small" size="small"
v-model="title" v-model="title"
:disabled="isDetails"
:placeholder="$t('Please enter the title of email')"> :placeholder="$t('Please enter the title of email')">
</el-input> </el-input>
</div> </div>
</m-list-box> </m-list-box>
<m-list-box>
<div slot="text"><strong class='requiredIcon'>*</strong>{{$t('Alarm group')}}</div>
<div slot="content">
<m-warning-groups v-model="groupId"></m-warning-groups>
</div>
</m-list-box>
</template> </template>
<m-list-box v-show="type === 'HIVE'"> <m-list-box v-show="type === 'HIVE'">
<div slot="text">{{$t('SQL Parameter')}}</div> <div slot="text">{{$t('SQL Parameter')}}</div>
@ -142,6 +140,7 @@
import mDatasource from './_source/datasource' import mDatasource from './_source/datasource'
import mLocalParams from './_source/localParams' import mLocalParams from './_source/localParams'
import mStatementList from './_source/statementList' import mStatementList from './_source/statementList'
import mWarningGroups from './_source/warningGroups'
import disabledState from '@/module/mixin/disabledState' import disabledState from '@/module/mixin/disabledState'
import codemirror from '@/conf/home/pages/resource/pages/file/pages/_source/codemirror' import codemirror from '@/conf/home/pages/resource/pages/file/pages/_source/codemirror'
@ -167,8 +166,6 @@
sqlType: '0', sqlType: '0',
// Email title // Email title
title: '', title: '',
// Form/attachment
showType: ['TABLE'],
// Sql parameter // Sql parameter
connParams: '', connParams: '',
// Pre statements // Pre statements
@ -176,7 +173,8 @@
// Post statements // Post statements
postStatements: [], postStatements: [],
item: '', item: '',
scriptBoxDialog: false scriptBoxDialog: false,
groupId: null
} }
}, },
mixins: [disabledState], mixins: [disabledState],
@ -197,9 +195,6 @@
*/ */
_onSqlType (a) { _onSqlType (a) {
this.sqlType = a this.sqlType = a
if (a === 0) {
this.showType = ['TABLE']
}
}, },
/** /**
* return udfs * return udfs
@ -245,16 +240,12 @@
if (!this.$refs.refDs._verifDatasource()) { if (!this.$refs.refDs._verifDatasource()) {
return false return false
} }
if (this.sqlType === 0 && !this.showType.length) { if (this.sqlType === '0' && !this.title) {
this.$message.warning(`${i18n.$t('One form or attachment must be selected')}`)
return false
}
if (this.sqlType === 0 && !this.title) {
this.$message.warning(`${i18n.$t('Mail subject required')}`) this.$message.warning(`${i18n.$t('Mail subject required')}`)
return false return false
} }
if (this.sqlType === 0 && !this.receivers.length) { if (this.sqlType === '0' && (this.groupId === '' || this.groupId === null)) {
this.$message.warning(`${i18n.$t('Recipient required')}`) this.$message.warning(`${i18n.$t('Alarm group required')}`)
return false return false
} }
// udfs Subcomponent verification Verification only if the data type is HIVE // udfs Subcomponent verification Verification only if the data type is HIVE
@ -287,18 +278,7 @@
udfs: this.udfs, udfs: this.udfs,
sqlType: this.sqlType, sqlType: this.sqlType,
title: this.title, title: this.title,
showType: (() => { groupId: this.groupId,
/**
* 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(',')
}
})(),
localParams: this.localParams, localParams: this.localParams,
connParams: this.connParams, connParams: this.connParams,
preStatements: this.preStatements, preStatements: this.preStatements,
@ -347,14 +327,7 @@
udfs: this.udfs, udfs: this.udfs,
sqlType: this.sqlType, sqlType: this.sqlType,
title: this.title, title: this.title,
showType: (() => { groupId: this.groupId,
let showType = this.showType
if (showType.length === 2 && showType[0] === 'ATTACHMENT') {
return [showType[1], showType[0]].join(',')
} else {
return showType.join(',')
}
})(),
localParams: this.localParams, localParams: this.localParams,
connParams: this.connParams, connParams: this.connParams,
preStatements: this.preStatements, preStatements: this.preStatements,
@ -372,11 +345,9 @@
watch: { watch: {
// Listening to sqlType // Listening to sqlType
sqlType (val) { sqlType (val) {
if (val === 0) {
this.showType = []
}
if (val !== 0) { if (val !== 0) {
this.title = '' this.title = ''
this.groupId = null
} }
}, },
// Listening data source // Listening data source
@ -403,14 +374,10 @@
this.sqlType = o.params.sqlType this.sqlType = o.params.sqlType
this.connParams = o.params.connParams || '' this.connParams = o.params.connParams || ''
this.localParams = o.params.localParams || [] this.localParams = o.params.localParams || []
if (o.params.showType === '') {
this.showType = []
} else {
this.showType = o.params.showType.split(',') || []
}
this.preStatements = o.params.preStatements || [] this.preStatements = o.params.preStatements || []
this.postStatements = o.params.postStatements || [] this.postStatements = o.params.postStatements || []
this.title = o.params.title || '' this.title = o.params.title || ''
this.groupId = o.params.groupId
} }
}, },
mounted () { mounted () {
@ -436,14 +403,7 @@
udfs: this.udfs, udfs: this.udfs,
sqlType: this.sqlType, sqlType: this.sqlType,
title: this.title, title: this.title,
showType: (() => { groupId: this.groupId,
let showType = this.showType
if (showType.length === 2 && showType[0] === 'ATTACHMENT') {
return [showType[1], showType[0]].join(',')
} else {
return showType.join(',')
}
})(),
localParams: this.localParams, localParams: this.localParams,
connParams: this.connParams, connParams: this.connParams,
preStatements: this.preStatements, preStatements: this.preStatements,
@ -451,6 +411,6 @@
} }
} }
}, },
components: { mListBox, mDatasource, mLocalParams, mUdfs, mSqlType, mStatementList, mScriptBox } components: { mListBox, mDatasource, mLocalParams, mUdfs, mSqlType, mStatementList, mScriptBox, mWarningGroups }
} }
</script> </script>

2
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/startingParam/index.vue

@ -26,7 +26,7 @@
<li><span class="tab">{{$t('Process priority')}}</span><span class="content">{{startupParam.processInstancePriority}}</span></li> <li><span class="tab">{{$t('Process priority')}}</span><span class="content">{{startupParam.processInstancePriority}}</span></li>
<li><span class="tab">{{$t('Worker group')}}</span><span class="content" v-if="workerGroupList.length">{{startupParam.workerGroup}}</span></li> <li><span class="tab">{{$t('Worker group')}}</span><span class="content" v-if="workerGroupList.length">{{startupParam.workerGroup}}</span></li>
<li><span class="tab">{{$t('Notification strategy')}}</span><span class="content">{{_rtWarningType(startupParam.warningType)}}</span></li> <li><span class="tab">{{$t('Notification strategy')}}</span><span class="content">{{_rtWarningType(startupParam.warningType)}}</span></li>
<li><span class="tab">{{$t('Notification group')}}</span><span class="content" v-if="notifyGroupList.length">{{_rtNotifyGroupName(startupParam.warningGroupId)}}</span></li> <li><span class="tab">{{$t('Alarm group')}}</span><span class="content" v-if="notifyGroupList.length">{{_rtNotifyGroupName(startupParam.warningGroupId)}}</span></li>
</ul> </ul>
</div> </div>
</template> </template>

4
dolphinscheduler-ui/src/js/conf/home/pages/dag/definitionDetails.vue

@ -42,7 +42,7 @@
methods: { methods: {
...mapMutations('dag', ['resetParams', 'setIsDetails']), ...mapMutations('dag', ['resetParams', 'setIsDetails']),
...mapActions('dag', ['getProcessList', 'getProjectList', 'getResourcesList', 'getProcessDetails', 'getResourcesListJar']), ...mapActions('dag', ['getProcessList', 'getProjectList', 'getResourcesList', 'getProcessDetails', 'getResourcesListJar']),
...mapActions('security', ['getTenantList', 'getWorkerGroupsAll']), ...mapActions('security', ['getTenantList', 'getWorkerGroupsAll', 'getAlarmGroupsAll']),
/** /**
* init * init
*/ */
@ -64,6 +64,8 @@
this.getResourcesListJar(), this.getResourcesListJar(),
// get worker group list // get worker group list
this.getWorkerGroupsAll(), this.getWorkerGroupsAll(),
// get alarm group list
this.getAlarmGroupsAll(),
this.getTenantList() this.getTenantList()
]).then((data) => { ]).then((data) => {
let item = data[0] let item = data[0]

4
dolphinscheduler-ui/src/js/conf/home/pages/dag/index.vue

@ -41,7 +41,7 @@
methods: { methods: {
...mapMutations('dag', ['resetParams']), ...mapMutations('dag', ['resetParams']),
...mapActions('dag', ['getProcessList', 'getProjectList', 'getResourcesList', 'getResourcesListJar', 'getResourcesListJar']), ...mapActions('dag', ['getProcessList', 'getProjectList', 'getResourcesList', 'getResourcesListJar', 'getResourcesListJar']),
...mapActions('security', ['getTenantList', 'getWorkerGroupsAll']), ...mapActions('security', ['getTenantList', 'getWorkerGroupsAll', 'getAlarmGroupsAll']),
/** /**
* init * init
*/ */
@ -63,6 +63,8 @@
this.getResourcesListJar(), this.getResourcesListJar(),
// get worker group list // get worker group list
this.getWorkerGroupsAll(), this.getWorkerGroupsAll(),
// get alarm group list
this.getAlarmGroupsAll(),
this.getTenantList() this.getTenantList()
]).then((data) => { ]).then((data) => {
this.isLoading = false this.isLoading = false

4
dolphinscheduler-ui/src/js/conf/home/pages/dag/instanceDetails.vue

@ -44,7 +44,7 @@
methods: { methods: {
...mapMutations('dag', ['setIsDetails', 'resetParams']), ...mapMutations('dag', ['setIsDetails', 'resetParams']),
...mapActions('dag', ['getProcessList', 'getProjectList', 'getResourcesList', 'getInstancedetail', 'getResourcesListJar']), ...mapActions('dag', ['getProcessList', 'getProjectList', 'getResourcesList', 'getInstancedetail', 'getResourcesListJar']),
...mapActions('security', ['getTenantList', 'getWorkerGroupsAll']), ...mapActions('security', ['getTenantList', 'getWorkerGroupsAll', 'getAlarmGroupsAll']),
/** /**
* init * init
*/ */
@ -66,6 +66,8 @@
this.getResourcesListJar(), this.getResourcesListJar(),
// get worker group list // get worker group list
this.getWorkerGroupsAll(), this.getWorkerGroupsAll(),
// get alarm group list
this.getAlarmGroupsAll(),
this.getTenantList() this.getTenantList()
]).then((data) => { ]).then((data) => {
let item = data[0] let item = data[0]

1
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/list.vue

@ -129,6 +129,7 @@
</el-drawer> </el-drawer>
<el-dialog <el-dialog
:title="$t('Please set the parameters before starting')" :title="$t('Please set the parameters before starting')"
v-if="startDialog"
:visible.sync="startDialog" :visible.sync="startDialog"
width="auto"> width="auto">
<m-start :startData= "startData" @onUpdateStart="onUpdateStart" @closeStart="closeStart"></m-start> <m-start :startData= "startData" @onUpdateStart="onUpdateStart" @closeStart="closeStart"></m-start>

6
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/start.vue

@ -78,15 +78,16 @@
</div> </div>
<div class="clearfix list"> <div class="clearfix list">
<div class="text"> <div class="text">
{{$t('Notification group')}} {{$t('Alarm group')}}
</div> </div>
<div class="cont"> <div class="cont">
<el-select <el-select
style="width: 200px;" style="width: 200px;"
clearable
size="small" size="small"
v-model="warningGroupId" v-model="warningGroupId"
:disabled="!notifyGroupList.length"> :disabled="!notifyGroupList.length">
<el-input slot="trigger" slot-scope="{ selectedModel }" readonly :placeholder="$t('Please select a notification group')" size="small" :value="selectedModel ? selectedModel.label : ''" style="width: 200px;" @on-click-icon.stop="warningGroupId = ''"> <el-input slot="trigger" slot-scope="{ selectedModel }" readonly size="small" :value="selectedModel ? selectedModel.label : ''" style="width: 200px;" @on-click-icon.stop="warningGroupId = ''">
<em slot="suffix" class="el-icon-error" style="font-size: 15px;cursor: pointer;" v-show="warningGroupId"></em> <em slot="suffix" class="el-icon-error" style="font-size: 15px;cursor: pointer;" v-show="warningGroupId"></em>
<em slot="suffix" class="el-icon-bottom" style="font-size: 12px;" v-show="!warningGroupId"></em> <em slot="suffix" class="el-icon-bottom" style="font-size: 12px;" v-show="!warningGroupId"></em>
</el-input> </el-input>
@ -263,7 +264,6 @@
}) })
}, },
_getGlobalParams () { _getGlobalParams () {
this.setIsDetails(true)
this.store.dispatch('dag/getProcessDetails', this.startData.id).then(res => { this.store.dispatch('dag/getProcessDetails', this.startData.id).then(res => {
this.definitionGlobalParams = _.cloneDeep(this.store.state.dag.globalParams) this.definitionGlobalParams = _.cloneDeep(this.store.state.dag.globalParams)
this.udpList = _.cloneDeep(this.store.state.dag.globalParams) this.udpList = _.cloneDeep(this.store.state.dag.globalParams)

13
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) { saveWorkerGroups ({ state }, payload) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
io.post('worker-group/save', payload, res => { io.post('worker-group/save', payload, res => {

1
dolphinscheduler-ui/src/js/conf/home/store/security/state.js

@ -16,5 +16,6 @@
*/ */
export default { export default {
workerGroupsListAll: [], workerGroupsListAll: [],
alarmGroupsListAll: [],
tenantAllList: [] tenantAllList: []
} }

2
dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js

@ -207,6 +207,8 @@ export default {
'UDF resources': 'UDF resources', 'UDF resources': 'UDF resources',
'UDF resources directory': 'UDF resources directory', 'UDF resources directory': 'UDF resources directory',
'Please select UDF resources directory': 'Please select 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', 'Edit alarm group': 'Edit alarm group',
'Create alarm group': 'Create alarm group', 'Create alarm group': 'Create alarm group',
'Create Alarm Instance': 'Create Alarm Instance', 'Create Alarm Instance': 'Create Alarm Instance',

2
dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js

@ -207,6 +207,8 @@ export default {
'UDF resources': 'UDF资源', 'UDF resources': 'UDF资源',
'UDF resources directory': 'UDF资源目录', 'UDF resources directory': 'UDF资源目录',
'Please select UDF resources directory': '请选择UDF资源目录', 'Please select UDF resources directory': '请选择UDF资源目录',
'Alarm group': '告警组',
'Alarm group required': '告警组必填',
'Edit alarm group': '编辑告警组', 'Edit alarm group': '编辑告警组',
'Create alarm group': '创建告警组', 'Create alarm group': '创建告警组',
'Create Alarm Instance': '创建告警实例', 'Create Alarm Instance': '创建告警实例',

Loading…
Cancel
Save