Skip to content

Commit

Permalink
add JDBC Node
Browse files Browse the repository at this point in the history
  • Loading branch information
zwx-master committed Jan 10, 2020
1 parent 6e2bd33 commit 851ef38
Show file tree
Hide file tree
Showing 9 changed files with 77 additions and 5 deletions.
14 changes: 13 additions & 1 deletion web/src/js/module/process/component/nodeparameter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,18 @@ export default {
}
};
return {
'jdbcUrl': [
{ required: true, message: 'joburl为必填项', trigger: 'blur' },
{ type: 'string', pattern: /(jdbc)[a-zA-Z0-9_:./]/, message: '必须以jdbc开头,且只支持数字、字母、(_:./)', trigger: 'blur' },
],
'jdbcUsername': [
{ required: true, message: 'username为必填项', trigger: 'blur' },
{ type: 'string', pattern: /^[^\u4e00-\u9fa5]+$/, message: '此值不支持中文', trigger: 'blur' },
],
'jdbcPassword': [
{ required: true, message: 'password为必填项', trigger: 'blur' },
{ type: 'string', pattern: /^[^\u4e00-\u9fa5]+$/, message: '此值不支持中文', trigger: 'blur' },
],
'sourceType': [
{ required: true, message: this.$t('message.process.nodeParameter.XZSJLY'), trigger: 'blur' },
{ type: 'string', pattern: /^[^\u4e00-\u9fa5]+$/, message: this.$t('message.process.nodeParameter.CZBNSRZW'), trigger: 'change' },
Expand Down Expand Up @@ -612,7 +624,7 @@ export default {
if (this.currentNode.jobContent && this.currentNode.jobContent.jobParams) {
this.currentNode.params.configuration.runtime = JSON.parse(JSON.stringify(this.currentNode.jobContent.jobParams));
}
if ([NODETYPE.EVENTCHECKERF, NODETYPE.EVENTCHECKERW, NODETYPE.DATACHECKER].includes(this.currentNode.type)) {
if ([NODETYPE.EVENTCHECKERF, NODETYPE.EVENTCHECKERW, NODETYPE.DATACHECKER, NODETYPE.JDBC].includes(this.currentNode.type)) {
Object.keys(this.currentNode.params.configuration.runtime).map((key) => {
this.currentNode.params.configuration.runtime[this.transtionKey(key)] = String(this.currentNode.params.configuration.runtime[key]);
delete this.currentNode.params.configuration.runtime[key];
Expand Down
1 change: 1 addition & 0 deletions web/src/js/module/process/images/newIcon/JDBC.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions web/src/js/module/process/images/newIcon/JDBC2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion web/src/js/module/process/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export default {
}
}
}
if ([NODETYPE.SPARKSQL, NODETYPE.HQL, NODETYPE.SPARKPY, NODETYPE.SHELL, NODETYPE.SCALA, NODETYPE.PYTHON].indexOf(node.type) !== -1) {
if ([NODETYPE.SPARKSQL, NODETYPE.HQL, NODETYPE.SPARKPY, NODETYPE.SHELL, NODETYPE.SCALA, NODETYPE.PYTHON, NODETYPE.JDBC].indexOf(node.type) !== -1) {
const len = node.resources ? node.resources.length : 0;
if (len && node.jobContent && node.jobContent.script) { // 判断是否有保存过脚本
const resourceId = node.resources[0].resourceId;
Expand Down
18 changes: 17 additions & 1 deletion web/src/js/module/process/module.vue
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ export default {
}
if (!this.workflowIsExecutor) {
if (type === 'node') {
if ([NODETYPE.SPARKSQL, NODETYPE.HQL, NODETYPE.SPARKPY, NODETYPE.SCALA].includes(node.type)) {
if ([NODETYPE.SPARKSQL, NODETYPE.HQL, NODETYPE.SPARKPY, NODETYPE.SCALA, NODETYPE.JDBC].includes(node.type)) {
arr.push({
text: this.$t('message.process.associate'),
value: 'associate',
Expand Down Expand Up @@ -908,6 +908,22 @@ export default {
'executeUser': ''
},
});
} else if (this.clickCurrentNode.type === NODETYPE.JDBC) {
if (this.clickCurrentNode.jobContent) {
this.$set(this.clickCurrentNode.jobContent, 'jobParams', {
'jdbcUrl': '',
'jdbcUsername': '',
'jdbcPassword': ''
});
} else {
this.$set(this.clickCurrentNode, 'jobContent', {
jobParams: {
'jdbcUrl': '',
'jdbcUsername': '',
'jdbcPassword': ''
},
});
}
}
}
// 节点参数位置发生改变,先定义一个新的configuration用来存储数据,后面把jobparams干掉
Expand Down
7 changes: 7 additions & 0 deletions web/src/js/module/process/shape.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ export default [
image: NODEICON[NODETYPE.PYTHON].icon,
editParam: false,
editBaseInfo: false,
},
{
type: NODETYPE.JDBC,
title: 'jdbc',
image: NODEICON[NODETYPE.JDBC].icon,
editParam: false,
editBaseInfo: false,
}],
},
{
Expand Down
28 changes: 28 additions & 0 deletions web/src/js/module/setting/setting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ export default {
}, {
name: 'IDE-pipeline',
title: 'PipeLine',
},
{
name: 'IDE-jdbc',
title: 'Jdbc',
}],
}, {
name: '3',
Expand All @@ -89,6 +93,26 @@ export default {
name: 'visualis-spark',
title: 'Spark',
}],
},
{
name: '4',
title: '工作流',
icon: 'md-analytics',
children: [{
name: 'nodeexecution-spark',
title: 'Spark',
}, {
name: 'nodeexecution-hive',
title: 'Hive',
},
{
name: 'nodeexecution-python',
title: 'Python',
},
{
name: 'nodeexecution-jdbc',
title: 'Jdbc',
}],
}],
activeMenu: '',
fullTree: [],
Expand All @@ -110,6 +134,7 @@ export default {
this.activeMenu = type;
const IDE = 'IDE';
const VSBI = 'visualis';
const NODEECECUTION = 'nodeexecution';
let appName = '通用设置';
let creator = '通用设置';
if (type.match(IDE)) {
Expand All @@ -118,6 +143,9 @@ export default {
} else if (type.match(VSBI)) {
creator = VSBI;
appName = type.slice(VSBI.length + 1, type.length);
} else if (type.match(NODEECECUTION)) {
creator = NODEECECUTION;
appName = type.slice(NODEECECUTION.length + 1, type.length);
}
api.fetch('/configuration/getFullTreesByAppName', {
appName,
Expand Down
2 changes: 1 addition & 1 deletion web/src/js/service/mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default {
{ rule: /\.(out)$/i, lang: 'hql', executable: true, application: 'pipeline', runType: 'pipeline', ext: '.out', scriptType: 'storage', abbr: 'stor', logo: 'fi-storage', isCanBeNew: true, label: 'Storage', isCanBeOpen: true },
{ rule: /\.scala$/i, lang: 'java', executable: true, application: 'spark', runType: 'scala', ext: '.scala', scriptType: 'scala', abbr: 'scala', logo: 'fi-scala', isCanBeNew: true, label: 'Scala', isCanBeOpen: true, flowType: 'scala' },
{ rule: /\.scala$/i, lang: 'java', executable: true, application: 'spark', runType: 'function.mdq', ext: '.scala', scriptType: 'scala', abbr: 'scala', logo: 'fi-scala', isCanBeNew: false, label: 'Scala', isCanBeOpen: true },
{ rule: /\.jdbc$/i, lang: 'hql', executable: true, application: 'jdbc', runType: 'jdbc', ext: '.jdbc', scriptType: 'jdbc', abbr: 'jdbc', logo: 'fi-jdbc', isCanBeNew: true, label: 'JDBC', isCanBeOpen: true },
{ rule: /\.jdbc$/i, lang: 'hql', executable: true, application: 'jdbc', runType: 'jdbc', ext: '.jdbc', scriptType: 'jdbc', abbr: 'jdbc', logo: 'fi-jdbc', isCanBeNew: true, label: 'JDBC', isCanBeOpen: true, flowType: 'jdbc' },
{ rule: /\.python$/i, lang: 'python', executable: true, application: 'python', runType: 'python', ext: '.python', scriptType: 'python', abbr: 'py', logo: 'fi-python', isCanBeNew: true, label: 'Python', isCanBeOpen: true, flowType: 'python' },
{ rule: /\.py$/i, lang: 'python', executable: true, application: 'spark', runType: 'python', ext: '.py', scriptType: 'pythonSpark', abbr: 'py', logo: 'fi-spark-python', isCanBeNew: true, label: 'PythonSpark', isCanBeOpen: true, flowType: 'pyspark' },
{ rule: /\.r$/i, lang: 'r', executable: true, application: 'spark', runType: 'r', ext: '.r', scriptType: 'r', abbr: 'r', logo: 'fi-r', isCanBeNew: true, label: 'R', isCanBeOpen: true },
Expand Down
9 changes: 8 additions & 1 deletion web/src/js/service/nodeType.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ import scala from '../module/process/images/scala.svg';
import exchange from '../module/process/images/newIcon/exchange.svg';
import qualitis from '../module/process/images/newIcon/qualitis.svg';
import python from '../module/process/images/newIcon/python.svg';
import jdbc from '../module/process/images/newIcon/JDBC2.svg';
const NODETYPE = {
SHELL: 'azkaban.shell',
HQL: 'linkis.hive.hql',
SPARKSQL: 'linkis.spark.sql',
SPARKPY: 'linkis.spark.py',
SCALA: 'linkis.spark.scala',
JDBC: 'linkis.jdbc.jdbc',
PYTHON: 'linkis.python.python',
CONNECTOR: 'linkis.control.empty',
DISPLAY: 'linkis.appjoint.visualis.display',
Expand All @@ -57,9 +59,14 @@ const ext = {
[NODETYPE.SPARKSQL]: 'sparksql',
[NODETYPE.SPARKPY]: 'pyspark',
[NODETYPE.SCALA]: 'scala',
[NODETYPE.PYTHON]: 'python'
[NODETYPE.PYTHON]: 'python',
[NODETYPE.JDBC]: 'jdbc'
}
const NODEICON = {
[NODETYPE.JDBC]: {
icon: jdbc,
class: {'jdbc': true}
},
[NODETYPE.SHELL]: {
icon: shell,
class: {'shell': true}
Expand Down

0 comments on commit 851ef38

Please sign in to comment.