mirror of
https://github.com/jwetzell/showbridge-webui.git
synced 2026-08-16 11:53:24 +00:00
add basics for connecting to running instance
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Component, computed, inject, input, model, output } from '@angular/core';
|
||||
import { Component, computed, inject, input, model, output, signal } from '@angular/core';
|
||||
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
|
||||
import { MatFormFieldModule } from '@angular/material/form-field';
|
||||
import { MatIconModule } from '@angular/material/icon';
|
||||
@@ -8,6 +8,8 @@ import { SchemaService } from '../../services/schema.service';
|
||||
import { ParamsFormComponent } from '../params-form/params-form.component';
|
||||
import { JsonPipe } from '@angular/common';
|
||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||
import { EventsService } from '../../services/events.service';
|
||||
import { tap, debounceTime } from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-module',
|
||||
@@ -42,8 +44,11 @@ export class ModuleComponent {
|
||||
type: new FormControl(''),
|
||||
});
|
||||
|
||||
private schemaService = inject(SchemaService);
|
||||
inputIndicatorColor = signal<string>('gray');
|
||||
outputIndicatorColor = signal<string>('gray');
|
||||
|
||||
private schemaService = inject(SchemaService);
|
||||
private eventsService = inject(EventsService);
|
||||
ngOnInit(): void {
|
||||
this.formGroup.patchValue({
|
||||
id: this.module()?.id,
|
||||
@@ -64,6 +69,30 @@ export class ModuleComponent {
|
||||
return undefined;
|
||||
});
|
||||
});
|
||||
if (this.id() !== undefined) {
|
||||
this.eventsService
|
||||
.getInputEventsForSource(this.id()!)
|
||||
.pipe(
|
||||
tap((inputEvent) => {
|
||||
this.inputIndicatorColor.set(inputEvent.error ? 'red' : 'greenyellow');
|
||||
}),
|
||||
debounceTime(100),
|
||||
)
|
||||
.subscribe((inputEvent) => {
|
||||
this.inputIndicatorColor.set('gray');
|
||||
});
|
||||
this.eventsService
|
||||
.getOutputEventsForDestination(this.id()!)
|
||||
.pipe(
|
||||
tap((outputEvent) => {
|
||||
this.outputIndicatorColor.set(outputEvent.error ? 'red' : 'greenyellow');
|
||||
}),
|
||||
debounceTime(100),
|
||||
)
|
||||
.subscribe((outputEvent) => {
|
||||
this.outputIndicatorColor.set('gray');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
paramsUpdated(params: any) {
|
||||
|
||||
Reference in New Issue
Block a user