From e0d1d6f3ed2776caa87046c9349108cd7425737d Mon Sep 17 00:00:00 2001 From: baiqi Date: Tue, 5 Mar 2024 17:37:58 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=8E=A5=E5=8F=A3=E7=AE=A1=E7=90=86):=20?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=A2=9E=E5=88=A0=E6=94=B9=E6=9F=A5=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/ms-add-attachment/index.vue | 6 +-- frontend/src/models/apiTest/common.ts | 1 + .../views/api-test/components/apiStatus.vue | 6 +-- .../api-test/components/condition/content.vue | 13 ++--- .../api-test/components/condition/index.vue | 31 ++++++------ .../components/fastExtraction/index.vue | 11 +++-- .../components/fastExtraction/moreSetting.vue | 10 ++-- .../views/api-test/components/paramTable.vue | 4 +- .../views/api-test/components/popConfirm.vue | 16 +++--- .../components/requestComposition/body.vue | 22 ++++----- .../components/requestComposition/index.vue | 49 +++++++++++-------- .../requestComposition/postcondition.vue | 20 +++++--- .../requestComposition/precondition.vue | 24 ++++++--- .../requestComposition/response/edit.vue | 22 ++++----- .../components/requestComposition/setting.vue | 13 ++++- .../api-test/debug/components/moduleTree.vue | 7 +++ .../src/views/api-test/debug/locale/en-US.ts | 1 + .../src/views/api-test/debug/locale/zh-CN.ts | 1 + .../management/api/addDependencyDrawer.vue | 7 +++ .../components/management/api/apiTable.vue | 29 ++++++----- .../components/management/api/index.vue | 10 +++- .../components/management/index.vue | 2 + .../management/components/moduleTree.vue | 18 +++++-- .../src/views/api-test/management/index.vue | 14 +++++- 24 files changed, 213 insertions(+), 124 deletions(-) diff --git a/frontend/src/components/business/ms-add-attachment/index.vue b/frontend/src/components/business/ms-add-attachment/index.vue index f5f65efc2c..b7bd465b79 100644 --- a/frontend/src/components/business/ms-add-attachment/index.vue +++ b/frontend/src/components/business/ms-add-attachment/index.vue @@ -170,7 +170,6 @@ diff --git a/frontend/src/views/api-test/components/condition/content.vue b/frontend/src/views/api-test/components/condition/content.vue index 1ca58db84e..fd5341fcd5 100644 --- a/frontend/src/views/api-test/components/condition/content.vue +++ b/frontend/src/views/api-test/components/condition/content.vue @@ -244,7 +244,7 @@
@@ -649,7 +650,7 @@ if (!result){ const disabledExpressionSuffix = ref(false); function handleExtractParamTableChange(resultArr: any[], isInit?: boolean) { - condition.value.extractParams = [...resultArr]; + condition.value.extractors = [...resultArr]; if (!isInit) { emit('change'); } @@ -697,13 +698,13 @@ if (!result){ * 提取参数表格-应用更多设置 */ function applyMoreSetting(record: ExpressionConfig) { - condition.value.extractParams = condition.value.extractParams?.map((e) => { + condition.value.extractors = condition.value.extractors?.map((e) => { if (e.id === activeRecord.value.id) { record.moreSettingPopoverVisible = false; return { ...activeRecord.value, moreSettingPopoverVisible: false, - } as any; // TOOD: 这里的后台类型应该是不对的,需要修改 + }; } return e; }); @@ -714,7 +715,7 @@ if (!result){ * 提取参数表格-保存快速提取的配置 */ function handleFastExtractionApply(config: RegexExtract | JSONPathExtract | XPathExtract) { - condition.value.extractParams = condition.value.extractParams?.map((e) => { + condition.value.extractors = condition.value.extractors?.map((e) => { if (e.id === activeRecord.value.id) { return { ...e, @@ -726,7 +727,7 @@ if (!result){ fastExtractionVisible.value = false; nextTick(() => { extractParamsTableRef.value?.addTableLine( - condition.value.extractParams?.findIndex((e) => e.id === activeRecord.value.id) || 0 + condition.value.extractors?.findIndex((e) => e.id === activeRecord.value.id) || 0 ); }); emit('change'); diff --git a/frontend/src/views/api-test/components/condition/index.vue b/frontend/src/views/api-test/components/condition/index.vue index 20630886a3..07b965f3b5 100644 --- a/frontend/src/views/api-test/components/condition/index.vue +++ b/frontend/src/views/api-test/components/condition/index.vue @@ -120,20 +120,23 @@ }, }); break; - // case RequestConditionProcessor.SQL: - // data.value.push({ - // id, - // enableCommonScript: false, - // desc: '', - // enable: true, - // sqlSource: { - // scriptName: '', - // script: '', - // storageType: 'column', - // params: [], - // }, - // }); - // break; + case RequestConditionProcessor.SQL: + data.value.push({ + id, + processorType: RequestConditionProcessor.SQL, + enableCommonScript: false, + description: '', + enable: true, + dataSourceId: '', + environmentId: '', + queryTimeout: 0, + resultVariable: '', + script: '', + variableNames: '', + variables: [], + extractParams: [], + }); + break; case RequestConditionProcessor.TIME_WAITING: data.value.push({ id, diff --git a/frontend/src/views/api-test/components/fastExtraction/index.vue b/frontend/src/views/api-test/components/fastExtraction/index.vue index 7d9d306271..230306abf3 100644 --- a/frontend/src/views/api-test/components/fastExtraction/index.vue +++ b/frontend/src/views/api-test/components/fastExtraction/index.vue @@ -216,12 +216,13 @@ break; case RequestExtractExpressionEnum.JSON_PATH: try { - matchResult.value = JSONPath({ - json: props.response ? JSON.parse(props.response) : '', - path: expressionForm.value.expression, - }); + matchResult.value = + JSONPath({ + json: props.response ? JSON.parse(props.response) : '', + path: expressionForm.value.expression, + }) || []; } catch (error) { - matchResult.value = JSONPath({ json: props.response || '', path: expressionForm.value.expression }); + matchResult.value = JSONPath({ json: props.response || '', path: expressionForm.value.expression }) || []; } break; case RequestExtractExpressionEnum.REGEX: diff --git a/frontend/src/views/api-test/components/fastExtraction/moreSetting.vue b/frontend/src/views/api-test/components/fastExtraction/moreSetting.vue index 9c9eee1d22..2c71e8a3c9 100644 --- a/frontend/src/views/api-test/components/fastExtraction/moreSetting.vue +++ b/frontend/src/views/api-test/components/fastExtraction/moreSetting.vue @@ -5,7 +5,7 @@ {{ t('apiTestDebug.expressionMatchRule') }}
- +
{{ t('apiTestDebug.matchExpression') }} @@ -16,7 +16,7 @@
- +
{{ t('apiTestDebug.matchGroup') }} @@ -34,7 +34,7 @@ {{ t('apiTestDebug.resultMatchRule') }}
- +
{{ t('apiTestDebug.randomMatch') }} @@ -45,7 +45,7 @@
- +
{{ t('apiTestDebug.specifyMatch') }} @@ -56,7 +56,7 @@
- +
{{ t('apiTestDebug.allMatch') }} diff --git a/frontend/src/views/api-test/components/paramTable.vue b/frontend/src/views/api-test/components/paramTable.vue index 6b88012897..6bbbfe2f6f 100644 --- a/frontend/src/views/api-test/components/paramTable.vue +++ b/frontend/src/views/api-test/components/paramTable.vue @@ -111,9 +111,9 @@ @change="(val) => handleTypeChange(val, record, rowIndex, columnConfig.addLineDisabled)" /> -