Implements the sql type task, now it can be cache the previous input. (#1745)

This commit is contained in:
zhukai 2020-01-07 21:59:50 +08:00 committed by dailidong
parent 4b027fbf02
commit 2087f464fb
4 changed files with 54 additions and 4 deletions

View File

@ -143,6 +143,7 @@
<m-sql <m-sql
v-if="taskType === 'SQL'" v-if="taskType === 'SQL'"
@on-params="_onParams" @on-params="_onParams"
@on-cache-params="_onCacheParams"
ref="SQL" ref="SQL"
:create-node-id="id" :create-node-id="id"
:backfill-item="backfillItem"> :backfill-item="backfillItem">

View File

@ -112,7 +112,20 @@
}) })
} }
}, },
watch: {}, computed: {
cacheParams () {
return {
type: this.type,
datasource: this.datasource
}
}
},
// Watch the cacheParams
watch: {
cacheParams (val) {
this.$emit('on-dsData', val);
}
},
created () { created () {
let supportType = this.supportType || [] let supportType = this.supportType || []
this.typeList = _.cloneDeep(this.store.state.dag.dsTypeListS) this.typeList = _.cloneDeep(this.store.state.dag.dsTypeListS)
@ -146,4 +159,4 @@
}, },
components: { } components: { }
} }
</script> </script>

View File

@ -371,6 +371,10 @@
this.connParams = '' this.connParams = ''
} }
}, },
//Watch the cacheParams
cacheParams (val) {
this.$emit('on-cache-params', val);
}
}, },
created () { created () {
let o = this.backfillItem let o = this.backfillItem
@ -396,7 +400,8 @@
this.receivers = o.params.receivers && o.params.receivers.split(',') || [] this.receivers = o.params.receivers && o.params.receivers.split(',') || []
this.receiversCc = o.params.receiversCc && o.params.receiversCc.split(',') || [] this.receiversCc = o.params.receiversCc && o.params.receiversCc.split(',') || []
} }
if (!_.some(this.store.state.dag.tasks, { id: this.createNodeId }) && // read tasks from cache
if (!_.some(this.store.state.dag.cacheTasks, { id: this.createNodeId }) &&
this.router.history.current.name !== 'definition-create') { this.router.history.current.name !== 'definition-create') {
this._getReceiver() this._getReceiver()
} }
@ -415,7 +420,33 @@
editor.off($('.code-sql-mirror'), 'keypress', this.keypress) editor.off($('.code-sql-mirror'), 'keypress', this.keypress)
} }
}, },
computed: {}, computed: {
cacheParams () {
return {
type: this.type,
datasource: this.rtDatasource,
sql: editor ? editor.getValue() : '',
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') {
return [showType[1], showType[0]].join(',')
} else {
return showType.join(',')
}
})(),
localParams: this.localParams,
connParams: this.connParams,
preStatements: this.preStatements,
postStatements: this.postStatements
}
}
},
components: { mListBox, mDatasource, mLocalParams, mUdfs, mSqlType, mStatementList, mEmail } components: { mListBox, mDatasource, mLocalParams, mUdfs, mSqlType, mStatementList, mEmail }
} }
</script> </script>

View File

@ -110,6 +110,11 @@ export default {
let processDefinitionJson = JSON.parse(res.data.processDefinitionJson) let processDefinitionJson = JSON.parse(res.data.processDefinitionJson)
// tasks info // tasks info
state.tasks = processDefinitionJson.tasks state.tasks = processDefinitionJson.tasks
// tasks cache
state.cacheTasks = {}
processDefinitionJson.tasks.forEach(v => {
state.cacheTasks[v.id] = v
})
// global params // global params
state.globalParams = processDefinitionJson.globalParams state.globalParams = processDefinitionJson.globalParams
// timeout // timeout