Plug-in front-end function

This commit is contained in:
break60 2021-01-11 18:26:59 +08:00
parent 5f6b3ea332
commit e94e323b08
13 changed files with 39 additions and 218 deletions

View File

@ -479,6 +479,7 @@ The text of each license is also included at licenses/ui-licenses/LICENSE-[proje
========================================
MIT licenses
========================================
@form-create/element-ui 1.0.18: https://github.com/xaboy/form-create MIT
axios 0.16.2: https://github.com/axios/axios MIT
bootstrap 3.3.7: https://github.com/twbs/bootstrap MIT
canvg 1.5.1: https://github.com/canvg/canvg MIT

View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 xaboy
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -13,6 +13,7 @@
"build:release": "npm run clean && cross-env NODE_ENV=production PUBLIC_PATH=/dolphinscheduler/ui webpack --config ./build/webpack.config.release.js"
},
"dependencies": {
"@form-create/element-ui": "^1.0.18",
"@riophae/vue-treeselect": "^0.4.0",
"axios": "^0.16.2",
"bootstrap": "3.3.7",

View File

@ -38,6 +38,7 @@ import 'bootstrap/dist/css/bootstrap.min.css'
import 'bootstrap/dist/js/bootstrap.min.js'
import 'canvg/dist/browser/canvg.min.js'
import 'remixicon/fonts/remixicon.css'
import formCreate from '@form-create/element-ui'
// Component internationalization
const useOpt = i18n.globalScope.LOCALE === 'en_US' ? { locale: locale } : {}
@ -45,8 +46,7 @@ const useOpt = i18n.globalScope.LOCALE === 'en_US' ? { locale: locale } : {}
i18n.globalScope.LOCALE === 'en_US' ? Vue.use(ElementUI, { locale }) : Vue.use(ElementUI)
// Vue.use(ans)
Vue.use(useOpt)
Vue.use(useOpt, formCreate)
sync(store, router)
Vue.config.devtools = true

View File

@ -55,18 +55,6 @@
</el-input>
</div>
</m-list-box>
<m-list-box>
<div slot="text"><strong class='requiredIcon'>*</strong>{{$t('Recipient')}}</div>
<div slot="content">
<m-email ref="refEmail" v-model="receivers" :disabled="isDetails" :repeat-data="receiversCc"></m-email>
</div>
</m-list-box>
<m-list-box>
<div slot="text">{{$t('Cc')}}</div>
<div slot="content">
<m-email ref="refCc" v-model="receiversCc" :disabled="isDetails" :repeat-data="receivers"></m-email>
</div>
</m-list-box>
</template>
<m-list-box v-show="type === 'HIVE'">
<div slot="text">{{$t('SQL Parameter')}}</div>
@ -155,7 +143,6 @@
import mLocalParams from './_source/localParams'
import mStatementList from './_source/statementList'
import disabledState from '@/module/mixin/disabledState'
import mEmail from '@/conf/home/pages/projects/pages/definition/pages/list/_source/email'
import codemirror from '@/conf/home/pages/resource/pages/file/pages/_source/codemirror'
let editor
@ -188,10 +175,6 @@
preStatements: [],
// Post statements
postStatements: [],
// recipients
receivers: [],
// copy to
receiversCc: [],
item: '',
scriptBoxDialog: false
}
@ -274,14 +257,6 @@
this.$message.warning(`${i18n.$t('Recipient required')}`)
return false
}
// receivers Subcomponent verification
if (this.sqlType === 0 && !this.$refs.refEmail._manualEmail()) {
return false
}
// receiversCc Subcomponent verification
if (this.sqlType === 0 && !this.$refs.refCc._manualEmail()) {
return false
}
// udfs Subcomponent verification Verification only if the data type is HIVE
if (this.type === 'HIVE') {
if (!this.$refs.refUdfs._verifUdfs()) {
@ -312,8 +287,6 @@
udfs: this.udfs,
sqlType: this.sqlType,
title: this.title,
receivers: this.receivers.join(','),
receiversCc: this.receiversCc.join(','),
showType: (() => {
/**
* Special processing return order TABLE,ATTACHMENT
@ -366,19 +339,6 @@
return editor
},
_getReceiver () {
let param = {}
let current = this.router.history.current
if (current.name === 'projects-definition-details') {
param.processDefinitionId = current.params.id
} else {
param.processInstanceId = current.params.id
}
this.store.dispatch('dag/getReceiver', param).then(res => {
this.receivers = res.receivers && res.receivers.split(',') || []
this.receiversCc = res.receiversCc && res.receiversCc.split(',') || []
})
},
_cacheParams () {
this.$emit('on-cache-params', {
type: this.type,
@ -387,8 +347,6 @@
udfs: this.udfs,
sqlType: this.sqlType,
title: this.title,
receivers: this.receivers.join(','),
receiversCc: this.receiversCc.join(','),
showType: (() => {
let showType = this.showType
if (showType.length === 2 && showType[0] === 'ATTACHMENT') {
@ -419,8 +377,6 @@
}
if (val !== 0) {
this.title = ''
this.receivers = []
this.receiversCc = []
}
},
// Listening data source
@ -455,13 +411,6 @@
this.preStatements = o.params.preStatements || []
this.postStatements = o.params.postStatements || []
this.title = o.params.title || ''
this.receivers = o.params.receivers && o.params.receivers.split(',') || []
this.receiversCc = o.params.receiversCc && o.params.receiversCc.split(',') || []
}
// read tasks from cache
if (!_.some(this.store.state.dag.cacheTasks, { id: this.createNodeId }) &&
this.router.history.current.name !== 'definition-create') {
this._getReceiver()
}
},
mounted () {
@ -487,8 +436,6 @@
udfs: this.udfs,
sqlType: this.sqlType,
title: this.title,
receivers: this.receivers.join(','),
receiversCc: this.receiversCc.join(','),
showType: (() => {
let showType = this.showType
if (showType.length === 2 && showType[0] === 'ATTACHMENT') {
@ -504,6 +451,6 @@
}
}
},
components: { mListBox, mDatasource, mLocalParams, mUdfs, mSqlType, mStatementList, mEmail, mScriptBox }
components: { mListBox, mDatasource, mLocalParams, mUdfs, mSqlType, mStatementList, mScriptBox }
}
</script>

View File

@ -1175,8 +1175,6 @@
}
if (val !== 0) {
this.title = ''
this.receivers = []
this.receiversCc = []
}
},
// Listening data source

View File

@ -27,8 +27,6 @@
<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('Recipient')}}</span><span class="content">{{startupParam.receivers || '-'}}</span></li>
<li><span class="tab">{{$t('Cc')}}</span><span class="content">{{startupParam.receiversCc || '-'}}</span></li>
</ul>
</div>
</template>

View File

@ -177,8 +177,6 @@
timingDialog: false,
timingData: {
item: {},
receiversD: [],
receiversCcD: [],
type: ''
},
relatedItemsDialog: false,
@ -191,7 +189,7 @@
pageSize: Number
},
methods: {
...mapActions('dag', ['editProcessState', 'getStartCheck', 'getReceiver', 'deleteDefinition', 'batchDeleteDefinition', 'exportDefinition', 'getProcessDefinitionVersionsPage', 'copyProcess', 'switchProcessDefinitionVersion', 'deleteProcessDefinitionVersion', 'moveProcess']),
...mapActions('dag', ['editProcessState', 'getStartCheck', 'deleteDefinition', 'batchDeleteDefinition', 'exportDefinition', 'getProcessDefinitionVersionsPage', 'copyProcess', 'switchProcessDefinitionVersion', 'deleteProcessDefinitionVersion', 'moveProcess']),
...mapActions('security', ['getWorkerGroupsAll']),
selectable (row, index) {
@ -226,30 +224,13 @@
closeStart () {
this.startDialog = false
},
/**
* get emial
*/
_getReceiver (id) {
return new Promise((resolve, reject) => {
this.getReceiver({ processDefinitionId: id }).then(res => {
resolve({
receivers: res.receivers && res.receivers.split(',') || [],
receiversCc: res.receiversCc && res.receiversCc.split(',') || []
})
})
})
},
/**
* timing
*/
_timing (item) {
this._getReceiver(item.id).then(res => {
this.timingData.item = item
this.timingData.receiversD = res.receivers
this.timingData.receiversCcD = res.receiversCc
this.timingData.type = 'timing'
this.timingDialog = true
})
this.timingData.item = item
this.timingData.type = 'timing'
this.timingDialog = true
},
onUpdateTiming () {
this._onUpdate()

View File

@ -99,22 +99,6 @@
</el-select>
</div>
</div>
<div class="clearfix list">
<div class="text">
{{$t('Recipient')}}
</div>
<div class="cont" style="width: 688px;">
<m-email v-model="receivers" :repeat-data="receiversCc"></m-email>
</div>
</div>
<div class="clearfix list">
<div class="text">
{{$t('Cc')}}
</div>
<div class="cont" style="width: 688px;">
<m-email v-model="receiversCc" :repeat-data="receivers"></m-email>
</div>
</div>
<div class="clearfix list">
<div class="text">
{{$t('Complement Data')}}
@ -164,7 +148,6 @@
</template>
<script>
import dayjs from 'dayjs'
import mEmail from './email.vue'
import store from '@/conf/home/store'
import { warningTypeList } from './util'
import mPriority from '@/module/components/priority/priority'
@ -186,8 +169,6 @@
spinnerLoading: false,
execType: false,
taskDependType: 'TASK_POST',
receivers: [],
receiversCc: [],
runMode: 'RUN_MODE_SERIAL',
processInstancePriority: 'MEDIUM',
workerGroup: 'default'
@ -219,8 +200,6 @@
taskDependType: this.taskDependType,
runMode: this.runMode,
processInstancePriority: this.processInstancePriority,
receivers: this.receivers.join(',') || '',
receiversCc: this.receiversCc.join(',') || '',
workerGroup: this.workerGroup
}
// Executed from the specified node
@ -247,12 +226,6 @@
})
})
},
_getReceiver () {
this.store.dispatch('dag/getReceiver', { processDefinitionId: this.startData.id }).then(res => {
this.receivers = res.receivers && res.receivers.split(',') || []
this.receiversCc = res.receiversCc && res.receiversCc.split(',') || []
})
},
ok () {
this._start()
},
@ -268,8 +241,6 @@
created () {
this.warningType = this.warningTypeList[0].id
this.workflowName = this.startData.name
this._getReceiver()
let stateWorkerGroupsList = this.store.state.security.workerGroupsListAll || []
if (stateWorkerGroupsList.length) {
this.workerGroup = stateWorkerGroupsList[0].id
@ -292,7 +263,7 @@
this.workflowName = this.startData.name
},
computed: {},
components: { mEmail, mPriority, mWorkerGroups }
components: { mPriority, mWorkerGroups }
}
</script>

View File

@ -136,22 +136,6 @@
</el-select>
</div>
</div>
<div class="clearfix list">
<div class="text">
{{$t('Recipient')}}
</div>
<div class="cont" style="width: 680px;">
<m-email v-model="receivers" :repeat-data="receiversCc"></m-email>
</div>
</div>
<div class="clearfix list">
<div class="text">
{{$t('Cc')}}
</div>
<div class="cont" style="width: 680px;">
<m-email v-model="receiversCc" :repeat-data="receivers"></m-email>
</div>
</div>
<div class="submit">
<el-button type="text" size="small" @click="close()"> {{$t('Cancel')}} </el-button>
<el-button type="primary" size="small" round :loading="spinnerLoading" @click="ok()">{{spinnerLoading ? 'Loading...' : (timingData.item.crontab ? $t('Edit') : $t('Create'))}} </el-button>
@ -159,9 +143,7 @@
</div>
</template>
<script>
import _ from 'lodash'
import i18n from '@/module/i18n'
import mEmail from './email.vue'
import store from '@/conf/home/store'
import { warningTypeList } from './util'
import { vCrontab } from '@/module/components/crontab/index'
@ -184,8 +166,6 @@
scheduleTime: '',
crontab: '0 0 * * * ? *',
cronPopover: false,
receivers: [],
receiversCc: [],
i18n: i18n.globalScope.LOCALE,
processInstancePriority: 'MEDIUM',
workerGroup: '',
@ -229,8 +209,6 @@
warningType: this.warningType,
processInstancePriority: this.processInstancePriority,
warningGroupId: this.warningGroupId === '' ? 0 : this.warningGroupId,
receivers: this.receivers.join(',') || '',
receiversCc: this.receiversCc.join(',') || '',
workerGroup: this.workerGroup
}
let msg = ''
@ -337,8 +315,6 @@
this.crontab = '0 0 * * * ? *'
this.scheduleTime = times
}
this.receivers = _.cloneDeep(this.timingData.receiversD)
this.receiversCc = _.cloneDeep(this.timingData.receiversCcD)
},
mounted () {
let item = this.timingData.item
@ -363,7 +339,7 @@
}).catch(() => { this.warningGroupId = '' })
}
},
components: { vCrontab, mEmail, mPriority, mWorkerGroups }
components: { vCrontab, mPriority, mWorkerGroups }
}
</script>

View File

@ -124,16 +124,14 @@
list: [],
timingDialog: false,
timingData: {
item: {},
receiversD: [],
receiversCcD: []
item: {}
}
}
},
props: {
},
methods: {
...mapActions('dag', ['getScheduleList', 'scheduleOffline', 'scheduleOnline', 'getReceiver', 'deleteTiming']),
...mapActions('dag', ['getScheduleList', 'scheduleOffline', 'scheduleOnline', 'deleteTiming']),
/**
* delete
*/
@ -228,29 +226,12 @@
this.$message.error(e.msg || '')
})
},
/**
* get email
*/
_getReceiver (id) {
return new Promise((resolve, reject) => {
this.getReceiver({ processDefinitionId: id }).then(res => {
resolve({
receivers: res.receivers && res.receivers.split(',') || [],
receiversCc: res.receiversCc && res.receiversCc.split(',') || []
})
})
})
},
/**
* timing
*/
_editTiming (item) {
this._getReceiver(item.processDefinitionId).then(res => {
this.timingData.item = item
this.timingData.receiversD = res.receivers
this.timingData.receiversCcD = res.receiversCc
this.timingDialog = true
})
this.timingData.item = item
this.timingDialog = true
},
onUpdateTiming () {
this.pageNo = 1

View File

@ -38,9 +38,6 @@
</el-table-column>
<el-table-column :label="$t('Operation')" width="130">
<template slot-scope="scope">
<el-tooltip :content="$t('Managing Users')" placement="top">
<el-button type="primary" size="mini" icon="el-icon-user" @click="_mangeUser(scope.row, scope.$index)" circle></el-button>
</el-tooltip>
<el-tooltip :content="$t('Edit')" placement="top">
<span><el-button type="primary" size="mini" icon="el-icon-edit-outline" @click="_edit(scope.row)" circle></el-button></span>
</el-tooltip>
@ -60,18 +57,10 @@
</el-table-column>
</el-table>
</div>
<el-dialog
:visible.sync="transferDialog"
width="auto">
<m-transfer :transferData="transferData" @onUpdate="onUpdate" @close="close"></m-transfer>
</el-dialog>
</div>
</template>
<script>
import _ from 'lodash'
import i18n from '@/module/i18n'
import { mapActions } from 'vuex'
import mTransfer from '@/module/components/transfer/transfer'
export default {
name: 'user-list',
@ -79,14 +68,7 @@
return {
list: [],
transferDialog: false,
item: {},
transferData: {
sourceListPrs: [],
targetListPrs: [],
type: {
name: `${i18n.$t('Managing Users')}`
}
}
item: {}
}
},
props: {
@ -95,7 +77,7 @@
pageSize: Number
},
methods: {
...mapActions('security', ['deleteAlertgrou', 'getAuthList', 'grantAuthorization']),
...mapActions('security', ['deleteAlertgrou', 'grantAuthorization']),
_delete (item, i) {
this.deleteAlertgrou({
id: item.id
@ -109,30 +91,6 @@
_edit (item) {
this.$emit('on-edit', item)
},
_mangeUser (item, i) {
this.getAuthList({
id: item.id,
type: 'user',
category: 'users'
}).then(data => {
let sourceListPrs = _.map(data[0], v => {
return {
id: v.id,
name: v.userName
}
})
let targetListPrs = _.map(data[1], v => {
return {
id: v.id,
name: v.userName
}
})
this.item = item
this.transferData.sourceListPrs = sourceListPrs
this.transferData.targetListPrs = targetListPrs
this.transferDialog = true
})
},
onUpdate (userIds) {
this._grantAuthorization('alert-group/grant-user', {
userIds: userIds,
@ -168,6 +126,6 @@
},
mounted () {
},
components: { mTransfer }
components: {}
}
</script>

View File

@ -806,18 +806,6 @@ export default {
})
})
},
/**
* Get the mailbox list interface
*/
getReceiver ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectName}/executors/get-receiver-cc`, payload, res => {
resolve(res.data)
}).catch(e => {
reject(e)
})
})
},
getTaskListDefIdAll ({ state }, payload) {
return new Promise((resolve, reject) => {
io.get(`projects/${state.projectName}/process/get-task-list`, payload, res => {