feature:动态配置标准接待你

This commit is contained in:
chao
2022-02-26 13:27:26 +08:00
parent e7c99e91c2
commit 961c727300
45 changed files with 19635 additions and 1400 deletions

3
.idea/dataSources.xml generated
View File

@@ -1,12 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="bomboo@localhost" uuid="19ee76cb-3424-4654-855f-f68454aff13a">
<data-source source="LOCAL" name="bomboo@localhost [2]" uuid="34cc04bf-c12f-4df1-b32b-daa25e19a58f">
<driver-ref>mysql.8</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
<jdbc-url>jdbc:mysql://localhost:3306/bomboo</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir>
<driver-properties>
<property name="serverTimezone" value="UTC" />
</driver-properties>

Binary file not shown.

View File

@@ -43,3 +43,28 @@ class NodeTemplateType:
EmptyTemplate = "0"
# 带内容的节点模板
ContentTemplate = "2"
a = [
{"key": "url", "type": "textarea", "label": "请求地址:"},
{"key": "method", "type": "select", "label": "请求类型:", "choices": [{"label": "GET", "value": "get"}]},
{"key": "header", "type": "dict_map", "label": "Header"},
{"key": "body", "type": "textarea", "label": "Body"},
{"key": "timeout", "type": "number", "label": "超时时间:"}
]
i = {
"url": "",
"method": "get",
"header": [
{
"key": "",
"value": ""
}],
"body": "{}",
"timeout": 60,
"check_point": {
"key": "",
"condition": "",
"values": ""
}
}

View File

@@ -0,0 +1,24 @@
# Generated by Django 2.2.6 on 2022-02-26 12:02
from django.db import migrations
import django_mysql.models
class Migration(migrations.Migration):
dependencies = [
('flow', '0003_auto_20220210_1737'),
]
operations = [
migrations.AddField(
model_name='nodetemplate',
name='inputs_component',
field=django_mysql.models.JSONField(default=list, verbose_name='前端参数组件'),
),
migrations.AddField(
model_name='nodetemplate',
name='outputs_component',
field=django_mysql.models.JSONField(default=list, verbose_name='前端参数组件'),
),
]

View File

@@ -102,3 +102,5 @@ class NodeRun(BaseNode):
class NodeTemplate(BaseNode):
template_type = models.CharField("节点模板类型", max_length=1, default=NodeTemplateType.ContentTemplate)
inputs_component = JSONField("前端参数组件", default=list)
outputs_component = JSONField("前端参数组件", default=list)

17927
web/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -743,22 +743,8 @@
}
},
node_data: {
inputs: {
url: '',
method: 'get',
header: [
{
key: '',
value: ''
}],
body: '{}',
timeout: 60,
check_point: {
key: '',
condition: '',
values: ''
}
},
inputs: e.target.dataset.inputs,
inputs_component: e.target.dataset.inputs_component,
run_mark: 0,
node_name: e.target.innerText,
description: '',
@@ -780,7 +766,7 @@
x,
y
}
console.log('model', model)
console.log('model', e.target.dataset)
if (model.endUuid !== '' && this.graph.findById(model.endUuid)) {
return this.$cwMessage('相同作业流已存在,不可重复添加', 'warning')
}

View File

@@ -43,31 +43,36 @@
</bk-form-item>
<bk-divider style="width: 540px;position: relative;right: 20px;border-color: #dcdee5;"></bk-divider>
<p class="title">输入参数</p>
<bk-form-item label="请求地址:">
<bk-input v-model="form.inputs.url" type="textarea" style="width: 350px;margin-right: 9px;" :disabled="disabled" :min="0"></bk-input>
</bk-form-item>
<bk-form-item label="请求类型:">
<bk-select :clearable="true" style="background-color: #fff;width: 130px;margin-right: 14px;" v-model="form.inputs.method" placeholder="请选择" :disabled="disabled">
<bk-option v-for="(item, index) in requestTypeList" :key="index" :id="item.value" :name="item.label">
</bk-option>
</bk-select>
</bk-form-item>
<bk-form-item label="Header:">
<div v-for="(item, index) in form.inputs.header" class="pre-commands" :key="index" style="margin-bottom: 12px;">
<bk-compose-form-item>
<bk-input v-model="item.key" type="text" style="width: 130px;margin-right: 9px;" :disabled="disabled" :min="0"></bk-input>
<bk-input v-model="item.value" type="text" style="width: 130px;margin-right: 9px;" :disabled="disabled" :min="0"></bk-input>
</bk-compose-form-item>
<i class="iconfont icon-changyongtubiao-chahao btn" style="margin-left: 8px;" @click="handleDeleteCommand(index)"
v-if="!disabled && form.inputs.header.length > 1"></i>
<i class="iconfont icon-changyongtubiao-jiahao btn" @click="handleAddCommand" v-if="!disabled"></i>
<bk-form-item v-for="(item,index) in form.inputs_component" :label="item.label" :key="index">
<div v-if="item.type === 'textarea'">
<bk-input v-model="form.inputs[item.key]" type="textarea" style="width: 350px;margin-right: 9px;" :disabled="disabled" :min="0"></bk-input>
</div>
<div v-else-if="item.type === 'select'">
<bk-select :clearable="true" style="background-color: #fff;width: 130px;margin-right: 14px;" v-model="form.inputs[item.key]" placeholder="请选择" :disabled="disabled">
<bk-option v-for="(item2, index2) in item.choices || []" :key="index2" :id="item2.value" :name="item2.label">
</bk-option>
</bk-select>
</div>
<div v-else-if="item.type === 'dict_map'">
<div v-for="(item3, index3) in form.inputs[item.key]" class="pre-commands" :key="index3" style="margin-bottom: 12px;">
<bk-compose-form-item>
<bk-input v-model="item3.key" type="text" style="width: 130px;margin-right: 9px;" :disabled="disabled" :min="0"></bk-input>
<bk-input v-model="item3.value" type="text" style="width: 130px;margin-right: 9px;" :disabled="disabled" :min="0"></bk-input>
</bk-compose-form-item>
<i class="iconfont icon-changyongtubiao-chahao btn" style="margin-left: 8px;" @click="handleDeleteCommand(index3)"
v-if="!disabled && form.inputs[item.key].length > 1"></i>
<i class="iconfont icon-changyongtubiao-jiahao btn" @click="handleAddCommand" v-if="!disabled"></i>
</div>
</div>
<div v-else-if="item.type === 'number'">
<bk-input v-model="form.inputs[item.key]" type="number" style="width: 350px;margin-right: 9px;" :disabled="disabled" :min="0"></bk-input>
</div>
<div v-else-if="item.type === 'text'">
<bk-input v-model="form.inputs[item.key]" type="text" style="width: 350px;margin-right: 9px;" :disabled="disabled" :min="0"></bk-input>
</div>
<div v-else>
<div style="color: red">ERROR:不支持的类型</div>
</div>
</bk-form-item>
<bk-form-item label="Body:">
<bk-input v-model="form.inputs.body" type="textarea" style="width: 350px;margin-right: 9px;" :disabled="disabled" :min="0"></bk-input>
</bk-form-item>
<bk-form-item label="超时时间:">
<bk-input v-model="form.inputs.timeout" type="number" style="width: 350px;margin-right: 9px;" :disabled="disabled" :min="0"></bk-input>
</bk-form-item>
<bk-divider style="width: 540px;position: relative;right: 20px;border-color: #dcdee5;"></bk-divider>
</bk-form>
@@ -242,7 +247,10 @@
}
},
created() {
console.log('222', this.nodeData)
this.form = this.nodeData.data
this.form.inputs = JSON.parse(this.form.inputs)
this.form.inputs_component = JSON.parse(this.form.inputs_component)
this.controlType = this.father_this.controlType
if (this.$route.query.type === 'detail') {
this.disabled = true

View File

@@ -21,7 +21,9 @@
</div>
<div class="select-node-box" v-bkloading="{ isLoading: jobListLoading, zIndex: 10 }">
<div v-for="(item, index) in jobList" :key="index" class="select-node" draggable="true" :title="item.name"
:data-nodetype="item.nodeType" :data-content="item.id" :data-icon="item.icon" :data-endUuid="item.endUuid">
:data-nodetype="item.nodeType" :data-content="item.id" :data-icon="item.icon" :data-endUuid="item.endUuid"
:data-inputs_component="JSON.stringify(item.inputs_component)"
:data-inputs="JSON.stringify(item.inputs)">
{{item.name}}
</div>
</div>