From 34520bfbd1911ae89449f666354c7378111ac655 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=A4=9C=E9=B9=B0?= <17kungfuboy@gmail.com>
Date: Thu, 9 Feb 2023 16:04:53 +0800
Subject: [PATCH 1/2] fix: delete group after delete tab by id
---
package.json | 4 +-
src/workbench/browser/locale/messages.xlf | 267 ++++++++++--------
.../workspace/project/api/api-tab.service.ts | 7 +
.../group/tree/api-group-tree.component.ts | 12 +-
4 files changed, 172 insertions(+), 118 deletions(-)
diff --git a/package.json b/package.json
index 31266ae5..d6f32479 100644
--- a/package.json
+++ b/package.json
@@ -20,8 +20,8 @@
"build:static": "npm run clear:electron:tsc&&npm run electron:tsc && electron-builder build",
"electron:build:web": "yarn workspace postcat-web run build",
"electron:static": "npm run electron:tsc && electron .",
- "release": "npm-run-all -s build:web electron:tsc && electron-builder --publish=always && node upload.js",
- "release:m1": "npm-run-all -s build:web electron:tsc && electron-builder -m=dmg --arm64 -p onTagOrDraft && node upload.js",
+ "release": "npm-run-all -s electron:build:web electron:tsc && electron-builder --publish=always && node upload.js",
+ "release:m1": "npm-run-all -s electron:build:web electron:tsc && electron-builder -m=dmg --arm64 -p onTagOrDraft && node upload.js",
"test": "npm-run-all --serial test:*",
"e2e": "yarn build:prod && npx playwright test -c e2e/playwright.config.ts e2e/",
"clear:electron:tsc": "tsc --build --clean",
diff --git a/src/workbench/browser/locale/messages.xlf b/src/workbench/browser/locale/messages.xlf
index 1046bc90..935750bc 100644
--- a/src/workbench/browser/locale/messages.xlf
+++ b/src/workbench/browser/locale/messages.xlf
@@ -10,7 +10,7 @@
src/app/pages/extension/detail/extension-detail.component.html
- 70
+ 88
@@ -24,14 +24,14 @@
src/app/core/services/notification.service.ts
- 26
+ 27
src/app/core/services/notification.service.ts
- 27
+ 28
@@ -300,6 +300,9 @@
src/app/layouts/navbar/nav-operate.component.ts
17
+
+
+
src/app/layouts/navbar/nav-operate.component.ts
28
@@ -366,7 +369,7 @@
src/app/pages/extension/list/extension-list.component.html
- 42
+ 50
src/app/pages/workspace/overview/workspace-overview.component.html
@@ -392,7 +395,7 @@
src/app/pages/workspace/project/api/env/env-select/env-select.component.ts
- 73
+ 74
@@ -428,7 +431,7 @@
src/app/pages/extension/detail/extension-detail.component.html
- 51
+ 69
@@ -458,11 +461,11 @@
src/app/pages/workspace/project/api/env/env-select/env-select.component.ts
- 36
+ 37
src/app/pages/workspace/project/api/env/env-select/env-select.component.ts
- 53
+ 54
@@ -583,11 +586,11 @@
src/app/pages/user-modal.component.ts
- 474
+ 477
src/app/pages/workspace/project/api/websocket/websocket.component.ts
- 318
+ 340
src/app/shared/services/modal.service.ts
@@ -676,11 +679,11 @@
src/app/pages/workspace/project/api/env/env-select/env-select.component.ts
- 37
+ 38
src/app/pages/workspace/project/api/env/env-select/env-select.component.ts
- 54
+ 55
@@ -709,10 +712,10 @@
-
+
src/app/modules/api-shared/params-import/params-import.component.html
- 8,10
+ 9,11
@@ -775,18 +778,18 @@
src/app/modules/api-shared/params-import/params-import.component.ts
- 81
+ 107
src/app/modules/api-shared/params-import/params-import.component.ts
- 93
+ 119
src/app/modules/api-shared/params-import/params-import.component.ts
- 99
+ 125
@@ -818,7 +821,7 @@
src/app/pages/extension/extension.component.html
- 4
+ 12
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.html
@@ -962,11 +965,11 @@
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 41
+ 45
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 63
+ 67
@@ -993,7 +996,7 @@
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 49
+ 53
src/app/pages/workspace/project/api/components/history/eo-history.component.html
@@ -1020,14 +1023,14 @@
src/app/pages/workspace/project/api/env/env-list/env-list.component.html
- 36
+ 37
src/app/modules/extension-select/import-api/import-api.component.ts
- 84
+ 102
@@ -1055,11 +1058,18 @@
39
+
+
+
+ src/app/modules/extension-select/select/extension-select.component.html
+ 48,49
+
+
src/app/modules/extension-select/select/extension-select.component.ts
- 50
+ 55
@@ -1161,7 +1171,7 @@
src/app/pages/user-modal.component.ts
- 75
+ 81
@@ -1317,102 +1327,102 @@
src/app/pages/extension/detail/extension-detail.component.html
- 24
+ 42
src/app/pages/extension/detail/extension-detail.component.html
- 25
+ 43
src/app/pages/extension/detail/extension-detail.component.html
- 35
+ 53
src/app/pages/extension/detail/extension-detail.component.html
- 36
+ 54
src/app/pages/extension/detail/extension-detail.component.html
- 59
+ 77
src/app/pages/extension/list/extension-list.component.html
- 45
+ 54
src/app/pages/extension/detail/extension-detail.component.html
- 67
+ 85
src/app/pages/extension/detail/extension-detail.component.html
- 69
+ 87
src/app/pages/extension/detail/extension-detail.component.html
- 71
+ 89
src/app/pages/extension/detail/extension-detail.component.html
- 76
+ 94
src/app/pages/extension/detail/extension-detail.component.html
- 79
+ 97
src/app/pages/extension/detail/extension-detail.component.html
- 85
+ 103
src/app/pages/extension/detail/extension-detail.component.html
- 88
+ 106
src/app/pages/extension/detail/extension-detail.component.html
- 90
+ 108
src/app/pages/extension/detail/extension-detail.component.html
- 98
+ 116
@@ -1426,85 +1436,120 @@
src/app/pages/extension/detail/extension-detail.component.ts
- 64
+ 68
src/app/pages/extension/extension.component.ts
- 23
+ 25
src/app/pages/extension/extension.component.ts
- 29
+ 31
src/app/pages/extension/extension.component.ts
- 34
+ 37
src/app/pages/extension/list/extension-list.component.html
- 23
+ 27
+
+
+
+
+
+ src/app/pages/extension/extension.model.ts
+ 75
+
+
+
+
+
+ src/app/pages/extension/extension.model.ts
+ 80
+
+
+
+
+
+ src/app/pages/extension/extension.model.ts
+ 85
+
+
+
+
+
+ src/app/pages/extension/extension.model.ts
+ 90
+
+
+
+
+
+ src/app/pages/third-login.component.ts
+ 21
+
+
+
+
+
+ src/app/pages/third-login.component.ts
+ 38,39
src/app/pages/user-modal.component.ts
- 25
+ 26
src/app/pages/user-modal.component.ts
- 29
+ 30
src/app/pages/user-modal.component.ts
- 30
+ 31
src/app/pages/user-modal.component.ts
- 34,35
+ 35,36
src/app/pages/user-modal.component.ts
- 148,149
+ 156,157
src/app/pages/user-modal.component.ts
- 37,38
+ 38,39
src/app/pages/user-modal.component.ts
- 47
-
-
-
-
-
- src/app/pages/user-modal.component.ts
- 54
+ 48
@@ -1518,81 +1563,74 @@
src/app/pages/user-modal.component.ts
- 62
-
-
-
-
-
- src/app/pages/user-modal.component.ts
- 69
+ 63
src/app/pages/user-modal.component.ts
- 71
+ 76
src/app/pages/user-modal.component.ts
- 73
+ 80
src/app/pages/user-modal.component.ts
- 92,93
+ 99,100
src/app/pages/user-modal.component.ts
- 104
+ 112
src/app/pages/user-modal.component.ts
- 108
+ 116
src/app/pages/user-modal.component.ts
- 109
+ 117
src/app/pages/user-modal.component.ts
- 110
+ 118
src/app/pages/user-modal.component.ts
- 117
+ 125
src/app/pages/user-modal.component.ts
- 123
+ 131
src/app/pages/user-modal.component.ts
- 131
+ 139
src/app/pages/workspace/components/edit/workspace-edit.component.ts
@@ -1607,67 +1645,67 @@
src/app/pages/user-modal.component.ts
- 151,152
+ 159,160
src/app/pages/user-modal.component.ts
- 223
+ 232
src/app/pages/user-modal.component.ts
- 228
+ 237
src/app/pages/user-modal.component.ts
- 236
+ 244
src/app/pages/user-modal.component.ts
- 375
+ 380
src/app/pages/user-modal.component.ts
- 388
+ 393
src/app/pages/user-modal.component.ts
- 385
+ 390
src/app/pages/user-modal.component.ts
- 456
+ 459
src/app/pages/user-modal.component.ts
- 459
+ 462
src/app/pages/user-modal.component.ts
- 469
+ 472
@@ -1675,21 +1713,21 @@
If you do not upload it now, you can also manually export the project data and import it into a new workspace later.
src/app/pages/user-modal.component.ts
- 470,471
+ 473,474
src/app/pages/user-modal.component.ts
- 480
+ 483
src/app/pages/user-modal.component.ts
- 525
+ 528
src/app/shared/store/effect.service.ts
@@ -2068,7 +2106,7 @@
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 45
+ 49
@Copy
@@ -2076,70 +2114,70 @@
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 55
+ 59
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 59
+ 63
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 67
+ 71
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 146
+ 154
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 155
+ 163
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 168
+ 176
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 169,171
+ 177,179
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 187
+ 195
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 197
+ 205
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 207
+ 215
src/app/pages/workspace/project/setting/project-setting.component.ts
@@ -2150,7 +2188,7 @@
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 213
+ 221
src/app/pages/workspace/project/setting/project-setting.component.ts
@@ -2206,6 +2244,13 @@
101
+
+
+
+ src/app/pages/workspace/project/api/env/env-edit/env-edit.component.ts
+ 115
+
+
@@ -2224,35 +2269,35 @@
src/app/pages/workspace/project/api/env/env-select/env-select.component.ts
- 34
+ 35
src/app/pages/workspace/project/api/env/env-select/env-select.component.ts
- 43
+ 44
src/app/pages/workspace/project/api/env/env-select/env-select.component.ts
- 46
+ 47
src/app/pages/workspace/project/api/env/env-select/env-select.component.ts
- 51
+ 52
src/app/pages/workspace/project/api/env/env-select/env-select.component.ts
- 79
+ 80
@@ -2896,28 +2941,28 @@
src/app/pages/workspace/project/api/websocket/websocket.component.ts
- 266
+ 288
src/app/pages/workspace/project/api/websocket/websocket.component.ts
- 313
+ 335
src/app/pages/workspace/project/api/websocket/websocket.component.ts
- 314
+ 336
src/app/pages/workspace/project/api/websocket/websocket.component.ts
- 326
+ 348
diff --git a/src/workbench/browser/src/app/pages/workspace/project/api/api-tab.service.ts b/src/workbench/browser/src/app/pages/workspace/project/api/api-tab.service.ts
index 6b40731c..b9115a07 100644
--- a/src/workbench/browser/src/app/pages/workspace/project/api/api-tab.service.ts
+++ b/src/workbench/browser/src/app/pages/workspace/project/api/api-tab.service.ts
@@ -105,6 +105,13 @@ export class ApiTabService {
}
}
}
+ batchCloseTabById(uuidList) {
+ const result = this.apiTabComponent
+ .getTabs()
+ .filter(it => uuidList.includes(it.params.uuid))
+ .map(it => it.uuid);
+ this.apiTabComponent.batchCloseTab(result);
+ }
onChildComponentInit(componentRef) {
this.componentRef = componentRef;
}
diff --git a/src/workbench/browser/src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts b/src/workbench/browser/src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
index ba7a9a0d..264fc04c 100644
--- a/src/workbench/browser/src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
+++ b/src/workbench/browser/src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
@@ -3,6 +3,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import { EoNgFeedbackMessageService } from 'eo-ng-feedback';
import { requestMethodMap } from 'eo/workbench/browser/src/app/modules/api-shared/api.model';
import { ImportApiComponent } from 'eo/workbench/browser/src/app/modules/extension-select/import-api/import-api.component';
+import { ApiTabService } from 'eo/workbench/browser/src/app/pages/workspace/project/api/api-tab.service';
import { ApiGroupEditComponent } from 'eo/workbench/browser/src/app/pages/workspace/project/api/components/group/edit/api-group-edit.component';
import { ModalService } from 'eo/workbench/browser/src/app/shared/services/modal.service';
import { GroupCreateDto, GroupUpdateDto } from 'eo/workbench/browser/src/app/shared/services/storage/db/dto/group.dto';
@@ -20,9 +21,7 @@ import { ApiStoreService } from '../../../service/store/api-state.service';
export type GroupAction = 'new' | 'edit' | 'delete';
-const getAllAPIId = ({ id, children = [] }) => {
- return [id, ...children.map(getAllAPIId)];
-};
+const getAllAPIId = ({ id, children = [] }: any) => [id, ...children.map(getAllAPIId)];
@Component({
selector: 'pc-api-group-tree',
templateUrl: './api-group-tree.component.html',
@@ -82,6 +81,7 @@ export class ApiGroupTreeComponent implements OnInit {
private modalService: ModalService,
private router: Router,
private route: ActivatedRoute,
+ private tab: ApiTabService,
private message: EoNgFeedbackMessageService
) {}
@@ -140,8 +140,10 @@ export class ApiGroupTreeComponent implements OnInit {
nzContent: ApiGroupEditComponent,
nzComponentParams: params,
nzOnOk: () => {
- console.log('this.apiGroupTree', params.group);
- // const idList = getAllAPIId(params.group)
+ if (params.action === 'delete') {
+ const idList = [...new Set(getAllAPIId(params.group).flat(Infinity))];
+ this.tab.batchCloseTabById(idList);
+ }
return modal.componentInstance.submit().then(data => {
if (params.action !== 'new') return;
this.expandKeys = [...(this.expandKeys || []), modal.componentInstance.group.parentId];
From 92671ba463dd9f647adb681f76e4e9d0f169c18b Mon Sep 17 00:00:00 2001
From: scarqin <1054139596@qq.com>
Date: Thu, 9 Feb 2023 16:35:43 +0800
Subject: [PATCH 2/2] wip: translate
---
src/workbench/browser/locale/messages.xlf | 83 +++-
src/workbench/browser/locale/messages.zh.xlf | 358 +++++++++++-------
.../select/extension-select.component.html | 2 +-
.../select-theme/select-theme.component.ts | 4 +-
.../app/pages/extension/extension.model.ts | 18 +-
.../src/app/shared/store/effect.service.ts | 1 +
6 files changed, 299 insertions(+), 167 deletions(-)
diff --git a/src/workbench/browser/locale/messages.xlf b/src/workbench/browser/locale/messages.xlf
index 935750bc..256e82ab 100644
--- a/src/workbench/browser/locale/messages.xlf
+++ b/src/workbench/browser/locale/messages.xlf
@@ -965,11 +965,11 @@
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 45
+ 44
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 67
+ 66
@@ -996,7 +996,7 @@
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 53
+ 52
src/app/pages/workspace/project/api/components/history/eo-history.component.html
@@ -1059,11 +1059,15 @@
-
+
src/app/modules/extension-select/select/extension-select.component.html
48,49
+
+ src/app/modules/system-setting/common/select-theme/select-theme.component.ts
+ 47,48
+
@@ -1464,6 +1468,47 @@
27
+
+
+
+ src/app/pages/extension/extension.model.ts
+ 25
+
+
+ src/app/pages/extension/extension.model.ts
+ 29
+
+
+ src/app/pages/extension/extension.model.ts
+ 33
+
+
+ src/app/pages/extension/extension.model.ts
+ 37
+
+
+ src/app/pages/extension/extension.model.ts
+ 48
+
+
+ src/app/pages/extension/extension.model.ts
+ 60
+
+
+
+
+
+ src/app/pages/extension/extension.model.ts
+ 52
+
+
+
+
+
+ src/app/pages/extension/extension.model.ts
+ 56
+
+
@@ -1731,7 +1776,7 @@
src/app/shared/store/effect.service.ts
- 218
+ 219
@@ -2106,7 +2151,7 @@
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 49
+ 48
@Copy
@@ -2114,70 +2159,70 @@
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 59
+ 58
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 63
+ 62
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 71
+ 70
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 154
+ 155
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 163
+ 164
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 176
+ 177
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 177,179
+ 178,180
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 195
+ 196
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 205
+ 206
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 215
+ 216
src/app/pages/workspace/project/setting/project-setting.component.ts
@@ -2188,7 +2233,7 @@
src/app/pages/workspace/project/api/components/group/tree/api-group-tree.component.ts
- 221
+ 222
src/app/pages/workspace/project/setting/project-setting.component.ts
@@ -3158,6 +3203,10 @@
src/app/shared/services/storage/db/services/workspace.service.ts
16
+
+ src/app/shared/store/effect.service.ts
+ 36
+