Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
buqiyuan committed May 23, 2022
1 parent 9cf1e13 commit fd4fbe7
Show file tree
Hide file tree
Showing 27 changed files with 86 additions and 79 deletions.
4 changes: 2 additions & 2 deletions src/app/electron-browser/IndexedDB/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
StorageHandleStatus,
StorageHandleArgs,
StorageProcessType,
} from '../../../../platform/browser/IndexedDB';
import { Storage } from '../../../../platform/browser/IndexedDB/lib';
} from 'eo/platform/browser/IndexedDB';
import { Storage } from 'eo/platform/browser/IndexedDB/lib';

class StorageService {
private ipcRenderer: typeof ipcRenderer;
Expand Down
2 changes: 1 addition & 1 deletion src/workbench/browser/src/app/pages/api/api.service.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { NzModalService } from 'ng-zorro-antd/modal';
import { ApiData, StorageHandleResult, StorageHandleStatus } from '../../../../../../platform/browser/IndexedDB';
import { ApiData, StorageHandleResult, StorageHandleStatus } from 'eo/platform/browser/IndexedDB';
import { MessageService } from '../../shared/services/message';
import { StorageService } from '../../shared/services/storage';
@Injectable()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ApiData, ApiBodyType, JsonRootType, StorageHandleResult, StorageHandleStatus } from '../../../../../../../platform/browser/IndexedDB';
import {
ApiData,
ApiBodyType,
JsonRootType,
StorageHandleResult,
StorageHandleStatus,
} from 'eo/platform/browser/IndexedDB';
import { treeToListHasLevel } from '../../../utils/tree/tree.utils';
import { reverseObj } from '../../../utils';
import { StorageService } from '../../../shared/services/storage';
Expand All @@ -24,10 +30,9 @@ export class ApiDetailComponent implements OnInit {
apiData: ApiData | any = {};
CONST = {
BODY_TYPE: reverseObj(ApiBodyType),
JSON_ROOT_TYPE: reverseObj(JsonRootType)
JSON_ROOT_TYPE: reverseObj(JsonRootType),
};
constructor(private route: ActivatedRoute, private storage: StorageService) {
}
constructor(private route: ActivatedRoute, private storage: StorageService) {}
ngOnInit(): void {
this.route.queryParams.subscribe((params) => {
if (params.uuid) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, OnInit, Input, OnChanges, OnDestroy } from '@angular/core';
import { Subject } from 'rxjs';
import { ApiEditBody, ApiBodyType, JsonRootType } from '../../../../../../../../platform/browser/IndexedDB';
import { ApiEditBody, ApiBodyType, JsonRootType } from 'eo/platform/browser/IndexedDB';
import { ApiDetailService } from '../api-detail.service';
@Component({
selector: 'eo-api-detail-body',
Expand Down Expand Up @@ -30,8 +30,7 @@ export class ApiDetailBodyComponent implements OnInit, OnChanges, OnDestroy {
}
beforeChangeBodyByType(type) {
switch (type) {
case ApiBodyType.Raw: // case ApiBodyType.Binary:
{
case ApiBodyType.Raw: { // case ApiBodyType.Binary:
this.cache[type] = this.model || '';
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit, Input, OnChanges } from '@angular/core';
import { ApiEditHeaders } from '../../../../../../../../platform/browser/IndexedDB';
import { ApiEditHeaders } from 'eo/platform/browser/IndexedDB';
import { ApiDetailService } from '../api-detail.service';
@Component({
selector: 'eo-api-detail-header',
Expand All @@ -23,7 +23,7 @@ export class ApiDetailHeaderComponent implements OnInit, OnChanges {
this.listConf = this.detailService.initListConf({
dragCacheVar: 'DRAG_VAR_API_EDIT_HEADER',
title: '头部',
nameTitle: '标签'
nameTitle: '标签',
});
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Component, OnInit, Input} from '@angular/core';
import { ApiEditQuery } from '../../../../../../../../platform/browser/IndexedDB';
import { Component, OnInit, Input } from '@angular/core';
import { ApiEditQuery } from 'eo/platform/browser/IndexedDB';
import { ApiDetailService } from '../api-detail.service';

@Component({
selector: 'eo-api-detail-query',
templateUrl: './api-detail-query.component.html',
styleUrls: ['./api-detail-query.component.scss']
styleUrls: ['./api-detail-query.component.scss'],
})
export class ApiDetailQueryComponent implements OnInit {
@Input() model: ApiEditQuery[];
Expand All @@ -16,8 +16,8 @@ export class ApiDetailQueryComponent implements OnInit {
this.initListConf();
}
private initListConf() {
this.listConf =this.detailService.initListConf({
dragCacheVar:'DRAG_VAR_API_EDIT_QUERY'
this.listConf = this.detailService.initListConf({
dragCacheVar: 'DRAG_VAR_API_EDIT_QUERY',
});
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit, Input} from '@angular/core';
import { ApiEditRest } from '../../../../../../../../platform/browser/IndexedDB';
import { Component, OnInit, Input } from '@angular/core';
import { ApiEditRest } from 'eo/platform/browser/IndexedDB';
import { ApiDetailService } from '../api-detail.service';
@Component({
selector: 'eo-api-detail-rest',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
ApiEditRest,
StorageHandleResult,
StorageHandleStatus,
} from '../../../../../../../platform/browser/IndexedDB';
} from 'eo/platform/browser/IndexedDB';
import { ApiTabService } from '../tab/api-tab.service';

import { objectToArray } from '../../../utils';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import {
Component,
OnInit,
Input,
ChangeDetectorRef,
Output,
EventEmitter,
OnChanges,
OnDestroy,
} from '@angular/core';
import { Component, OnInit, Input, ChangeDetectorRef, Output, EventEmitter, OnChanges, OnDestroy } from '@angular/core';

import { Subject } from 'rxjs';
import { pairwise, takeUntil, debounceTime } from 'rxjs/operators';
import { ApiParamsTypeFormData, ApiParamsTypeJsonOrXml, ApiEditBody, ApiBodyType, JsonRootType } from '../../../../../../../../platform/browser/IndexedDB';
import {
ApiParamsTypeFormData,
ApiParamsTypeJsonOrXml,
ApiEditBody,
ApiBodyType,
JsonRootType,
} from 'eo/platform/browser/IndexedDB';
import { ApiEditService } from '../api-edit.service';
@Component({
selector: 'eo-api-edit-body',
Expand Down Expand Up @@ -53,7 +50,8 @@ export class ApiEditBodyComponent implements OnInit, OnChanges, OnDestroy {
}
beforeChangeBodyByType(type) {
switch (type) {
case ApiBodyType.Raw: { // case ApiBodyType.Binary:
case ApiBodyType.Raw: {
// case ApiBodyType.Binary:
if (typeof this.model !== 'string') return;
this.cache[type] = this.model || '';
break;
Expand All @@ -72,7 +70,7 @@ export class ApiEditBodyComponent implements OnInit, OnChanges, OnDestroy {
this.bodyTypeChange.emit(this.bodyType);
this.setListConf();
this.setModel();
if(type==='init') return;
if (type === 'init') return;
this.modelChange.emit(this.model);
}
ngOnInit(): void {
Expand All @@ -85,7 +83,10 @@ export class ApiEditBodyComponent implements OnInit, OnChanges, OnDestroy {
this.destroy$.complete();
}
ngOnChanges(changes) {
if ((changes.model && !changes.model.previousValue && changes.model.currentValue) || changes.model.currentValue?.length===0) {
if (
(changes.model && !changes.model.previousValue && changes.model.currentValue) ||
changes.model.currentValue?.length === 0
) {
this.beforeChangeBodyByType(this.bodyType);
this.changeBodyType('init');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit, Input } from '@angular/core';
import { ApiParamsTypeJsonOrXml, ParamsEnum, BasiApiEditParams } from '../../../../../../../../platform/browser/IndexedDB';
import { ApiParamsTypeJsonOrXml, ParamsEnum, BasiApiEditParams } from 'eo/platform/browser/IndexedDB';

@Component({
selector: 'eo-api-edit-params-extra-setting',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit, Input, ChangeDetectorRef, AfterViewChecked, OnChanges } from '@angular/core';
import { ApiEditHeaders } from '../../../../../../../../platform/browser/IndexedDB';
import { ApiEditHeaders } from 'eo/platform/browser/IndexedDB';
import { ApiEditService } from '../api-edit.service';
@Component({
selector: 'eo-api-edit-header',
Expand All @@ -25,7 +25,7 @@ export class ApiEditHeaderComponent implements OnInit, OnChanges, AfterViewCheck
this.cdRef.detectChanges();
}
ngOnChanges(changes) {
if (changes.model&&!changes.model.previousValue&&changes.model.currentValue) {
if (changes.model && !changes.model.previousValue && changes.model.currentValue) {
this.model.push(Object.assign({}, this.itemStructure));
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Component, OnInit, Input, ChangeDetectorRef,AfterViewChecked,OnChanges } from '@angular/core';
import { ApiEditQuery } from '../../../../../../../../platform/browser/IndexedDB';
import { Component, OnInit, Input, ChangeDetectorRef, AfterViewChecked, OnChanges } from '@angular/core';
import { ApiEditQuery } from 'eo/platform/browser/IndexedDB';
import { ApiEditService } from '../api-edit.service';

@Component({
selector: 'eo-api-edit-query',
templateUrl: './api-edit-query.component.html',
styleUrls: ['./api-edit-query.component.scss']
styleUrls: ['./api-edit-query.component.scss'],
})
export class ApiEditQueryComponent implements OnInit,OnChanges,AfterViewChecked {
export class ApiEditQueryComponent implements OnInit, OnChanges, AfterViewChecked {
@Input() model: object[];
listConf: object = {};
private itemStructure: ApiEditQuery = {
Expand All @@ -16,7 +16,7 @@ export class ApiEditQueryComponent implements OnInit,OnChanges,AfterViewChecked
example: '',
description: '',
};
constructor(private editService: ApiEditService,private cdRef: ChangeDetectorRef) {}
constructor(private editService: ApiEditService, private cdRef: ChangeDetectorRef) {}

ngOnInit(): void {
this.initListConf();
Expand All @@ -26,17 +26,17 @@ export class ApiEditQueryComponent implements OnInit,OnChanges,AfterViewChecked
this.cdRef.detectChanges();
}
ngOnChanges(changes) {
if (changes.model&&!changes.model.previousValue&&changes.model.currentValue) {
if (changes.model && !changes.model.previousValue && changes.model.currentValue) {
this.model.push(Object.assign({}, this.itemStructure));
}
}
private initListConf() {
this.listConf =this.editService.initListConf({
dragCacheVar:'DRAG_VAR_API_EDIT_QUERY',
itemStructure:this.itemStructure,
this.listConf = this.editService.initListConf({
dragCacheVar: 'DRAG_VAR_API_EDIT_QUERY',
itemStructure: this.itemStructure,
nzOnOkMoreSetting: (inputArg) => {
this.model[inputArg.$index] = inputArg.item;
}
},
});
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, OnInit, Input, ChangeDetectorRef, AfterViewChecked, OnChanges } from '@angular/core';
import { ApiEditRest } from '../../../../../../../../platform/browser/IndexedDB';
import { ApiEditRest } from 'eo/platform/browser/IndexedDB';
import { ApiEditService } from '../api-edit.service';
@Component({
selector: 'eo-api-edit-rest',
Expand All @@ -24,7 +24,7 @@ export class ApiEditRestComponent implements OnInit, OnChanges, AfterViewChecked
this.cdRef.detectChanges();
}
ngOnChanges(changes) {
if (changes.model&&!changes.model.previousValue&&changes.model.currentValue) {
if (changes.model && !changes.model.previousValue && changes.model.currentValue) {
this.model.push(Object.assign({}, this.itemStructure));
}
}
Expand All @@ -34,7 +34,7 @@ export class ApiEditRestComponent implements OnInit, OnChanges, AfterViewChecked
itemStructure: this.itemStructure,
nzOnOkMoreSetting: (inputArg) => {
this.model[inputArg.$index] = inputArg.item;
}
},
});
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, Input, OnInit } from '@angular/core';
import { Group, StorageHandleResult, StorageHandleStatus } from '../../../../../../../../platform/browser/IndexedDB';
import { Group, StorageHandleResult, StorageHandleStatus } from 'eo/platform/browser/IndexedDB';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { MessageService } from '../../../../shared/services/message';
Expand All @@ -24,7 +24,7 @@ export class ApiGroupEditComponent implements OnInit {
private messageService: MessageService,
private modalRef: NzModalRef,
private storage: StorageService
) { }
) {}

ngOnInit(): void {
this.isDelete = this.action === 'delete';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { Component, OnInit, OnDestroy, ViewChild } from '@angular/core';
import { Router, NavigationEnd, ActivatedRoute } from '@angular/router';
import { GroupTreeItem, GroupApiDataModel } from '../../../../shared/models';
import {
Group,
ApiData,
StorageHandleResult,
StorageHandleStatus,
} from '../../../../../../../../platform/browser/IndexedDB';
import { Group, ApiData, StorageHandleResult, StorageHandleStatus } from 'eo/platform/browser/IndexedDB';
import { Message } from '../../../../shared/services/message/message.model';
import { NzModalRef } from 'ng-zorro-antd/modal';
import { NzFormatEmitEvent, NzTreeNode } from 'ng-zorro-antd/tree';
Expand Down Expand Up @@ -338,7 +333,7 @@ export class ApiGroupTreeComponent implements OnInit, OnDestroy {
}

private setSelectedKeys() {
console.log('setSelectedKeys',this.route.snapshot.queryParams.uuid,this.nzSelectedKeys)
console.log('setSelectedKeys', this.route.snapshot.queryParams.uuid, this.nzSelectedKeys);
if (this.route.snapshot.queryParams.uuid) {
this.nzSelectedKeys = [this.route.snapshot.queryParams.uuid];
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { Component, OnInit, OnDestroy } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { TabItem } from './tab.model';
import { ApiData } from '../../../../../../../platform/browser/IndexedDB';
import { ApiData } from 'eo/platform/browser/IndexedDB';
import { ApiTabService } from './api-tab.service';
import { Subject, takeUntil } from 'rxjs';
import { Message, MessageService } from '../../../shared/services/message';
@Component({
selector: 'eo-api-tab',
templateUrl: './api-tab.component.html',
styleUrls: ['./api-tab.component.scss']
styleUrls: ['./api-tab.component.scss'],
})
export class ApiTabComponent implements OnInit, OnDestroy {
apiDataItems: { [key: number | string]: ApiData };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
RequestProtocol,
StorageHandleResult,
StorageHandleStatus,
} from '../../../../../../../platform/browser/IndexedDB';
} from 'eo/platform/browser/IndexedDB';
import { MessageService } from '../../../shared/services/message';

import { interval, Subscription, Observable, of, Subject } from 'rxjs';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Injectable } from '@angular/core';
import { ApiTestQuery } from '../../../shared/services/api-test/api-test-params.model';
import { ApiTestHistory } from '../../../../../../../platform/browser/IndexedDB';
import { ApiTestHistory } from 'eo/platform/browser/IndexedDB';
import { treeToListHasLevel } from '../../../utils/tree/tree.utils';
import { text2UiData } from '../../../utils/data-transfer/data-transfer.utils';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@ import { Component, OnInit, Input, Output, EventEmitter, OnChanges, OnDestroy }
import { Subject } from 'rxjs';
import { pairwise, takeUntil, debounceTime } from 'rxjs/operators';

import { ApiTestParamsTypeFormData, ApiTestParamsTypeJsonOrXml, ApiTestBody } from '../../../../shared/services/api-test/api-test-params.model';
import { ApiBodyType, JsonRootType } from '../../../../../../../../platform/browser/IndexedDB';
import {
ApiTestParamsTypeFormData,
ApiTestParamsTypeJsonOrXml,
ApiTestBody,
} from '../../../../shared/services/api-test/api-test-params.model';
import { ApiBodyType, JsonRootType } from 'eo/platform/browser/IndexedDB';
import { ApiTestService } from '../api-test.service';
import { Message, MessageService } from '../../../../shared/services/message';

Expand Down Expand Up @@ -77,7 +81,10 @@ export class ApiTestBodyComponent implements OnInit, OnChanges, OnDestroy {
this.destroy$.complete();
}
ngOnChanges(changes) {
if ((changes.model && !changes.model.previousValue && changes.model.currentValue) || changes.model.currentValue?.length===0) {
if (
(changes.model && !changes.model.previousValue && changes.model.currentValue) ||
changes.model.currentValue?.length === 0
) {
this.beforeChangeBodyByType(this.bodyType);
this.changeBodyType('init');
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
ApiTestHistoryFrame,
StorageHandleResult,
StorageHandleStatus,
} from '../../../../../../../../platform/browser/IndexedDB';
} from 'eo/platform/browser/IndexedDB';

@Component({
selector: 'eo-api-test-history',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, Input, OnInit, OnChanges } from '@angular/core';
import { ApiTestHistoryResponse } from '../../../../../../../../platform/browser/IndexedDB';
import { ApiTestHistoryResponse } from 'eo/platform/browser/IndexedDB';
import { ApiTestService } from '../api-test.service';
@Component({
selector: 'eo-api-test-result-response',
Expand Down
Loading

0 comments on commit fd4fbe7

Please sign in to comment.