From 0418bf4ad4e9e7c5285ecdfa6374ab481eb9c680 Mon Sep 17 00:00:00 2001
From: scarqin <1054139596@qq.com>
Date: Wed, 3 Aug 2022 22:48:36 +0800
Subject: [PATCH] fix: url required
---
.../app/pages/api/edit/api-edit.service.ts | 4 +-
.../group/tree/api-group-tree.component.html | 10 +-
.../pages/api/test/api-test.component.html | 155 ++++++++++++------
.../pages/api/test/api-test.component.scss | 4 +-
.../app/pages/api/test/api-test.component.ts | 20 ++-
.../browser/src/assets/theme/antd.less | 2 +-
src/workbench/browser/tsconfig.json | 2 +-
7 files changed, 131 insertions(+), 66 deletions(-)
diff --git a/src/workbench/browser/src/app/pages/api/edit/api-edit.service.ts b/src/workbench/browser/src/app/pages/api/edit/api-edit.service.ts
index 45fdd06c1..461919d3a 100644
--- a/src/workbench/browser/src/app/pages/api/edit/api-edit.service.ts
+++ b/src/workbench/browser/src/app/pages/api/edit/api-edit.service.ts
@@ -149,6 +149,7 @@ export class ApiEditService {
modelKey: 'name',
placeholder: $localize`Param Name`,
mark: 'name',
+ width: 200,
},
{
thKey: $localize`Type`,
@@ -183,8 +184,7 @@ export class ApiEditService {
type: 'input',
modelKey: 'example',
placeholder: $localize`Param Example`,
- width: 200,
- hide: 1,
+ width: 100,
mark: 'example',
},
{
diff --git a/src/workbench/browser/src/app/pages/api/group/tree/api-group-tree.component.html b/src/workbench/browser/src/app/pages/api/group/tree/api-group-tree.component.html
index f08123475..4fcc2b345 100644
--- a/src/workbench/browser/src/app/pages/api/group/tree/api-group-tree.component.html
+++ b/src/workbench/browser/src/app/pages/api/group/tree/api-group-tree.component.html
@@ -8,14 +8,13 @@
-
-
-
+
-
+
-
+
@@ -109,13 +159,14 @@
-
+
-
-
+
diff --git a/src/workbench/browser/src/app/pages/api/test/api-test.component.scss b/src/workbench/browser/src/app/pages/api/test/api-test.component.scss
index 601a858bf..6db2fbabd 100644
--- a/src/workbench/browser/src/app/pages/api/test/api-test.component.scss
+++ b/src/workbench/browser/src/app/pages/api/test/api-test.component.scss
@@ -1,7 +1,9 @@
.ant-input-group.ant-input-group-compact {
display: flex;
}
-
+.ant-select {
+ height: 32px;
+}
.basic_info_container {
padding: 10px;
background-color: var(--MAIN_BG);
diff --git a/src/workbench/browser/src/app/pages/api/test/api-test.component.ts b/src/workbench/browser/src/app/pages/api/test/api-test.component.ts
index a1ef71d3a..f093457d7 100644
--- a/src/workbench/browser/src/app/pages/api/test/api-test.component.ts
+++ b/src/workbench/browser/src/app/pages/api/test/api-test.component.ts
@@ -101,6 +101,16 @@ export class ApiTestComponent implements OnInit, OnDestroy {
});
}
clickTest() {
+ //manual set dirty in case user submit directly without edit
+ for (const i in this.validateForm.controls) {
+ if (this.validateForm.controls.hasOwnProperty(i)) {
+ this.validateForm.controls[i].markAsDirty();
+ this.validateForm.controls[i].updateValueAndValidity();
+ }
+ }
+ if (this.validateForm.status === 'INVALID') {
+ return;
+ }
if (this.status === 'testing') {
this.abort();
return;
@@ -326,7 +336,7 @@ export class ApiTestComponent implements OnInit, OnDestroy {
uuid: 0,
requestBodyType: 'raw',
requestBodyJsonType: 'object',
- requestBody: [],
+ requestBody: '',
queryParams: [],
restParams: [],
requestHeaders: [
@@ -353,9 +363,13 @@ export class ApiTestComponent implements OnInit, OnDestroy {
private watchEnvChange() {
this.env$.pipe(takeUntil(this.destroy$)).subscribe((data) => {
const { env } = data;
- if (env) {
- this.env = env;
+ if (env?.uuid) {
+ this.validateForm.controls.uri.setValidators([]);
+ this.validateForm.controls.uri.updateValueAndValidity();
+ }else{
+ this.validateForm.controls.uri.setValidators([Validators.required]);
}
+ this.env = env;
});
}
private watchTabChange() {
diff --git a/src/workbench/browser/src/assets/theme/antd.less b/src/workbench/browser/src/assets/theme/antd.less
index 3d9eed61a..7b209e426 100644
--- a/src/workbench/browser/src/assets/theme/antd.less
+++ b/src/workbench/browser/src/assets/theme/antd.less
@@ -9,7 +9,7 @@
@border-radius-base: 3px;
@primary-color: @theme-color;
@success-color: @theme-color;
-@link-color:rgba (0, 0, 0, 0.8);
+@link-color:rgba(0, 0, 0, 0.8);
@processing-color: @theme-color;
@tree-title-height: 30px;
body {
diff --git a/src/workbench/browser/tsconfig.json b/src/workbench/browser/tsconfig.json
index a1b998778..c0794134f 100644
--- a/src/workbench/browser/tsconfig.json
+++ b/src/workbench/browser/tsconfig.json
@@ -8,7 +8,7 @@
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
- "emitDecoratorMetadata": false,
+ "emitDecoratorMetadata": true,
"experimentalDecorators": true,
"baseUrl": "../../../",
"paths": {