From 4b12fe4f281944a7df310db8e59d48533055009f Mon Sep 17 00:00:00 2001 From: bqy_fe <1743369777@qq.com> Date: Fri, 27 May 2022 18:59:43 +0800 Subject: [PATCH] fix: some bug & adjust some css style (#52) * fix: some bug * update code --- .gitignore | 3 +- src/workbench/browser/package.json | 3 + .../pages/api/edit/api-edit.component.html | 65 ++++++------------- .../app/pages/api/edit/api-edit.component.ts | 20 +++++- .../edit/body/api-edit-body.component.html | 36 +++------- .../api/edit/body/api-edit-body.component.ts | 4 ++ .../group/tree/api-group-tree.component.html | 52 ++++----------- .../group/tree/api-group-tree.component.scss | 8 ++- .../app/pages/api/tab/api-tab.component.ts | 3 +- .../params-import/params-import.component.ts | 8 ++- src/workbench/browser/src/styles.scss | 5 ++ src/workbench/browser/tailwind.config.js | 7 ++ 12 files changed, 99 insertions(+), 115 deletions(-) create mode 100644 src/workbench/browser/tailwind.config.js diff --git a/.gitignore b/.gitignore index 80a344836..7e3ac95aa 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ dist/ !src/core/market/browser/dist/icon.png !src/workbench/node/request/**/*.js !/api/*.js +!*.config.js scripts/notarize.js # dependencies @@ -46,4 +47,4 @@ testem.log # System Files .DS_Store Thumbs.db -# *-lock.json \ No newline at end of file +# *-lock.json diff --git a/src/workbench/browser/package.json b/src/workbench/browser/package.json index d7e7d8017..933ecd1ad 100644 --- a/src/workbench/browser/package.json +++ b/src/workbench/browser/package.json @@ -59,6 +59,7 @@ "@types/node": "17.0.32", "@typescript-eslint/eslint-plugin": "5.23.0", "@typescript-eslint/parser": "5.23.0", + "autoprefixer": "10.4.7", "conventional-changelog-cli": "2.2.2", "eslint": "8.15.0", "eslint-plugin-import": "2.26.0", @@ -72,6 +73,8 @@ "karma-jasmine-html-reporter": "1.7.0", "lodash": "4.17.21", "node-polyfill-webpack-plugin": "1.1.4", + "postcss": "8.4.14", + "tailwindcss": "3.0.24", "ts-node": "10.7.0", "typescript": "~4.6.4", "webpack": "5.72.1" diff --git a/src/workbench/browser/src/app/pages/api/edit/api-edit.component.html b/src/workbench/browser/src/app/pages/api/edit/api-edit.component.html index 08917b016..d775f2204 100644 --- a/src/workbench/browser/src/app/pages/api/edit/api-edit.component.html +++ b/src/workbench/browser/src/app/pages/api/edit/api-edit.component.html @@ -4,10 +4,10 @@ API Path - + - + @@ -20,16 +20,9 @@ - + + @@ -53,7 +46,7 @@ 请求头部 {{ apiData.requestHeaders | apiParamsNum - }} + }} @@ -61,29 +54,22 @@ 请求体 - + "> - + Query 参数 {{ apiData.queryParams | apiParamsNum - }} + }} @@ -92,7 +78,7 @@ REST 参数 {{ apiData.restParams | apiParamsNum - }} + }} @@ -112,32 +98,23 @@ 返回头部 {{ apiData.responseHeaders | apiParamsNum - }} + }} - + + 返回结果 - + "> - + diff --git a/src/workbench/browser/src/app/pages/api/edit/api-edit.component.ts b/src/workbench/browser/src/app/pages/api/edit/api-edit.component.ts index 3356014b3..56118c45e 100644 --- a/src/workbench/browser/src/app/pages/api/edit/api-edit.component.ts +++ b/src/workbench/browser/src/app/pages/api/edit/api-edit.component.ts @@ -7,7 +7,7 @@ import { NzTreeSelectComponent } from 'ng-zorro-antd/tree-select'; import { Subject } from 'rxjs'; import { debounceTime, take, takeUntil, pairwise, filter } from 'rxjs/operators'; -import { MessageService } from '../../../shared/services/message'; +import { Message, MessageService } from '../../../shared/services/message'; import { StorageService } from '../../../shared/services/storage'; import { @@ -137,6 +137,7 @@ export class ApiEditComponent implements OnInit, OnDestroy { this.watchTabChange(); this.watchGroupIDChange(); this.watchUri(); + this.watchApiAction(); } ngOnDestroy() { @@ -178,6 +179,23 @@ export class ApiEditComponent implements OnInit, OnDestroy { this.getApi(id); } } + + /** + * Api Operation triggle tab change + */ + private watchApiAction() { + this.messageService + .get() + .pipe(takeUntil(this.destroy$)) + .subscribe((inArg: Message) => { + switch (inArg.type) { + case 'saveApi': + // this.saveApi(); + break; + } + }); + } + private watchTabChange() { this.apiTab.tabChange$ .pipe( diff --git a/src/workbench/browser/src/app/pages/api/edit/body/api-edit-body.component.html b/src/workbench/browser/src/app/pages/api/edit/body/api-edit-body.component.html index 91f4eb708..79a27ec6d 100644 --- a/src/workbench/browser/src/app/pages/api/edit/body/api-edit-body.component.html +++ b/src/workbench/browser/src/app/pages/api/edit/body/api-edit-body.component.html @@ -4,13 +4,9 @@ - +

JSON 根类型:

@@ -22,25 +18,11 @@ - + - + - + diff --git a/src/workbench/browser/src/app/pages/api/edit/body/api-edit-body.component.ts b/src/workbench/browser/src/app/pages/api/edit/body/api-edit-body.component.ts index 06989d0b2..0859ca405 100644 --- a/src/workbench/browser/src/app/pages/api/edit/body/api-edit-body.component.ts +++ b/src/workbench/browser/src/app/pages/api/edit/body/api-edit-body.component.ts @@ -92,6 +92,10 @@ export class ApiEditBodyComponent implements OnInit, OnChanges, OnDestroy { } } + beforeHandleImport(result) { + this.jsonRootType = Array.isArray(result) ? 'array' : 'object'; + } + handleParamsImport(data) { this.model = data; this.modelChange.emit(data); 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 8284f5b91..c7beb271a 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 @@ -31,13 +31,8 @@
- +
@@ -50,20 +45,10 @@
- +
@@ -96,21 +81,16 @@
-
+
{{ node.origin.method.slice(0, 4) - }} + }} {{ node.title }}