fix(websocket-test): leave modal tips every time

This commit is contained in:
scarqin 2023-04-03 22:29:13 +08:00
parent fadc79a3b3
commit 4bb56e31c3
13 changed files with 63 additions and 52 deletions

View File

@ -72,6 +72,7 @@ jobs:
# cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
echo "${{ secrets.NOTARIZE_JS }}" > scripts/notarize.js
yarn release
yarn upload
# clean up keychain and provisioning profile
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
@ -80,5 +81,6 @@ jobs:
if: matrix.os == 'ubuntu-latest'
run: |
yarn release
yarn upload
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

View File

@ -24,7 +24,8 @@
"build:win:noSign": "npm run clear:electron:tsc&&npm run electron:tsc && npx esno scripts/buildNoSign.ts",
"electron:build:browser": "yarn workspace postcat-web run build",
"electron:static": "npm run electron:tsc && electron .",
"release": "npm-run-all -s electron:build:browser electron:tsc && npx esno scripts/build.ts --publish=always && node scripts/upload.js",
"release": "npm-run-all -s electron:build:browser electron:tsc && npx esno scripts/build.ts --publish=always",
"upload":"node scripts/upload.js",
"test": "npm-run-all --serial test:*",
"e2e": "cd test/e2e&&npx playwright test -c playwright.config.ts",
"test:e2e": "yarn e2e",

View File

@ -39,6 +39,7 @@ EOF
`,
'yarn install',
'yarn release',
`yarn upload`,
`nvm use ${originNodeVersion}`,
'echo Windows 打包发布完成!'
].join('\r\n')

View File

@ -139,7 +139,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/websocket/websocket.component.ts</context>
<context context-type="linenumber">328</context>
<context context-type="linenumber">330</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/setting/project-setting.component.ts</context>
@ -1692,11 +1692,11 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/api-mock.service.ts</context>
<context context-type="linenumber">137</context>
<context context-type="linenumber">135</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/store/api-effect.service.ts</context>
<context context-type="linenumber">249</context>
<context context-type="linenumber">254</context>
</context-group>
</trans-unit>
<trans-unit id="3760759931647245335" datatype="html">
@ -1707,7 +1707,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/api-mock.service.ts</context>
<context context-type="linenumber">140</context>
<context context-type="linenumber">138</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/store/api-effect.service.ts</context>
@ -1715,7 +1715,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/store/api-effect.service.ts</context>
<context context-type="linenumber">252</context>
<context context-type="linenumber">257</context>
</context-group>
</trans-unit>
<trans-unit id="1075865176616456400" datatype="html">
@ -1918,7 +1918,7 @@
<context context-type="linenumber">39</context>
</context-group>
</trans-unit>
<trans-unit id="AddGroup" datatype="html">
<trans-unit id="NewGroupTitle" datatype="html">
<source>New Group</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/api-tab.service.ts</context>
@ -1965,7 +1965,7 @@
<context context-type="linenumber">248</context>
</context-group>
</trans-unit>
<trans-unit id="238943392198923505" datatype="html">
<trans-unit id="NewMockTitle" datatype="html">
<source>New Mock</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/api-tab.service.ts</context>
@ -1973,7 +1973,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/api-mock.service.ts</context>
<context context-type="linenumber">113</context>
<context context-type="linenumber">111</context>
</context-group>
</trans-unit>
<trans-unit id="5968366500418000730" datatype="html">
@ -2082,7 +2082,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/mock.component.ts</context>
<context context-type="linenumber">200</context>
<context context-type="linenumber">207</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/setting/project-setting.component.ts</context>
@ -2101,7 +2101,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/api-mock.service.ts</context>
<context context-type="linenumber">124</context>
<context context-type="linenumber">122</context>
</context-group>
</trans-unit>
<trans-unit id="5719912962272225542" datatype="html">
@ -2120,7 +2120,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/api-mock.service.ts</context>
<context context-type="linenumber">127</context>
<context context-type="linenumber">125</context>
</context-group>
</trans-unit>
<trans-unit id="6112087277983123757" datatype="html">
@ -2387,7 +2387,7 @@
<context context-type="linenumber">33</context>
</context-group>
</trans-unit>
<trans-unit id="4150099050666823002" datatype="html">
<trans-unit id="AddGroup" datatype="html">
<source>New Group</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/components/group/api-group-tree.component.html</context>
@ -3107,21 +3107,21 @@
<source>Postcat Client is required to use Mock.</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/mock.component.ts</context>
<context context-type="linenumber">59</context>
<context context-type="linenumber">60</context>
</context-group>
</trans-unit>
<trans-unit id="3093336489628866803" datatype="html">
<source>Use Client</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/mock.component.ts</context>
<context context-type="linenumber">60</context>
<context context-type="linenumber">61</context>
</context-group>
</trans-unit>
<trans-unit id="1707787219287117667" datatype="html">
<source>No change in data</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/mock.component.ts</context>
<context context-type="linenumber">177</context>
<context context-type="linenumber">184</context>
</context-group>
</trans-unit>
<trans-unit id="9142685431369791033" datatype="html">
@ -3465,7 +3465,7 @@
If the current test URL is a local API, please download the desktop and re-initiate the test.</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/service/test-server/test-server.service.ts</context>
<context context-type="linenumber">145</context>
<context context-type="linenumber">150</context>
</context-group>
</trans-unit>
<trans-unit id="1555979633549170381" datatype="html">
@ -3567,21 +3567,21 @@ If the current test URL is a local API, please download the desktop and re-initi
<source>Do you want to leave the page?</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/websocket/websocket.component.ts</context>
<context context-type="linenumber">323</context>
<context context-type="linenumber">325</context>
</context-group>
</trans-unit>
<trans-unit id="3828705763082853823" datatype="html">
<source>After leaving, the current long connection is no longer maintained, whether to confirm to leave?</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/websocket/websocket.component.ts</context>
<context context-type="linenumber">324</context>
<context context-type="linenumber">326</context>
</context-group>
</trans-unit>
<trans-unit id="2273088133016853024" datatype="html">
<source>Leave</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/websocket/websocket.component.ts</context>
<context context-type="linenumber">336</context>
<context context-type="linenumber">338</context>
</context-group>
</trans-unit>
<trans-unit id="4157564596155275219" datatype="html">

View File

@ -154,7 +154,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/websocket/websocket.component.ts</context>
<context context-type="linenumber">328</context>
<context context-type="linenumber">330</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/setting/project-setting.component.ts</context>
@ -1884,11 +1884,11 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/api-mock.service.ts</context>
<context context-type="linenumber">137</context>
<context context-type="linenumber">135</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/store/api-effect.service.ts</context>
<context context-type="linenumber">249</context>
<context context-type="linenumber">254</context>
</context-group>
<target state="translated">删除失败</target>
</trans-unit>
@ -1900,7 +1900,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/api-mock.service.ts</context>
<context context-type="linenumber">140</context>
<context context-type="linenumber">138</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/store/api-effect.service.ts</context>
@ -1908,7 +1908,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/store/api-effect.service.ts</context>
<context context-type="linenumber">252</context>
<context context-type="linenumber">257</context>
</context-group>
<target state="translated">删除成功</target>
</trans-unit>
@ -2132,7 +2132,7 @@
</context-group>
<target state="translated">新建环境</target>
</trans-unit>
<trans-unit id="AddGroup" datatype="html">
<trans-unit id="NewGroupTitle" datatype="html">
<source>New Group</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/api-tab.service.ts</context>
@ -2168,7 +2168,7 @@
</context-group>
<target state="translated">测试 Websocket</target>
</trans-unit>
<trans-unit id="5342917002778887163" datatype="html">
<trans-unit id="5342917002778887163" datatype="html" approved="yes">
<source>New Case</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/api-tab.service.ts</context>
@ -2182,9 +2182,9 @@
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/test/api-test.component.ts</context>
<context context-type="linenumber">248</context>
</context-group>
<target state="translated">新建用例</target>
<target state="final">新建用例</target>
</trans-unit>
<trans-unit id="238943392198923505" datatype="html">
<trans-unit id="NewMockTitle" datatype="html">
<source>New Mock</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/api-tab.service.ts</context>
@ -2192,7 +2192,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/api-mock.service.ts</context>
<context context-type="linenumber">113</context>
<context context-type="linenumber">111</context>
</context-group>
<target state="translated">新建 Mock</target>
</trans-unit>
@ -2312,7 +2312,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/mock.component.ts</context>
<context context-type="linenumber">200</context>
<context context-type="linenumber">207</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/setting/project-setting.component.ts</context>
@ -2332,7 +2332,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/api-mock.service.ts</context>
<context context-type="linenumber">124</context>
<context context-type="linenumber">122</context>
</context-group>
<target state="translated">添加失败</target>
</trans-unit>
@ -2352,7 +2352,7 @@
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/api-mock.service.ts</context>
<context context-type="linenumber">127</context>
<context context-type="linenumber">125</context>
</context-group>
<target state="translated">添加成功</target>
</trans-unit>
@ -2652,7 +2652,7 @@
</context-group>
<target state="translated"> 新建 API </target>
</trans-unit>
<trans-unit id="4150099050666823002" datatype="html">
<trans-unit id="AddGroup" datatype="html">
<source>New Group</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/components/group/api-group-tree.component.html</context>
@ -3453,7 +3453,7 @@
<source>Postcat Client is required to use Mock.</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/mock.component.ts</context>
<context context-type="linenumber">59</context>
<context context-type="linenumber">60</context>
</context-group>
<target state="translated">Mock 需要下载 Postcat 客户端.</target>
</trans-unit>
@ -3461,7 +3461,7 @@
<source>Use Client</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/mock.component.ts</context>
<context context-type="linenumber">60</context>
<context context-type="linenumber">61</context>
</context-group>
<target state="translated">使用客户端</target>
</trans-unit>
@ -3469,7 +3469,7 @@
<source>No change in data</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/http/mock/mock.component.ts</context>
<context context-type="linenumber">177</context>
<context context-type="linenumber">184</context>
</context-group>
<target state="translated">数据无变化</target>
</trans-unit>
@ -3854,7 +3854,7 @@
If the current test URL is a local API, please download the desktop and re-initiate the test.</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/service/test-server/test-server.service.ts</context>
<context context-type="linenumber">145</context>
<context context-type="linenumber">150</context>
</context-group>
<target state="translated">服务连接失败。
当前正在使用服务器测试,如果当前测试 URL 为 本地 API请下载桌面端后重新发起测试。</target>
@ -3971,7 +3971,7 @@ If the current test URL is a local API, please download the desktop and re-initi
<source>Do you want to leave the page?</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/websocket/websocket.component.ts</context>
<context context-type="linenumber">323</context>
<context context-type="linenumber">325</context>
</context-group>
<target state="translated">你想要离开当前页面吗?</target>
</trans-unit>
@ -3979,7 +3979,7 @@ If the current test URL is a local API, please download the desktop and re-initi
<source>After leaving, the current long connection is no longer maintained, whether to confirm to leave?</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/websocket/websocket.component.ts</context>
<context context-type="linenumber">324</context>
<context context-type="linenumber">326</context>
</context-group>
<target state="translated">当前的长连接将会断开,是否确认离开?</target>
</trans-unit>
@ -3987,7 +3987,7 @@ If the current test URL is a local API, please download the desktop and re-initi
<source>Leave</source>
<context-group purpose="location">
<context context-type="sourcefile">src/app/pages/workspace/project/api/websocket/websocket.component.ts</context>
<context context-type="linenumber">336</context>
<context context-type="linenumber">338</context>
</context-group>
<target state="translated">离开</target>
</trans-unit>

View File

@ -43,7 +43,7 @@ export const API_TABS: Array<Partial<TabItem>> = [
uniqueName: PageUniqueName.GroupEdit,
type: 'edit',
icon: 'folder-close',
title: $localize`:@@AddGroup:New Group`
title: $localize`:@@NewGroupTitle:New Group`
},
{
pathname: '/http/edit',
@ -62,7 +62,7 @@ export const API_TABS: Array<Partial<TabItem>> = [
title: $localize`New Websocket`
},
{ pathname: '/http/case', icon: 'diy-test', uniqueName: PageUniqueName.HttpCase, type: 'edit', title: $localize`New Case` },
{ pathname: '/http/mock', icon: 'mock', uniqueName: PageUniqueName.HttpMock, type: 'edit', title: $localize`New Mock` }
{ pathname: '/http/mock', icon: 'mock', uniqueName: PageUniqueName.HttpMock, type: 'edit', title: $localize`:@@NewMockTitle:New Mock` }
];
interface TabEvent {
when: 'activated' | 'editing' | 'saved' | 'afterTested';

View File

@ -33,7 +33,7 @@
<li nz-menu-item i18n="@@AddAPI" (click)="projectApi.toAdd()"> New API </li>
</a>
<a>
<li nz-menu-item (click)="groupService.toAdd()" i18n>New Group</li>
<li nz-menu-item (click)="groupService.toAdd()" i18n="@@AddGroup">New Group</li>
</a>
<li nz-menu-divider></li>
<a *ngFor="let item of extensionActions">

View File

@ -93,7 +93,7 @@ export class GroupComponent implements OnDestroy, EditTabViewComponent {
const [data] = await this.effect.addGroup([
{
type: 1,
name: $localize`:@@AddGroup:New Group`,
name: $localize`:@@NewGroupTitle:New Group`,
parentId: Number(parentId)
}
]);

View File

@ -108,7 +108,7 @@ export class ApiMockService {
// });
const apiData = await this.projectApi.get(apiUuid);
const data = {
name: $localize`New Mock`,
name: $localize`:@@NewMockTitle:New Mock`,
response: this.getMockResponseByAPI(apiData),
apiUuid: apiUuid
};

View File

@ -75,9 +75,9 @@ const COMPONENTS = [
if (electron.isElectron) {
return new TestServerLocalNodeService(electron, locale, test);
} else if (!web.isVercel) {
return new TestServerRemoteService(locale, test);
return new TestServerRemoteService(electron, locale, test);
} else {
return new TestServerServerlessService(locale, test);
return new TestServerServerlessService(electron, locale, test);
}
},
deps: [ElectronService, WebService, LOCALE_ID, ApiTestUtilService]

View File

@ -6,8 +6,8 @@ import { ApiTestUtilService } from '../../api-test-util.service';
import { TestServerService } from '../test-server.service';
@Injectable()
export class TestServerLocalNodeService extends TestServerService {
constructor(private electron: ElectronService, @Inject(LOCALE_ID) public locale: string, public apiTestUtil: ApiTestUtilService) {
super(locale, apiTestUtil);
constructor(public electron: ElectronService, @Inject(LOCALE_ID) public locale: string, public apiTestUtil: ApiTestUtilService) {
super(electron, locale, apiTestUtil);
}
init(receiveMessage: (message) => void) {
this.electron.ipcRenderer.on('unitTest', (event, args) => {

View File

@ -1,5 +1,6 @@
import { formatDate } from '@angular/common';
import { Inject, Injectable, Input, LOCALE_ID } from '@angular/core';
import { ElectronService } from 'pc/browser/src/app/core/services';
import {
ApiBodyType,
ApiParamsType,
@ -20,7 +21,11 @@ import { TestLocalNodeData } from './local-node/api-server-data.model';
@Injectable()
export abstract class TestServerService implements TestServer {
constructor(@Inject(LOCALE_ID) protected locale: string, protected apiTestUtil: ApiTestUtilService) {}
constructor(
protected electron: ElectronService,
@Inject(LOCALE_ID) protected locale: string,
protected apiTestUtil: ApiTestUtilService
) {}
abstract init(receiveMessage: (message: any) => void): void;
abstract send(action: string, message: any): void;
formatRequestData(data: Partial<ApiData>, opts: requestDataOpts = { env: {}, lang: 'en', globals: {} }) {
@ -141,7 +146,7 @@ export abstract class TestServerService implements TestServer {
}
};
if (response.statusCode === 0) {
if (response.statusCode === 0 && !this.electron.isElectron) {
response.body = $localize`Service connection failed. The server test is currently being used.\nIf the current test URL is a local API, please download the desktop and re-initiate the test.`;
}
result = {

View File

@ -314,10 +314,12 @@ export class WebsocketComponent implements OnInit, OnDestroy, EditTabViewCompone
return new Promise(resolve => {
if (this.leaveModal) {
resolve(false);
return;
}
const isCloseOther = closeTarget?.uuid && closeTarget.uuid !== this.tabOperate.getCurrentTab().uuid;
if (this.wsStatus === 'disconnect' || isCloseOther) {
resolve(true);
return;
}
this.leaveModal = this.modal.create({
nzTitle: $localize`Do you want to leave the page?`,