|
|
@@ -9,7 +9,7 @@
|
|
|
</a-card>
|
|
|
|
|
|
<a-spin :spinning="spinning" >
|
|
|
- <a-card style="margin-top: 20px;" :title="'转发' + (index + 1)" v-for="(item, index) in forwardList" :key="item.id">
|
|
|
+ <a-card style="margin-top: 20px;" :title="'转发事件' + (index === 0 ? '一' : '二')" v-for="(item, index) in forwardList" :key="item.id">
|
|
|
<template #extra >
|
|
|
<a-space>
|
|
|
<a-popconfirm
|
|
|
@@ -20,17 +20,18 @@
|
|
|
>
|
|
|
<a-button >删除</a-button>
|
|
|
</a-popconfirm>
|
|
|
-
|
|
|
<a-button type="primary" @click="openRealViewDialog('update', item)">修改</a-button>
|
|
|
</a-space>
|
|
|
</template>
|
|
|
- <a-descriptions :title="'id: ' + item.id">
|
|
|
+ <a-descriptions :column="2" :title="'id: ' + item.id">
|
|
|
<a-descriptions-item label="创建时间">{{dayjs(item.createAt).format('YYYY/MM/DD HH:MM:ss')}}</a-descriptions-item>
|
|
|
<a-descriptions-item label="事件类型">{{item.forwardType}}</a-descriptions-item>
|
|
|
<a-descriptions-item label="Live">{{item.forwardConfig.defaultTimeout}}</a-descriptions-item>
|
|
|
<a-descriptions-item label="端点地址">{{item.forwardConfig.endpointUrl}}</a-descriptions-item>
|
|
|
<a-descriptions-item label="请求类型">{{item.forwardConfig.requestMethod}}</a-descriptions-item>
|
|
|
- <a-descriptions-item label="请求头">{{item.forwardConfig.requestHeaders ? item.forwardConfig.requestHeaders : '-' }}</a-descriptions-item>
|
|
|
+ <a-descriptions-item label="请求头参数" :span="3">
|
|
|
+ <a-table :pagination="false" :columns="[ { title: 'key', dataIndex: 'key' }, { title: 'value', dataIndex: 'value' }]" :data-source="Object.keys(item.forwardConfig.requestHeaders).map(key => ({key: key, value: item.forwardConfig.requestHeaders[key]})) " size="small" />
|
|
|
+ </a-descriptions-item>
|
|
|
</a-descriptions>
|
|
|
</a-card>
|
|
|
</a-spin>
|
|
|
@@ -72,6 +73,22 @@
|
|
|
<a-form-item label="默认时间" >
|
|
|
<a-input-number id="inputNumber" v-model:value="forwardState.forwardConfig.defaultTimeout" :min="1" />
|
|
|
</a-form-item>
|
|
|
+ <a-form-item label="请求头参数" >
|
|
|
+ <a-input-group style="margin-top: 10px;margin-bottom: 20px;" size="large" v-for="(item, index) in forwardState.forwardConfig.requestHeaders" :key="index">
|
|
|
+ <a-row :gutter="8">
|
|
|
+ <a-col :span="5">
|
|
|
+ <a-input allowClear style="height: 30px;" v-model:value="item.key" placeholder="key" />
|
|
|
+ </a-col>
|
|
|
+ <a-col :span="8">
|
|
|
+ <a-input allowClear style="height: 30px;" v-model:value="item.value" placeholder="value" />
|
|
|
+ </a-col>
|
|
|
+ <a-col>
|
|
|
+ <a-button type="link" danger @click="forwardState.forwardConfig.requestHeaders.splice(index, 1)" >删除</a-button>
|
|
|
+ </a-col>
|
|
|
+ </a-row>
|
|
|
+ </a-input-group >
|
|
|
+ <a-button @click="addRequestHeaders" type="primary" >添加参数</a-button>
|
|
|
+ </a-form-item>
|
|
|
</a-card>
|
|
|
</a-form>
|
|
|
|
|
|
@@ -102,7 +119,7 @@ const forwardState = reactive({
|
|
|
forwardType: 'HTTP', // HTTP 和KAFKA
|
|
|
endpointUrl: '',
|
|
|
requestMethod: 'GET',
|
|
|
- requestHeaders: {},
|
|
|
+ requestHeaders: [],
|
|
|
defaultTimeout: 10
|
|
|
}
|
|
|
})
|
|
|
@@ -111,6 +128,10 @@ const { resetFields, validate, validateInfos } = useForm(forwardState, {
|
|
|
endpointUrl: [{ required: true, message: '请填写端点地址' }]
|
|
|
})
|
|
|
|
|
|
+const addRequestHeaders = () => {
|
|
|
+ forwardState.forwardConfig.requestHeaders.push({ key: '', value: '' })
|
|
|
+}
|
|
|
+
|
|
|
const delforawrd = async (record: CVS.AiBox.Forward) => {
|
|
|
await AiboxController.delForward(record.id as unknown as string, record)
|
|
|
getAiBoxForward()
|
|
|
@@ -133,6 +154,12 @@ const openRealViewDialog = (type: 'add' | 'update', record = {}) => {
|
|
|
|
|
|
const ok = () => {
|
|
|
validate().then(async () => {
|
|
|
+ const requestHeaders = {}
|
|
|
+ forwardState.forwardConfig.requestHeaders.forEach(item => {
|
|
|
+ requestHeaders[item.key] = item.value
|
|
|
+ })
|
|
|
+
|
|
|
+ forwardState.forwardConfig.requestHeaders = requestHeaders
|
|
|
opraState.value === 'add' ? await AiboxController.addForward(forwardState as any) : await AiboxController.updateForward(forwardState as any)
|
|
|
visible.value = false
|
|
|
getAiBoxForward()
|