Skip to content

Commit

Permalink
fix: 2 bug about env
Browse files Browse the repository at this point in the history
  • Loading branch information
kungfuboy committed Jun 29, 2022
1 parent c17d208 commit 8c76192
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,14 @@
<iconpark-icon name="plus"></iconpark-icon>
</div>
</div>
<div
*ngFor="let item of envList"
class="flex items-center justify-between p-2 env-item"
(click)="handleSwitchEnv(item.uuid)"
>
<span class="name">{{ item.name }}</span>
<a nz-popconfirm nzPopconfirmTitle="是否确定删除?" (nzOnConfirm)="handleDeleteEnv(item.uuid)">
<div *ngFor="let item of envList" class="flex items-center justify-between p-2 env-item">
<span class="flex-1 name" (click)="handleEditEnv(item.uuid)">{{ item.name }}</span>
<a nz-popconfirm nzPopconfirmTitle="是否确定删除?" (nzOnConfirm)="handleDeleteEnv($event, item.uuid)">
<iconpark-icon name="delete"></iconpark-icon>
</a>
</div>
</div>
<nz-modal [(nzVisible)]="isVisible" nzWidth="70%" nzTitle="环境详情" (nzOnCancel)="handleCancel()">
<nz-modal [(nzVisible)]="isVisible" nzWidth="70%" [nzTitle]="modalTitle" (nzOnCancel)="handleCancel()">
<section *nzModalContent class="flex">
<div class="main-content">
<form nz-form nzLayout="vertical">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { Subject } from 'rxjs';
export class EnvComponent implements OnInit, OnDestroy {
@ViewChild('table') table: EoTableComponent; // * child component ref
varName = `{{变量名}}`;
modalTitle = 'New Environment';
isVisible = false;
/** 是否打开下拉菜单 */
isOpen = false;
Expand Down Expand Up @@ -73,7 +74,8 @@ export class EnvComponent implements OnInit, OnDestroy {
});
}

handleDeleteEnv(uuid: string) {
handleDeleteEnv($event, uuid: string) {
$event.stopPropagation();
// * delete env in menu on left sidebar
this.storage.run('environmentRemove', [uuid], async (result: StorageRes) => {
if (result.status === StorageResStatus.success) {
Expand All @@ -89,7 +91,8 @@ export class EnvComponent implements OnInit, OnDestroy {
const data = JSON.parse(JSON.stringify(this.envInfo.parameters));
this.envInfo.parameters = data.filter((it, i) => i !== index);
}
handleSwitchEnv(uuid) {
handleEditEnv(uuid) {
this.modalTitle = 'Edit Environment';
this.handleShowModal();
// * switch env in menu on left sidebar
return new Promise((resolve) => {
Expand All @@ -112,6 +115,7 @@ export class EnvComponent implements OnInit, OnDestroy {
hostUri: '',
parameters: [],
};
this.modalTitle = 'New Environment';
this.activeUuid = null;
this.handleShowModal();
}
Expand Down Expand Up @@ -172,7 +176,7 @@ export class EnvComponent implements OnInit, OnDestroy {
handleEnvSelectStatus(event: boolean) {
if (event) {
this.activeUuid = this.envUuid;
this.handleSwitchEnv(this.activeUuid);
this.handleEditEnv(this.activeUuid);
this.getAllEnv();
}
}
Expand Down

0 comments on commit 8c76192

Please sign in to comment.