Skip to content

Commit

Permalink
feat: global params
Browse files Browse the repository at this point in the history
  • Loading branch information
kungfuboy committed Jul 15, 2022
1 parent 23c74b1 commit 00f789c
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,27 @@ import { StorageService } from '../../services/storage';
<span class="px-1 w-1/3 text-gray-500 text-ellipsis overflow-hidden" [title]="it.name">{{ it.name }}</span>
<span class="px-1 w-2/3 text-gray-500 text-ellipsis overflow-hidden" [title]="it.value">{{ it.value }}</span>
</div>
<span class="text-gray-400">Global variable</span>
<div *ngFor="let it of gloablParams" class="flex items-center justify-between h-8">
<span class="px-1 w-1/3 text-gray-500 text-ellipsis overflow-hidden" [title]="it.name">{{ it.name }}</span>
<span class="px-1 w-2/3 text-gray-500 text-ellipsis overflow-hidden" [title]="it.value">{{ it.value }}</span>
</div>
</div>`,
styleUrls: [],
})
export class EnvListComponent implements OnInit {
envParams: any = [];
gloablParams: any = [];
constructor(private storage: StorageService) {}
async ngOnInit() {
this.gloablParams = this.getGlobalParams();
const uuid = Number(localStorage.getItem('env:selected')) || null;
if (uuid == null) {
this.envParams = [];
return;
}
const envList = (await this.getAllEnv()) as [];
const [env]: any[] = envList.filter((it: any) => it.uuid === uuid);
console.log(env, envList);
this.envParams = env.parameters;
}
getAllEnv(uuid?: number) {
Expand All @@ -40,4 +46,11 @@ export class EnvListComponent implements OnInit {
});
});
}
getGlobalParams() {
const global = localStorage.getItem('EO_TEST_VAR_GLOBALS');
return Object.entries(JSON.parse(global)).map((it) => {
const [key, value] = it;
return { name: key, value };
});
}
}

0 comments on commit 00f789c

Please sign in to comment.