Skip to content

Commit

Permalink
fix(test-server): api-auth extension load slowly
Browse files Browse the repository at this point in the history
  • Loading branch information
scarqin committed Mar 15, 2023
1 parent 4bfb442 commit 3036e65
Show file tree
Hide file tree
Showing 12 changed files with 391 additions and 1,974 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@grpc/grpc-js": "1.7.3",
"@grpc/proto-loader": "0.7.3",
"@koa/cors": "4.0.0",
"axios": "1.2.6",
"axios": "1.3.4",
"cors": "2.8.5",
"crypto-js": "4.1.1",
"electron-log": "^4.4.8",
Expand All @@ -68,7 +68,6 @@
"xml2js": "0.4.23",
"yaml": "2.2.1",
"postman-sandbox": "^4.2.3"

},
"devDependencies": {
"@commitlint/cli": "~17.3.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,19 @@ export class AuthorizationExtensionFormComponent implements OnChanges {
return this.schemaForm?.validateForm;
}

get defaultAuthType() {
const isRootGroup =
this.parentGroup && (Reflect.has(this.parentGroup, 'depth') ? this.parentGroup.depth : this.parentGroup?.depth !== 0);
return isRootGroup && this.type !== 'api-test-history' ? inheritAuth : noAuth;
}
// get defaultAuthType() {

// }

get isDefaultAuthType() {
return [inheritAuth.name, noAuth.name].includes(this.authType);
}

get authTypeList() {
return [this.defaultAuthType, ...this.extensionList];
const isRootGroup =
this.parentGroup && (Reflect.has(this.parentGroup, 'depth') ? this.parentGroup.depth : this.parentGroup?.depth !== 0);
if (isRootGroup && this.type !== 'api-test-history') return [inheritAuth, noAuth, ...this.extensionList];
return [noAuth, ...this.extensionList];
}

constructor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@ export class ApiTestComponent implements OnInit, AfterViewInit, OnDestroy, TabVi
if (uuid?.includes('history_')) {
uuid = uuid.replace('history_', '');
const history: ApiTestHistory = await this.apiTest.getHistory(uuid);
console.log('history.request', history.request);
history.request.authInfo = {
authInfo: {},
authType: noAuth.name,
Expand Down Expand Up @@ -247,7 +246,6 @@ export class ApiTestComponent implements OnInit, AfterViewInit, OnDestroy, TabVi
this.status$.next('start');
}
}
console.log('request authInfo', this.model.request.authInfo);
this.initBasicForm();
this.validateForm.patchValue(this.model.request);
this.watchBasicForm();
Expand Down Expand Up @@ -580,7 +578,6 @@ export class ApiTestComponent implements OnInit, AfterViewInit, OnDestroy, TabVi
const { ctrlKey, metaKey, code } = event;
// 判断 Ctrl+S
if (this.isEmptyTestPage && [ctrlKey, metaKey].includes(true) && code === 'KeyS') {
console.log('EO_LOG[eo-api-test]: Ctrl + s');
// 或者 return false;
event.preventDefault();
this.saveApi();
Expand Down
1 change: 1 addition & 0 deletions src/node/test-server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
package-lock-lock.json
4 changes: 3 additions & 1 deletion src/node/test-server/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Node Test server
warning: If the root directory exists,`package.json` dependencies need added to root `package.json`

need `yarn` globally

# Debug Test Server

1. Run Test Server in this directory
Expand All @@ -10,5 +12,5 @@ yarn dev
2. Run the core system in root directory

```shell
yarn dev
yarn start
```
Loading

0 comments on commit 3036e65

Please sign in to comment.