mirror of
https://github.com/jwetzell/showbridge-webui.git
synced 2026-08-14 19:03:40 +00:00
make route input/output a select list of module id's
This commit is contained in:
@@ -44,6 +44,7 @@
|
||||
[path]="`routes/${i}`"
|
||||
(routeChange)="routeUpdated(i, $event)"
|
||||
[route]="route"
|
||||
[moduleIds]="moduleIds()"
|
||||
(delete)="deleteRoute(i)"
|
||||
></app-route>
|
||||
</div>
|
||||
|
||||
@@ -28,6 +28,14 @@ export class ConfigComponent {
|
||||
modules = computed(() => this.config()?.modules ?? []);
|
||||
routes = computed(() => this.config()?.routes ?? []);
|
||||
|
||||
moduleIds = computed(() => {
|
||||
const config = this.config();
|
||||
if (config !== undefined && config.modules !== undefined) {
|
||||
return config.modules.map((module) => module.id!) ?? [];
|
||||
}
|
||||
return [];
|
||||
});
|
||||
|
||||
public schemaService = inject(SchemaService);
|
||||
|
||||
private snackBar = inject(MatSnackBar);
|
||||
|
||||
@@ -15,12 +15,16 @@
|
||||
<div class="m-2">
|
||||
<div class="flex items-center m-1">
|
||||
<label class="mr-2 text-gray-300"> input: </label>
|
||||
<input
|
||||
type="text"
|
||||
<select
|
||||
class="pl-1 border-2 border-gray-200 text-gray-200 border-solid rounded-sm"
|
||||
[placeholder]="'module-1'"
|
||||
[formControlName]="'input'"
|
||||
/>
|
||||
formControlName="input"
|
||||
>
|
||||
@for (option of moduleIds(); track option) {
|
||||
<option [value]="option">
|
||||
{{ option }}
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
@if (!formGroup.controls['input'].valid) {
|
||||
<!-- TODO(jwetzell): better error displaying -->
|
||||
<div class="ml-2 text-red-500">{{ formGroup.controls['input'].errors | json }}</div>
|
||||
@@ -28,12 +32,16 @@
|
||||
</div>
|
||||
<div class="flex items-center m-1">
|
||||
<label class="mr-2 text-gray-300"> output: </label>
|
||||
<input
|
||||
type="text"
|
||||
<select
|
||||
class="pl-1 border-2 border-gray-200 text-gray-200 border-solid rounded-sm"
|
||||
[placeholder]="'module-1'"
|
||||
[formControlName]="'output'"
|
||||
/>
|
||||
formControlName="output"
|
||||
>
|
||||
@for (option of moduleIds(); track option) {
|
||||
<option [value]="option">
|
||||
{{ option }}
|
||||
</option>
|
||||
}
|
||||
</select>
|
||||
@if (!formGroup.controls['output'].valid) {
|
||||
<!-- TODO(jwetzell): better error displaying -->
|
||||
<div class="ml-2 text-red-500">
|
||||
|
||||
@@ -16,6 +16,7 @@ import { JsonPipe } from '@angular/common';
|
||||
export class RouteComponent {
|
||||
path = input<string>('');
|
||||
route = model<RouteConfiguration>();
|
||||
moduleIds = input<string[]>([]);
|
||||
delete = output<void>();
|
||||
|
||||
formGroup: FormGroup = new FormGroup({
|
||||
|
||||
Reference in New Issue
Block a user