Skip to content

Commit

Permalink
feat: merge
Browse files Browse the repository at this point in the history
  • Loading branch information
scarqin committed Feb 15, 2023
2 parents 8f063bb + fcd09fa commit cfe1f2f
Show file tree
Hide file tree
Showing 73 changed files with 1,887 additions and 1,350 deletions.
1,006 changes: 527 additions & 479 deletions src/workbench/browser/locale/messages.xlf

Large diffs are not rendered by default.

1,138 changes: 606 additions & 532 deletions src/workbench/browser/locale/messages.zh.xlf

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class ElectronService {
}

get isElectron(): boolean {
return !!window?.electron;
return !!window.electron;
}
getSystemInfo(): DescriptionsItem[] {
const descriptions: DescriptionsItem[] = [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<nz-breadcrumb class="flex items-center">
<eo-select-workspace class="mr-[10px]"></eo-select-workspace>
<nz-breadcrumb-item *ngIf="store.getPageLevel === 'project'" class="flex items-center btn-breadcrumb-item">
<button [routerLink]="['/home/workspace/overview']" [queryParams]="{ wid: workspaceID }" eo-ng-button nzType="text">
<button [routerLink]="['/home/workspace/overview/projects']" [queryParams]="{ wid: workspaceID }" eo-ng-button nzType="text">
<eo-iconpark-icon class="mr-[5px]" name="return"></eo-iconpark-icon>
<span i18n>Back</span>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import { StoreService } from '../../../shared/store/state.service';
selector: 'pc-btn-user',
template: `
<ng-container *ngIf="feature.config.cloudFeature">
<button *ngIf="!store.isLogin" eo-ng-button nzType="default" (click)="loginOrSign()" i18n>Sign in/Up</button>
<button *ngIf="!store.isLogin" eo-ng-button nzType="default" (click)="loginOrSign()" traceID="click_register" trace i18n
>Sign in/Up</button
>
<button
*ngIf="store.isLogin"
eo-ng-button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import { DataSourceService } from '../../shared/services/data-source/data-source
nzPopoverOverlayClassName="background-popover"
nzPopoverTrigger="click"
(click)="handleGetShareLink()"
trace
traceID="click_share"
i18n
>
Share
Expand All @@ -36,7 +38,9 @@ import { DataSourceService } from '../../shared/services/data-source/data-source
<span class="truncate flex-1">
{{ link }}
</span>
<button eo-ng-button nzType="text" (click)="handleCopy()"><eo-iconpark-icon name="copy"></eo-iconpark-icon></button>
<button eo-ng-button nzType="text" trace traceID="copy_share_link" (click)="handleCopy()"
><eo-iconpark-icon name="copy"></eo-iconpark-icon
></button>
</ng-container>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import { ElectronService } from '../../../core/services';
target="_blank"
nz-menu-item
i18n
trace
traceID="report_issue"
>Report Issue</a
>
</ul>
Expand All @@ -42,15 +44,13 @@ export class HelpDropdownComponent {
}
private getEnvironment(): string {
let result = '';
console.log(this);
const systemInfo = this.electron?.getSystemInfo();
systemInfo?.forEach(val => {
if (['homeDir'].includes(val.id)) {
return;
}
result += `- ${val.label}: ${val.value}\r\n`;
});
console.log(systemInfo);
return encodeURIComponent(result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
<div class="flex items-center">
<eo-logo class="logo"></eo-logo>
<!-- Star -->
<a href="https://github.com/Postcatlab/postcat" target="_blank" class="flex items-center ml-[15px] electron-can-be-click">
<a
href="https://github.com/Postcatlab/postcat"
target="_blank"
class="flex items-center ml-[15px] electron-can-be-click"
trace
traceID="jump_to_github"
>
<img loading="lazy" src="https://img.shields.io/github/stars/Postcatlab/postcat?style=social" alt="" />
</a>
<eo-nav-breadcrumb class="ml-[15px] electron-can-be-click"></eo-nav-breadcrumb>
Expand All @@ -21,6 +27,8 @@
nzTooltipPlacement="bottom"
nzTooltipTitle="Extensions"
(click)="openExtension()"
trace
traceID="open_extensions"
i18n
>
Extensions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ export class ApiTableService {
}
initTestTable(
inArg: {
id: string;
in: 'body' | 'header' | 'query' | 'rest';
format?: 'FormData';
},
Expand Down Expand Up @@ -266,6 +267,7 @@ export class ApiTableService {
const result = {
columns: [],
setting: {
id: inArg.id,
primaryKey: 'name',
manualAdd: opts.manualAdd,
rowSortable: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export class ApiTestFormComponent implements OnInit, OnDestroy {
}
private initListConf() {
const config = this.apiTable.initTestTable({
in: this.module
in: this.module,
id: `api_test_${module}`
});
this.listConf.columns = config.columns;
this.listConf.setting = config.setting;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ import { ElectronService, WebService } from '../../core/services';
<eo-ng-dropdown-menu #download="nzDropdownMenu">
<ul nz-menu>
<ng-container *ngFor="let item of resourceInfo; let index = index">
<a [href]="item.link" nz-menu-item>{{ item.name }}</a>
<a [href]="item.link" traceID="download_client" [traceParams]="{ client_system: item.name }" trace nz-menu-item>{{
item.name
}}</a>
</ng-container>
</ul>
</eo-ng-dropdown-menu></ng-container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { EoNgButtonModule } from 'eo-ng-button';
import { EoNgDropdownModule } from 'eo-ng-dropdown';
import { SharedModule } from 'eo/workbench/browser/src/app/shared/shared.module';

import { EoIconparkIconModule } from '../eo-ui/iconpark-icon/eo-iconpark-icon.module';
import { DownloadClientComponent } from './download-client.component';

@NgModule({
imports: [CommonModule, EoIconparkIconModule, EoNgButtonModule, EoNgDropdownModule],
imports: [CommonModule, EoIconparkIconModule, SharedModule, EoNgButtonModule, EoNgDropdownModule],
declarations: [DownloadClientComponent],
exports: [DownloadClientComponent]
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { MessageService } from 'eo/workbench/browser/src/app/shared/services/mes
import { eoDeepCopy } from 'eo/workbench/browser/src/app/utils/index.utils';
import { APP_CONFIG } from 'eo/workbench/browser/src/environments/environment';

import { existsSync } from 'fs';
/**
* Tab service operate tabs array add/replace/close...
* Tab change by url change(router event)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { NavigationEnd, Router } from '@angular/router';
import { TabOperateService } from 'eo/workbench/browser/src/app/modules/eo-ui/tab/tab-operate.service';
import { TabStorageService } from 'eo/workbench/browser/src/app/modules/eo-ui/tab/tab-storage.service';
import { TabItem, TabOperate } from 'eo/workbench/browser/src/app/modules/eo-ui/tab/tab.model';
import { TraceService } from 'eo/workbench/browser/src/app/shared/services/trace.service';
import { StoreService } from 'eo/workbench/browser/src/app/shared/store/state.service';
import { NzDropdownMenuComponent } from 'ng-zorro-antd/dropdown';
import { NzTabsCanDeactivateFn } from 'ng-zorro-antd/tabs';
Expand Down Expand Up @@ -33,7 +34,8 @@ export class EoTabComponent implements OnInit, OnDestroy {
public tabOperate: TabOperateService,
private modal: ModalService,
private router: Router,
public store: StoreService
public store: StoreService,
private trace: TraceService
) {}
ngOnInit(): void {
this.watchRouterChange();
Expand All @@ -54,6 +56,8 @@ export class EoTabComponent implements OnInit, OnDestroy {
if (this.tabStorage.tabOrder.length >= this.MAX_TAB_LIMIT) {
return;
}
// * Trace
this.trace.report('open_api_test');
this.tabOperate.newDefaultTab(key);
}
doubleClickTab($event, uuid) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
ViewChildren
} from '@angular/core';
import _, { attempt, has, isUndefined, omitBy } from 'lodash-es';
import { collectStoredAnnotations } from 'mobx/dist/internal';

import { eoDeepCopy } from '../../../utils/index.utils';
import StorageUtil from '../../../utils/storage/storage.utils';
Expand Down Expand Up @@ -227,9 +226,13 @@ export class EoTableProComponent implements OnInit, OnChanges {
* Remeber coloum size after resize
*/
nzResizeColumn(tableList) {
//* If the first column is sortable, the first column will be removed from the tableList
if (this.setting.rowSortable && this.columns[0].type !== 'sort') {
tableList = tableList.slice(1);
}
const widthByKey = {};
this.columns.forEach((val, key) => {
const headerCol = tableList[key];
const headerCol = tableList.find(col => col.title === val.title || col.key === val.key) || tableList[key];
if (headerCol.width) {
widthByKey[val.key || key] = headerCol.width;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { FeatureInfo } from 'eo/workbench/browser/src/app/shared/models/extensio
import { ExtensionService } from 'eo/workbench/browser/src/app/shared/services/extensions/extension.service';
import { Message, MessageService } from 'eo/workbench/browser/src/app/shared/services/message';
import { ApiService } from 'eo/workbench/browser/src/app/shared/services/storage/api.service';
import { TraceService } from 'eo/workbench/browser/src/app/shared/services/trace.service';
import { StoreService } from 'eo/workbench/browser/src/app/shared/store/state.service';
import StorageUtil from 'eo/workbench/browser/src/app/utils/storage/storage.utils';
import { has } from 'lodash-es';
import { Subject, takeUntil } from 'rxjs';
Expand All @@ -20,7 +22,13 @@ export class ExportApiComponent implements OnInit {
supportList: any[] = [];
featureMap: Map<string, FeatureInfo>;
private destroy$: Subject<void> = new Subject<void>();
constructor(private extensionService: ExtensionService, private apiService: ApiService, private messageService: MessageService) {}
constructor(
private extensionService: ExtensionService,
private apiService: ApiService,
private messageService: MessageService,
private trace: TraceService,
private store: StoreService
) {}
ngOnInit(): void {
this.initData();
this.messageService
Expand Down Expand Up @@ -89,6 +97,8 @@ export class ExportApiComponent implements OnInit {
if (filename) {
this.transferTextToFile(filename, output);
}
const workspace_type = this.store.isLocal ? 'local' : 'remote';
this.trace.report('export_project_success', { sync_platform: this.currentExtension, workspace_type });
callback(true);
} catch (e) {
console.error(e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import { EoIconparkIconModule } from '../eo-ui/iconpark-icon/eo-iconpark-icon.mo
import { ExportApiComponent } from './export-api/export-api.component';
import { ImportApiComponent } from './import-api/import-api.component';
import { ExtensionSelectComponent } from './select/extension-select.component';
import { SyncApiComponent } from './sync-api/sync-api.component';
import { PushApiComponent } from './sync-api/sync-api.component';

const COMPONENTS = [ExtensionSelectComponent, ExportApiComponent, ImportApiComponent, SyncApiComponent];
const COMPONENTS = [ExtensionSelectComponent, ExportApiComponent, ImportApiComponent, PushApiComponent];
@NgModule({
imports: [EoNgRadioModule, NzUploadModule, EoNgFeedbackTooltipModule, EoIconparkIconModule, CommonModule, FormsModule, SharedModule],
declarations: [...COMPONENTS]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import packageJson from '../../../../../../../../package.json';

@Component({
selector: 'eo-sync-api',
template: `<extension-select [(extension)]="currentExtension" tipsType="syncAPI" [extensionList]="supportList"></extension-select>`
template: `<extension-select [(extension)]="currentExtension" tipsType="pushAPI" [extensionList]="supportList"></extension-select>`
})
export class SyncApiComponent implements OnInit {
export class PushApiComponent implements OnInit {
currentExtension = '';
supportList: any[] = [];
featureMap: Map<string, FeatureInfo>;
Expand All @@ -37,7 +37,7 @@ export class SyncApiComponent implements OnInit {
});
}
initData = () => {
this.featureMap = this.extensionService.getValidExtensionsByFature('syncAPI');
this.featureMap = this.extensionService.getValidExtensionsByFature('pushAPI');
this.supportList = [];
this.featureMap?.forEach((data: FeatureInfo, key: string) => {
this.supportList.push({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { EoNgFeedbackMessageService } from 'eo-ng-feedback';
import { autorun } from 'mobx';
import { TraceService } from 'eo/workbench/browser/src/app/shared/services/trace.service';
import { autorun, reaction } from 'mobx';

import { StoreService } from '../../shared/store/state.service';
import { MemberService } from './member.service';
Expand Down Expand Up @@ -51,20 +52,34 @@ export class MemberListComponent implements OnInit {
list = [];
roleList = [];
loading = false;
constructor(public store: StoreService, private message: EoNgFeedbackMessageService, public member: MemberService) {}
constructor(
public store: StoreService,
private trace: TraceService,
private message: EoNgFeedbackMessageService,
public member: MemberService
) {}

ngOnInit(): void {
autorun(async () => {
if (this.store.isLogin) {
this.queryList();
} else {
this.list = [
{
username: 'Postcat'
}
];
this.updateList();

//! Use reaction not use autoRun,autoRun will cause loop
reaction(
() => this.store.isLogin,
async () => {
this.updateList();
}
});
);
}
updateList() {
if (this.store.isLogin) {
this.queryList();
} else {
this.list = [
{
username: 'Postcat'
}
];
}
}
async queryList(username = '') {
this.loading = true;
Expand All @@ -75,6 +90,7 @@ export class MemberListComponent implements OnInit {
const isOK: boolean = await this.member.changeRole(item);
if (isOK) {
this.message.success($localize`Change role successfully`);
this.trace.report('switch_member_permission');
this.queryList();
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import { ElectronService } from '../../../core/services';
<p class="font-bold mt-[15px] text-[16px]">Postcat</p>
<p class="">V{{ versionInfo?.version }}</p>
<!-- star -->
<a href="https://github.com/Postcatlab/postcat" target="_blank" class="flex items-center mt-[15px]">
<a href="https://github.com/Postcatlab/postcat" target="_blank" class="flex items-center mt-[15px]" trace traceID="jump_to_github">
<img loading="lazy" class="mx-4" src="https://img.shields.io/github/stars/Postcatlab/postcat?style=social" alt="" />
</a>
<p i18n class="text-center mt-[15px]">
Hi!~ If you like <b>Postcat</b>, please give the Postcat a Star!<br />Your support is our greatest motivation~
</p>
<a class="favor-image-link mt-[15px]" target="_blank" href="https://github.com/Postcatlab/postcat">
<a class="favor-image-link mt-[15px]" target="_blank" href="https://github.com/Postcatlab/postcat" trace traceID="jump_to_github">
<img loading="lazy" class="w-[40px] favor-image align-middle" src="assets/images/heart.png" />
</a>
<nz-divider></nz-divider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { StoreService } from 'eo/workbench/browser/src/app/shared/store/state.se
<form nz-form [formGroup]="validatePasswordForm" nzLayout="vertical">
<nz-form-item>
<nz-form-label [nzSpan]="24" nzRequired i18n>New password</nz-form-label>
<nz-form-control nzErrorTip="Please input your new password">
<nz-form-control i18n-nzErrorTip nzErrorTip="Please input your new password">
<input type="password" eo-ng-input formControlName="newPassword" placeholder="" i18n-placeholder />
</nz-form-control>
</nz-form-item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ enum LoginType {
class="h-10"
nzType="primary"
nzBlock
nzGhost
nzSize="large"
(click)="handleLogin('github')"
nzGhost
traceID="click_login_github"
trace
i18n
>
Sign In/Up with Github
Expand All @@ -43,6 +45,8 @@ enum LoginType {
class="w-8 h-8 rounded-full bg-center bg-no-repeat bg-cover cursor-pointer border-none"
*ngFor="let it of renderList"
(click)="handleLogin(it.type)"
trace
[traceID]="'click_login_' + it.type"
[ngStyle]="{ 'background-image': logoLink(it.logo) }"
>
</button>
Expand Down
Loading

0 comments on commit cfe1f2f

Please sign in to comment.