Skip to content

Commit

Permalink
fix: new api test without form/open a new tab
Browse files Browse the repository at this point in the history
  • Loading branch information
scarqin committed Mar 2, 2022
1 parent 80aa72d commit 9ea36de
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/app/pages/api/edit/body/api-edit-body.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export class ApiEditBodyComponent implements OnInit, OnChanges, OnDestroy {
this.destroy$.complete();
}
ngOnChanges(changes) {
if (changes.model && !changes.model.previousValue && changes.model.currentValue) {
if ((changes.model && !changes.model.previousValue && changes.model.currentValue) || changes.model.currentValue?.length===0) {
this.beforeChangeBodyByType(this.bodyType);
this.changeBodyType('init');
}
Expand Down
1 change: 0 additions & 1 deletion src/app/pages/api/group/tree/api-group-tree.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ export class ApiGroupTreeComponent implements OnInit, OnDestroy {
.get()
.pipe(takeUntil(this.destroy$))
.subscribe((inArg: Message) => {
console.log('watchApiAction', inArg);
switch (inArg.type) {
case 'addApiSuccess':
case 'editApiSuccess':
Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/api/tab/api-tab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class ApiTabComponent implements OnInit, OnDestroy {
return;
}
// avoid open too much tab,if detail or no change,open page in current tab
if(this.tabSerive.tabs.length&&this.tabSerive.currentTab?.path.includes('detail')){
if(this.tabSerive.tabs.length&&this.tabSerive.currentTab?.path.includes('detail')&&tab.path.includes('detail')){
this.switchTab(this.selectedIndex, tab);
return;
}
Expand Down
11 changes: 6 additions & 5 deletions src/app/pages/api/test/body/api-test-body.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ export class ApiTestBodyComponent 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 All @@ -67,7 +67,7 @@ export class ApiTestBodyComponent 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);
}

Expand All @@ -81,7 +81,7 @@ export class ApiTestBodyComponent implements OnInit, OnChanges, OnDestroy {
this.destroy$.complete();
}
ngOnChanges(changes) {
if (changes.model && !changes.model.previousValue && changes.model.currentValue) {
if ((changes.model && !changes.model.previousValue && changes.model.currentValue) || changes.model.currentValue?.length===0) {
this.beforeChangeBodyByType(this.bodyType);
this.changeBodyType('init');
}
Expand All @@ -101,7 +101,8 @@ export class ApiTestBodyComponent implements OnInit, OnChanges, OnDestroy {
*/
private setModel() {
switch (this.bodyType) {
case ApiBodyType.Raw: { // case ApiBodyType.Binary:
case ApiBodyType.Raw: {
// case ApiBodyType.Binary:
this.model = this.cache[this.bodyType] || '';
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/components/navbar/navbar.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</span>
<nz-dropdown-menu #menu="nzDropdownMenu">
<ul nz-menu nzSelectable>
<a href="https://eoapi.vercel.app/" target="_blank" nz-menu-item>产品文档</a>
<a href="https://eoapi.io/docs/about.html/" target="_blank" nz-menu-item>产品文档</a>
<li nz-menu-divider></li>
<a href="https://github.com/eolinker/eoapi/issues/new" target="_blank" nz-menu-item>问题反馈</a>
</ul>
Expand Down

0 comments on commit 9ea36de

Please sign in to comment.