Skip to content

Commit

Permalink
fix: ui error
Browse files Browse the repository at this point in the history
  • Loading branch information
kungfuboy committed Sep 5, 2022
1 parent 2336e8d commit 2f9136b
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 6 deletions.
19 changes: 19 additions & 0 deletions src/workbench/browser/src/app/pages/api/api-shared.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { ApiTestHeaderComponent } from './http/test/header/api-test-header.component';
import { ApiTestQueryComponent } from './http/test/query/api-test-query.component';

import { ParamsImportModule } from '../../shared/components/params-import/params-import.module';
import { Ng1Module } from '../../ng1/ng1.module';
import { ApiTestUtilService } from './http/test/api-test-util.service';

const COMPONENTS = [ApiTestHeaderComponent, ApiTestQueryComponent];

@NgModule({
imports: [CommonModule, Ng1Module, ParamsImportModule],
declarations: [...COMPONENTS],
providers: [ApiTestUtilService],
exports: [...COMPONENTS],
})
export class ApiSharedModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,18 @@ import { TestServerLocalNodeService } from '../../../../shared/services/api-test
import { TestServerServerlessService } from '../../../../shared/services/api-test/serverless-node/test-connect.service';

import { ApiTestComponent } from './api-test.component';
import { ApiTestHeaderComponent } from './header/api-test-header.component';
import { ApiTestBodyComponent } from './body/api-test-body.component';
import { ApiTestQueryComponent } from './query/api-test-query.component';
// import { ApiTestHeaderComponent } from './header/api-test-header.component';
// import { ApiTestQueryComponent } from './query/api-test-query.component';
import { ApiTestRestComponent } from './rest/api-test-rest.component';
import { ApiTestResultHeaderComponent } from './result-header/api-test-result-header.component';
import { ApiTestResultResponseComponent } from './result-response/api-test-result-response.component';
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';
import { ApiSharedModule } from 'eo/workbench/browser/src/app/pages/api/api-shared.module';

const NZ_COMPONETS = [
NzDropDownModule,
NzModalModule,
Expand All @@ -61,12 +63,13 @@ const NZ_COMPONETS = [
NzAlertModule,
NzTypographyModule,
NzUploadModule,
ApiSharedModule,
];
const COMPONENTS = [
ApiTestComponent,
ApiTestHeaderComponent,
// ApiTestHeaderComponent,
ApiTestBodyComponent,
ApiTestQueryComponent,
// ApiTestQueryComponent,
ApiTestRestComponent,
ApiTestResultHeaderComponent,
ApiTestResultResponseComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, OnInit, Input } from '@angular/core';
import { Component, OnInit, Output, Input, EventEmitter } from '@angular/core';
import { io } from 'socket.io-client';
import { ApiEditUtilService } from '../http/edit/api-edit-util.service';
import { transferUrlAndQuery } from 'eo/workbench/browser/src/app/utils/api';

@Component({
selector: 'websocket-content',
Expand Down Expand Up @@ -111,6 +112,7 @@ import { ApiEditUtilService } from '../http/edit/api-edit-util.service';
export class WebsocketComponent implements OnInit {
@Input() model = this.resetModel();
@Input() bodyType = 'json';
@Output() modelChange = new EventEmitter<any>();
isConnect = false;
wsUrl = 'ws://106.12.149.147:3782';
socket = null;
Expand Down Expand Up @@ -138,6 +140,9 @@ export class WebsocketComponent implements OnInit {
responseTabIndex: 0,
request: {
protocol: 'ws',
requestHeaders: [],
queryParams: [],
uri: '',
},
beforeScript: '',
afterScript: '',
Expand All @@ -150,6 +155,18 @@ export class WebsocketComponent implements OnInit {
rawDataChange(e) {
console.log('rawDataChange', e);
}
changeQuery() {
this.model.request.uri = transferUrlAndQuery(this.model.request.uri, this.model.request.queryParams, {
base: 'query',
replaceType: 'replace',
}).url;
}
emitChangeFun(where) {
if (where === 'queryParams') {
this.changeQuery();
}
this.modelChange.emit(this.model);
}
handleConnect(bool = false) {
if (this.socket == null) {
console.log('通信未就绪');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,21 @@ import { ApiEditUtilService } from '../http/edit/api-edit-util.service';
import { WebsocketComponent } from './websocket.component';
import { WebsocketRoutingModule } from './websocket.routing.module';
import { SharedModule } from 'eo/workbench/browser/src/app/shared/shared.module';
import { ApiSharedModule } from 'eo/workbench/browser/src/app/pages/api/api-shared.module';

const ANTDS = [NzButtonModule, NzInputModule, NzSelectModule, NzTabsModule];

@NgModule({
imports: [WebsocketRoutingModule, FormsModule, Ng1Module, ReactiveFormsModule, CommonModule, SharedModule, ...ANTDS],
imports: [
WebsocketRoutingModule,
ApiSharedModule,
FormsModule,
Ng1Module,
ReactiveFormsModule,
CommonModule,
SharedModule,
...ANTDS,
],
declarations: [WebsocketComponent],
exports: [WebsocketComponent],
providers: [ApiEditUtilService],
Expand Down

0 comments on commit 2f9136b

Please sign in to comment.