mirror of
https://gitee.com/eolink_admin/postcat.git
synced 2024-12-02 03:38:03 +08:00
Fix the problem that the env can‘t be switched
This commit is contained in:
parent
448595e3e8
commit
6ed46b8c09
@ -121,10 +121,9 @@ export class ApiTestComponent implements OnInit, OnDestroy {
|
||||
this.resetApi();
|
||||
this.initBasicForm();
|
||||
this.watchApiChange();
|
||||
// this.watchEnvChange();
|
||||
this.env$.subscribe((data) => {
|
||||
console.log('||=>', data);
|
||||
// this.env = data.env;
|
||||
const { env } = data;
|
||||
this.env = env;
|
||||
});
|
||||
}
|
||||
ngOnDestroy() {
|
||||
@ -232,18 +231,4 @@ export class ApiTestComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
});
|
||||
}
|
||||
// private watchEnvChange() {
|
||||
// this.messageService
|
||||
// .get()
|
||||
// .pipe(takeUntil(this.destroy$))
|
||||
// .subscribe(({ type, data }: Message) => {
|
||||
// if (type === 'changeEnv') {
|
||||
// this.env = data || {
|
||||
// parameters: [],
|
||||
// frontURI: '',
|
||||
// };
|
||||
// }
|
||||
// });
|
||||
// this.messageService.send({ type: 'getEnv', data: '' });
|
||||
// }
|
||||
}
|
||||
|
22
src/app/pages/env/env.component.ts
vendored
22
src/app/pages/env/env.component.ts
vendored
@ -43,9 +43,7 @@ export class EnvComponent implements OnInit, OnDestroy {
|
||||
return this.activeUuid || 0;
|
||||
}
|
||||
set envUuid(value) {
|
||||
console.log('value', value);
|
||||
this.activeUuid = value || 0;
|
||||
// this.emitChangeEnv(this.activeUuid);
|
||||
this.handleSwitchEnv(this.activeUuid);
|
||||
this.changeStoreEnv(this.activeUuid);
|
||||
localStorage.setItem('env:selected', this.activeUuid.toString());
|
||||
@ -53,16 +51,7 @@ export class EnvComponent implements OnInit, OnDestroy {
|
||||
|
||||
ngOnInit(): void {
|
||||
this.getAllEnv();
|
||||
this.envUuid = Number(localStorage.getItem('env:selected'));
|
||||
// this.changeStoreEnv(this.envUuid);
|
||||
// this.messageService
|
||||
// .get()
|
||||
// .pipe(takeUntil(this.destroy$))
|
||||
// .subscribe((data) => {
|
||||
// if (data.type === 'getEnv') {
|
||||
// this.emitChangeEnv(this.envUuid);
|
||||
// }
|
||||
// });
|
||||
// this.envUuid = Number(localStorage.getItem('env:selected'));
|
||||
}
|
||||
ngOnDestroy() {
|
||||
this.destroy$.next();
|
||||
@ -77,8 +66,7 @@ export class EnvComponent implements OnInit, OnDestroy {
|
||||
return;
|
||||
}
|
||||
this.envList = result;
|
||||
this.changeStoreEnv(this.activeUuid);
|
||||
// this.emitChangeEnv(this.activeUuid);
|
||||
this.envUuid = Number(localStorage.getItem('env:selected'));
|
||||
});
|
||||
}
|
||||
|
||||
@ -161,13 +149,7 @@ export class EnvComponent implements OnInit, OnDestroy {
|
||||
}
|
||||
|
||||
private changeStoreEnv(uuid) {
|
||||
// console.log('start', uuid);
|
||||
const data = this.envList.find((val) => val.uuid === uuid);
|
||||
// console.log(this.envList, uuid);
|
||||
this.store.dispatch(new Change(data));
|
||||
}
|
||||
|
||||
// private emitChangeEnv(uuid) {
|
||||
// this.messageService.send({ type: 'changeEnv', data: this.envList.find((val) => val.uuid === uuid) });
|
||||
// }
|
||||
}
|
||||
|
@ -123,6 +123,7 @@ export class TestServerLocalNodeService implements TestServer {
|
||||
return result;
|
||||
};
|
||||
const formatEnv = (env) => {
|
||||
console.log('env.parameters', env);
|
||||
let result = {
|
||||
paramList: env.parameters.map((val) => ({ paramKey: val.name, paramValue: val.value })),
|
||||
frontURI: env.hostUri,
|
||||
|
Loading…
Reference in New Issue
Block a user