Skip to content

Commit

Permalink
feat: lazyload & fix base64 script tips error
Browse files Browse the repository at this point in the history
  • Loading branch information
scarqin committed Aug 15, 2022
1 parent 1c2f49d commit 3992a79
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 28 deletions.
12 changes: 4 additions & 8 deletions src/workbench/browser/src/app/pages/api/api-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { ApiComponent } from './api.component';
import { ApiDetailComponent } from './detail/api-detail.component';
import { ApiEditComponent } from './edit/api-edit.component';
import { ApiOverviewComponent } from './overview/api-overview.component';
import { ApiTestComponent } from './test/api-test.component';
import { ApiMockComponent } from './mock/api-mock.component';

const routes: Routes = [
{
Expand All @@ -24,19 +20,19 @@ const routes: Routes = [
},
{
path: 'detail',
component: ApiDetailComponent,
loadChildren: () => import('./detail/api-detail.module').then((m) => m.ApiDetailModule),
},
{
path: 'edit',
component: ApiEditComponent,
loadChildren: () => import('./edit/api-edit.module').then((m) => m.ApiEditModule),
},
{
path: 'test',
component: ApiTestComponent,
loadChildren: () => import('./test/api-test.module').then((m) => m.ApiTestModule),
},
{
path: 'mock',
component: ApiMockComponent,
loadChildren: () => import('./mock/api-mock.module').then((m) => m.ApiMockModule),
},
],
},
Expand Down
2 changes: 0 additions & 2 deletions src/workbench/browser/src/app/pages/api/api.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import { ApiService } from './api.service';
import { ElectronService } from '../../core/services';
import { ApiOverviewComponent } from './overview/api-overview.component';
import { HistoryComponent } from './history/eo-history.component';
import { ApiMockComponent } from './mock/api-mock.component';
import { IndexedDBStorage } from 'eo/workbench/browser/src/app/shared/services/storage/IndexedDB/lib/';
import { SharedModule } from 'eo/workbench/browser/src/app/shared/shared.module';
import { ApiTabStorageService } from 'eo/workbench/browser/src/app/pages/api/tab/api-tab-storage.service';
Expand All @@ -57,7 +56,6 @@ const COMPONENTS = [
ApiOverviewComponent,
ImportApiComponent,
ExtensionSelectComponent,
ApiMockComponent,
HistoryComponent,
];
@NgModule({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,17 @@ import { ApiDetailMockComponent } from './mock/api-detail-mock.component';

import { ApiDetailUtilService } from './api-detail-util.service';
import { NzCollapseModule } from 'ng-zorro-antd/collapse';
import { RouterModule } from '@angular/router';

const NZ_COMPONETS = [NzButtonModule, NzCollapseModule,NzIconModule, NzTagModule, NzModalModule, NzFormModule, NzToolTipModule];
const NZ_COMPONETS = [
NzButtonModule,
NzCollapseModule,
NzIconModule,
NzTagModule,
NzModalModule,
NzFormModule,
NzToolTipModule,
];
const COMPONENTS = [
ApiDetailComponent,
ApiDetailHeaderComponent,
Expand All @@ -34,7 +43,21 @@ const COMPONENTS = [
];
@NgModule({
declarations: [...COMPONENTS],
imports: [FormsModule, ReactiveFormsModule, Ng1Module, CommonModule, ...NZ_COMPONETS, EouiModule, SharedModule],
imports: [
RouterModule.forChild([
{
path: '',
component: ApiDetailComponent,
},
]),
FormsModule,
ReactiveFormsModule,
Ng1Module,
CommonModule,
...NZ_COMPONETS,
EouiModule,
SharedModule,
],
providers: [ApiDetailUtilService],
})
export class ApiDetailModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import { ApiParamsExtraSettingComponent } from './extra-setting/api-params-extra

import { ApiEditUtilService } from './api-edit-util.service';
import { ApiEditService } from 'eo/workbench/browser/src/app/pages/api/edit/api-edit.service';
import { RouterModule } from '@angular/router';

const NZ_COMPONETS = [
NzDropDownModule,
Expand Down Expand Up @@ -59,6 +60,12 @@ const COMPONENTS = [
@NgModule({
declarations: [...COMPONENTS],
imports: [
RouterModule.forChild([
{
path: '',
component: ApiEditComponent,
},
]),
FormsModule,
ReactiveFormsModule,
Ng1Module,
Expand Down
30 changes: 30 additions & 0 deletions src/workbench/browser/src/app/pages/api/mock/api-mock.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ApiMockComponent } from './api-mock.component';
import { SharedModule } from 'eo/workbench/browser/src/app/shared/shared.module';
import { NzFormModule } from 'ng-zorro-antd/form';
import { NzInputModule } from 'ng-zorro-antd/input';
import { FormsModule } from '@angular/forms';
import { NzModalModule } from 'ng-zorro-antd/modal';
import { EouiModule } from 'eo/workbench/browser/src/app/eoui/eoui.module';
import { RouterModule } from '@angular/router';

@NgModule({
declarations: [ApiMockComponent],
imports: [
RouterModule.forChild([
{
path: '',
component: ApiMockComponent,
},
]),
CommonModule,
SharedModule,
NzFormModule,
NzInputModule,
FormsModule,
NzModalModule,
EouiModule,
],
})
export class ApiMockModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import { ApiTestResultResponseComponent } from './result-response/api-test-resul
import { ApiTestResultRequestBodyComponent } from './result-request-body/api-test-result-request-body.component';
import { TestServerRemoteService } from 'eo/workbench/browser/src/app/shared/services/api-test/remote-node/test-connect.service';
import { NzUploadModule } from 'ng-zorro-antd/upload';
import { RouterModule, Routes } from '@angular/router';
const NZ_COMPONETS = [
NzDropDownModule,
NzModalModule,
Expand Down Expand Up @@ -76,6 +77,12 @@ const COMPONENTS = [
@NgModule({
declarations: [...COMPONENTS, ByteToStringPipe],
imports: [
RouterModule.forChild([
{
path: '',
component: ApiTestComponent,
},
]),
FormsModule,
ReactiveFormsModule,
Ng1Module,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,54 +211,54 @@ const COMMON_DATA: TreeNode[] = [
},
{
name: $localize`JSON Decode`,
caption: 'json.decode',
value: 'json.decode(json)',
caption: 'eo.json.decode',
value: 'eo.json.decode(json)',
note: {
code: 'json.decode(json)',
code: 'eo.json.decode(json)',
desc: $localize`JSON Decode`,
input: [{ key: 'json', value: $localize`JSON string` }],
output: $localize`JSON object`,
},
},
{
name: $localize`XML Encode`,
caption: 'xml.encode',
value: 'xml.encode(xml_object)',
caption: 'eo.xml.encode',
value: 'eo.xml.encode(xml_object)',
note: {
code: 'xml.encode(xml_object)',
code: 'eo.xml.encode(xml_object)',
desc: $localize`XML Encode`,
input: [{ key: 'xml_object', value: $localize`XML object` }],
output: $localize`XML string`,
},
},
{
name: $localize`XML Decode`,
caption: 'xml.decode',
value: 'xml.decode(xml)',
caption: 'eo.xml.decode',
value: 'eo.xml.decode(xml)',
note: {
code: 'xml.decode(xml)',
code: 'eo.xml.decode(xml)',
desc: $localize`XML Decode`,
input: [{ key: 'xml', value: $localize`XML string` }],
output: $localize`XML code`,
},
},
{
name: $localize`Base64 Encode`,
caption: 'base64.encode',
value: 'base64.encode(data)',
caption: 'eo.base64.encode',
value: 'eo.base64.encode(data)',
note: {
code: 'base64.encode(data)',
code: 'eo.base64.encode(data)',
desc: $localize`Base64 Encode`,
input: [{ key: 'data', value: $localize`string of wait for encode` }],
output: $localize`string after encode`,
},
},
{
name: $localize`Base64 Decode`,
caption: 'base64.decode',
value: 'base64.decode(data)',
caption: 'eo.base64.decode',
value: 'eo.base64.decode(data)',
note: {
code: 'base64.decode(data)',
code: 'eo.base64.decode(data)',
desc: $localize`Base64 Decode`,
input: [{ key: 'data', value: $localize`string of wait for decode` }],
output: $localize`string after decode`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class StorageService {
data: undefined,
callback,
};
console.log('this.instance', this.instance, action);
// console.log('this.instance', this.instance, action);
if (!this.instance[action]) {
throw Error(`Lack request API: ${action}`);
}
Expand Down

0 comments on commit 3992a79

Please sign in to comment.