diff --git a/src/app/processor/processor.component.css b/src/app/processor/processor.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/processor/processor.component.html b/src/app/processor/processor.component.html
new file mode 100644
index 0000000..f316abd
--- /dev/null
+++ b/src/app/processor/processor.component.html
@@ -0,0 +1,27 @@
+@if (processor() && schema()) {
+
+
+
+
+ {{ processor()?.type }}
+
+
+ close
+
+
+ @if (hasParams()) {
+
+ }
+
+
+}
diff --git a/src/app/processor/processor.component.ts b/src/app/processor/processor.component.ts
new file mode 100644
index 0000000..40ef761
--- /dev/null
+++ b/src/app/processor/processor.component.ts
@@ -0,0 +1,61 @@
+import { Component, computed, inject, input, model, output, signal } from '@angular/core';
+import { ProcessorConfiguration } from '../../models/config.models';
+import { SchemaService } from '../../services/schema.service';
+import { MatIconModule } from '@angular/material/icon';
+import { ParamsFormComponent } from '../params-form/params-form.component';
+import { ReactiveFormsModule } from '@angular/forms';
+
+@Component({
+ selector: 'app-processor',
+ imports: [MatIconModule, ParamsFormComponent, ReactiveFormsModule],
+ templateUrl: './processor.component.html',
+ styleUrl: './processor.component.css',
+})
+export class ProcessorComponent {
+ path = input('');
+ processor = model();
+ delete = output();
+
+ params = computed(() => this.processor()!.params);
+
+ schema = computed(() => {
+ return this.processor()?.type
+ ? this.schemaService.getSchemaForProcessorType(this.processor()!.type)
+ : undefined;
+ });
+
+ hasParams = computed(() => {
+ const schema = this.schema();
+ return (
+ schema !== undefined &&
+ schema.properties !== undefined &&
+ schema.properties.params !== undefined
+ );
+ });
+ private schemaService = inject(SchemaService);
+
+ paramsUpdated(params: any) {
+ this.processor.update((processor) => {
+ if (processor !== undefined) {
+ processor.params = params;
+ return {
+ ...processor,
+ params: processor.params,
+ };
+ }
+ return undefined;
+ });
+ }
+
+ deleteMe() {
+ this.delete.emit();
+ }
+
+ isInError(): boolean {
+ const path = this.path();
+ if (path) {
+ return this.schemaService.errorPaths.includes(path);
+ }
+ return false;
+ }
+}
diff --git a/src/app/route/route.component.css b/src/app/route/route.component.css
index e69de29..2d8a42f 100644
--- a/src/app/route/route.component.css
+++ b/src/app/route/route.component.css
@@ -0,0 +1,8 @@
+input::placeholder {
+ color: #d2d2d2;
+ opacity: 0.5;
+}
+
+select {
+ background-color: #424242;
+}
diff --git a/src/app/route/route.component.html b/src/app/route/route.component.html
index 5b4f320..864c784 100644
--- a/src/app/route/route.component.html
+++ b/src/app/route/route.component.html
@@ -51,7 +51,56 @@
+
+
Processors
+
+ @if (processors() === undefined || processors()?.length === 0) {
+
+ } @else {
+ @for (processor of processors(); track processor; let i = $index) {
+
+ }
+ }
+
+
+
+
+ @if (schemaService.moduleTypes.length > 0) {
+
+ add
+
+
+ @for (processorType of schemaService.processorTypes; track processorType) {
+
+ }
+
+ }
+
+
+ @if (schemaService.processorTypes.length > 0) {
+
+ }
+
}
diff --git a/src/app/route/route.component.ts b/src/app/route/route.component.ts
index e83270e..b5d7a1d 100644
--- a/src/app/route/route.component.ts
+++ b/src/app/route/route.component.ts
@@ -1,15 +1,24 @@
-import { Component, inject, input, model, output } from '@angular/core';
+import { Component, computed, inject, input, model, output } from '@angular/core';
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
import { MatFormFieldModule } from '@angular/material/form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatMenuModule } from '@angular/material/menu';
-import { RouteConfiguration } from '../../models/config.models';
+import { ProcessorConfiguration, RouteConfiguration } from '../../models/config.models';
import { SchemaService } from '../../services/schema.service';
import { JsonPipe } from '@angular/common';
+import { ProcessorComponent } from '../processor/processor.component';
+import { MatSnackBar } from '@angular/material/snack-bar';
@Component({
selector: 'app-route',
- imports: [MatFormFieldModule, MatIconModule, ReactiveFormsModule, MatMenuModule, JsonPipe],
+ imports: [
+ MatFormFieldModule,
+ MatIconModule,
+ ReactiveFormsModule,
+ MatMenuModule,
+ JsonPipe,
+ ProcessorComponent,
+ ],
templateUrl: './route.component.html',
styleUrl: './route.component.css',
})
@@ -19,12 +28,21 @@ export class RouteComponent {
moduleIds = input([]);
delete = output();
+ processors = computed(() => {
+ const route = this.route();
+ if (route) {
+ return route.processors;
+ }
+ return [];
+ });
+
formGroup: FormGroup = new FormGroup({
input: new FormControl('', [Validators.required]),
output: new FormControl('', [Validators.required]),
});
- private schemaService = inject(SchemaService);
+ public schemaService = inject(SchemaService);
+ private snackBar = inject(MatSnackBar);
ngOnInit(): void {
this.formGroup.patchValue({
@@ -55,4 +73,53 @@ export class RouteComponent {
}
return false;
}
+
+ addProcessor(processorType: string) {
+ const processorTemplate = this.schemaService.getSkeletonForProcessor(processorType);
+ this.route.update((route) => {
+ if (route) {
+ if (!route.processors) {
+ route.processors = [];
+ }
+ route.processors?.push(processorTemplate);
+ return {
+ ...route,
+ processors: route.processors,
+ };
+ }
+ return route;
+ });
+ }
+
+ processorUpdated(index: number, processor: ProcessorConfiguration | undefined) {
+ if (processor === undefined) {
+ console.error('processor is undefined, not updating');
+ return;
+ }
+ this.route.update((route) => {
+ if (route && route.processors) {
+ return {
+ ...route,
+ processors: route.processors,
+ };
+ }
+ return route;
+ });
+ }
+
+ deleteProcessor(index: number) {
+ this.route.update((route) => {
+ if (route && route.processors) {
+ route?.processors?.splice(index, 1);
+ return {
+ ...route,
+ processors: route.processors,
+ };
+ }
+ return route;
+ });
+ this.snackBar.open('Processor Removed', 'Dismiss', {
+ duration: 3000,
+ });
+ }
}