+ @for (route of routes(); track route; let i = $index) {
+
}
diff --git a/src/app/components/route-list/route-list.ts b/src/app/components/route-list/route-list.ts
index 821b452..738386b 100644
--- a/src/app/components/route-list/route-list.ts
+++ b/src/app/components/route-list/route-list.ts
@@ -1,4 +1,11 @@
-import { transferArrayItem } from '@angular/cdk/drag-drop';
+import { A11yModule } from '@angular/cdk/a11y';
+import {
+ CdkDrag,
+ CdkDragDrop,
+ CdkDropList,
+ moveItemInArray,
+ transferArrayItem,
+} from '@angular/cdk/drag-drop';
import { Component, inject, input, output } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
@@ -12,7 +19,16 @@ import { RouteComponent } from '../route/route';
@Component({
selector: 'app-route-list',
- imports: [RouteComponent, MatMenuModule, MatIconModule, MatButtonModule, MatTooltipModule],
+ imports: [
+ RouteComponent,
+ MatMenuModule,
+ MatIconModule,
+ MatButtonModule,
+ MatTooltipModule,
+ CdkDrag,
+ CdkDropList,
+ A11yModule,
+ ],
templateUrl: './route-list.html',
styleUrl: './route-list.css',
})
@@ -103,4 +119,17 @@ export class RouteListComponent {
this.updated.emit(cloneDeep(routes));
}
+
+ drop(event: CdkDragDrop
) {
+ console.log('Drop event:', event);
+ if (event.previousContainer === event.container) {
+ const currentRoutes = this.routes();
+ if (currentRoutes === undefined) {
+ console.error('routes is undefined, not updating');
+ return;
+ }
+ moveItemInArray(currentRoutes, event.previousIndex, event.currentIndex);
+ this.updated.emit(cloneDeep(currentRoutes));
+ }
+ }
}
diff --git a/src/app/components/route/route.html b/src/app/components/route/route.html
index 55b27ae..68c01ce 100644
--- a/src/app/components/route/route.html
+++ b/src/app/components/route/route.html
@@ -6,6 +6,14 @@
}} border-solid w-full"
>
+ @if (inDragList()) {
+
+ drag_indicator
+
+ }
chevron_right
- @for (processor of processors(); track $index; let i = $index) {
+ @for (processor of processors(); track processor; let i = $index) {
}
+
+
+
+
+ @if (inDragList()) {
+
+ drag_indicator
+
+ }
+
+ chevron_right
+
+
Route
+
+ close
+
+
+
+
+
+
+
+
+ @if (inDragList()) {
+
+ drag_indicator
+
+ }
+
+ chevron_right
+
+
Route
+
+ close
+
+
+
+
+
+
+
+ @if (schemaService.processorTypes.length > 0) {
+
+ add
+
+
+ @for (processorType of schemaService.processorTypes; track processorType) {
+
+ }
+
+ }
+
Processors
+
+ @if (processors() !== undefined && processors()!.length > 0) {
+
+ @for (processor of processors(); track processor; let i = $index) {
+
+ }
+
+ }
+
+
+
+ @if (routeConfigErrors().length > 0) {
+
+
+ error
+ Route Errors
+
+ @for (error of routeConfigErrors(); track error.index) {
+
+ {{ error.error }}
+
+ }
+
+ }
+
+
+
}
diff --git a/src/app/components/route/route.ts b/src/app/components/route/route.ts
index 454e178..73b301d 100644
--- a/src/app/components/route/route.ts
+++ b/src/app/components/route/route.ts
@@ -1,4 +1,11 @@
-import { CdkDrag, CdkDragDrop, CdkDropList, moveItemInArray } from '@angular/cdk/drag-drop';
+import {
+ CdkDrag,
+ CdkDragDrop,
+ CdkDragPlaceholder,
+ CdkDragPreview,
+ CdkDropList,
+ moveItemInArray,
+} from '@angular/cdk/drag-drop';
import { JsonPipe } from '@angular/common';
import { Component, computed, inject, input, output, signal } from '@angular/core';
import { FormControl, FormGroup, ReactiveFormsModule, Validators } from '@angular/forms';
@@ -28,6 +35,8 @@ import { ProcessorComponent } from '../processor/processor';
MatTooltipModule,
CdkDrag,
CdkDropList,
+ CdkDragPreview,
+ CdkDragPlaceholder,
],
templateUrl: './route.html',
styleUrl: './route.css',
@@ -45,6 +54,7 @@ export class RouteComponent {
return undefined;
});
+ inDragList = input(false);
route = input();
moduleIds = input([]);
delete = output();
@@ -83,8 +93,14 @@ export class RouteComponent {
private configService = inject(ConfigService);
public listsService = inject(ListsService);
+ public processorListId = signal('');
+
indicatorColor = signal('gray');
+ ngOnDestroy(): void {
+ this.listsService.removeProcessorList(this.path() + '/processors');
+ }
+
ngOnInit(): void {
this.formGroup.patchValue({
input: this.route()?.input,
@@ -115,6 +131,7 @@ export class RouteComponent {
this.indicatorColor.set('gray');
});
}
+ this.processorListId.set(this.listsService.registerProcessorList(this.path() + '/processors'));
}
isInError(): boolean {
diff --git a/src/app/services/lists.ts b/src/app/services/lists.ts
index e6da014..f65c830 100644
--- a/src/app/services/lists.ts
+++ b/src/app/services/lists.ts
@@ -18,6 +18,15 @@ export class ListsService {
return id;
}
+ removeProcessorList(path: string | undefined) {
+ if (path === undefined) {
+ return;
+ }
+
+ const id = this.pathToId(path);
+ this.processorListIds = this.processorListIds.filter((listId) => listId !== id);
+ }
+
pathToId(path: string) {
return path.replaceAll('/', '.');
}