提交 ffdda00a 编写于 作者: B break60

[Feature-3826]sql node adds alarm group field

上级 4795a11e
/*
* 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>
......@@ -51,10 +51,17 @@
type="input"
size="small"
v-model="title"
:disabled="isDetails"
:placeholder="$t('Please enter the title of email')">
</el-input>
</div>
</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>
<m-list-box v-show="type === 'HIVE'">
<div slot="text">{{$t('SQL Parameter')}}</div>
......@@ -142,6 +149,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'
......@@ -176,7 +184,8 @@
// Post statements
postStatements: [],
item: '',
scriptBoxDialog: false
scriptBoxDialog: false,
groupId: null
}
},
mixins: [disabledState],
......@@ -245,16 +254,16 @@
if (!this.$refs.refDs._verifDatasource()) {
return false
}
if (this.sqlType === 0 && !this.showType.length) {
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,6 +296,7 @@
udfs: this.udfs,
sqlType: this.sqlType,
title: this.title,
groupId: this.groupId,
showType: (() => {
/**
* Special processing return order TABLE,ATTACHMENT
......@@ -347,6 +357,7 @@
udfs: this.udfs,
sqlType: this.sqlType,
title: this.title,
groupId: this.groupId,
showType: (() => {
let showType = this.showType
if (showType.length === 2 && showType[0] === 'ATTACHMENT') {
......@@ -377,6 +388,7 @@
}
if (val !== 0) {
this.title = ''
this.groupId = null
}
},
// Listening data source
......@@ -411,6 +423,7 @@
this.preStatements = o.params.preStatements || []
this.postStatements = o.params.postStatements || []
this.title = o.params.title || ''
this.groupId = o.params.groupId
}
},
mounted () {
......@@ -436,6 +449,7 @@
udfs: this.udfs,
sqlType: this.sqlType,
title: this.title,
groupId: this.groupId,
showType: (() => {
let showType = this.showType
if (showType.length === 2 && showType[0] === 'ATTACHMENT') {
......@@ -451,6 +465,6 @@
}
}
},
components: { mListBox, mDatasource, mLocalParams, mUdfs, mSqlType, mStatementList, mScriptBox }
components: { mListBox, mDatasource, mLocalParams, mUdfs, mSqlType, mStatementList, mScriptBox, mWarningGroups }
}
</script>
......@@ -26,7 +26,7 @@
<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('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>
</div>
</template>
......
......@@ -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]
......
......@@ -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
......
......@@ -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]
......
......@@ -129,6 +129,7 @@
</el-drawer>
<el-dialog
:title="$t('Please set the parameters before starting')"
v-if="startDialog"
:visible.sync="startDialog"
width="auto">
<m-start :startData= "startData" @onUpdateStart="onUpdateStart" @closeStart="closeStart"></m-start>
......
......@@ -78,15 +78,16 @@
</div>
<div class="clearfix list">
<div class="text">
{{$t('Notification group')}}
{{$t('Alarm group')}}
</div>
<div class="cont">
<el-select
style="width: 200px;"
clearable
size="small"
v-model="warningGroupId"
: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-bottom" style="font-size: 12px;" v-show="!warningGroupId"></em>
</el-input>
......@@ -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)
......
......@@ -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 => {
......
......@@ -16,5 +16,6 @@
*/
export default {
workerGroupsListAll: [],
alarmGroupsListAll: [],
tenantAllList: []
}
......@@ -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',
......
......@@ -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': '创建告警实例',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册