From 255409410aa2552dfc1155bf89e7afce78dc17bc Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Mon, 5 Aug 2024 18:07:29 +0200 Subject: [PATCH 01/38] fix: disable links section in node sidebar This is SBB-specific. --- .../editor-node-detail-view.component.html | 2 +- .../editor-node-detail-view.component.ts | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/view/editor-side-view/editor-node-detail-view/editor-node-detail-view.component.html b/src/app/view/editor-side-view/editor-node-detail-view/editor-node-detail-view.component.html index ac4ce14e..f31c742e 100644 --- a/src/app/view/editor-side-view/editor-node-detail-view/editor-node-detail-view.component.html +++ b/src/app/view/editor-side-view/editor-node-detail-view/editor-node-detail-view.component.html @@ -273,7 +273,7 @@

- + {{ 'app.view.editor-side-view.editor-node-detail-view.links' | translate }}
  • diff --git a/src/app/view/editor-side-view/editor-node-detail-view/editor-node-detail-view.component.ts b/src/app/view/editor-side-view/editor-node-detail-view/editor-node-detail-view.component.ts index e00bb395..f78bf9ef 100644 --- a/src/app/view/editor-side-view/editor-node-detail-view/editor-node-detail-view.component.ts +++ b/src/app/view/editor-side-view/editor-node-detail-view/editor-node-detail-view.component.ts @@ -22,6 +22,7 @@ import {LabelService} from "../../../services/data/label.serivce"; import {LabelGroupService} from "../../../services/data/labelgroup.service"; import {SbbChipEvent, SbbChipInputEvent} from "@sbb-esta/angular/chips"; import {COMMA, ENTER} from "@angular/cdk/keycodes"; +import {environment} from "../../../../environments/environment"; interface NodeProperties { nodeId: number; @@ -57,6 +58,8 @@ export class EditorNodeDetailViewComponent implements OnInit, OnDestroy { readonly separatorKeysCodes = [ENTER, COMMA]; nodeLabelsAutoCompleteOptions: string[] = []; + readonly disableBackend = environment.disableBackend; + private destroyed = new Subject(); constructor( From df335ef9aede8c47064655f3dbcc5723c2a89f1a Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 6 Aug 2024 15:08:49 +0200 Subject: [PATCH 02/38] fix: disable notes in filter sidebar in standalone mode (#211) * fix: disable notes in filter sidebar in standalone mode Notes are disabled in standalone mode. * If the backend is turned off, the notes - labels will no longer be displayed in the filter. To keep everything consistent, these labels will also be deactivated in the filter and hidden in the note-edit dialog. --------- Co-authored-by: adrian_egli --- .../note-dialog/note-dialog.component.html | 5 ++++- .../note-dialog/note-dialog.component.ts | 3 +++ .../editor-edit-tools-view.component.html | 2 +- .../editor-edit-tools-view.component.ts | 3 +++ .../editor-filter-view.component.html | 18 ++++++++++-------- .../editor-filter-view.component.ts | 3 +++ 6 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/app/view/dialogs/note-dialog/note-dialog.component.html b/src/app/view/dialogs/note-dialog/note-dialog.component.html index b28b4e05..f7356fa9 100644 --- a/src/app/view/dialogs/note-dialog/note-dialog.component.html +++ b/src/app/view/dialogs/note-dialog/note-dialog.component.html @@ -20,7 +20,10 @@ (noteDeleted)="closeDialog()" > - + (); private deleteNoteCallback = null; private saveNoteCallback = null; diff --git a/src/app/view/editor-edit-tools-view-component/editor-edit-tools-view.component.html b/src/app/view/editor-edit-tools-view-component/editor-edit-tools-view.component.html index 1952d101..baaf2efc 100644 --- a/src/app/view/editor-edit-tools-view-component/editor-edit-tools-view.component.html +++ b/src/app/view/editor-edit-tools-view-component/editor-edit-tools-view.component.html @@ -20,7 +20,7 @@

    {{ 'app.view.editor-edit-tools-view-component.edit' | t > - + {{ 'app.view.editor-edit-tools-view-component.notes' | translate }} (); + readonly disableBackend = environment.disableBackend; + constructor( private dataService: DataService, private nodeService: NodeService, diff --git a/src/app/view/editor-filter-view/editor-filter-view.component.html b/src/app/view/editor-filter-view/editor-filter-view.component.html index 90f4540e..fbf38e94 100644 --- a/src/app/view/editor-filter-view/editor-filter-view.component.html +++ b/src/app/view/editor-filter-view/editor-filter-view.component.html @@ -93,7 +93,7 @@

    {{ 'app.view.editor-filter-view.filter' | translate }}< > - + {{ 'app.view.editor-filter-view.filterable-labels-notes' | translate }} @@ -177,13 +177,15 @@

    {{ 'app.view.editor-filter-view.filter' | translate }}< -
    - {{ 'app.view.editor-filter-view.notes' | translate }} -
    - {{ 'app.view.editor-filter-view.display-notes' | translate }} - -
    + +
    + {{ 'app.view.editor-filter-view.notes' | translate }} +
    + {{ 'app.view.editor-filter-view.display-notes' | translate }} + +
    +
    - + {{ 'app.view.editor-filter-view.saved-filters' | translate }} From cc18f00f8e2c2eab5e549e4b2b1b5449156a36fb Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 6 Aug 2024 15:37:48 +0200 Subject: [PATCH 31/38] hack: disable edit sidebar --- .../netzgrafik-application/netzgrafik-application.component.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/netzgrafik-application/netzgrafik-application.component.html b/src/app/netzgrafik-application/netzgrafik-application.component.html index 6ac8fef8..60779a20 100644 --- a/src/app/netzgrafik-application/netzgrafik-application.component.html +++ b/src/app/netzgrafik-application/netzgrafik-application.component.html @@ -36,6 +36,7 @@ [label]="'app.netzgrafik-application.edit' | translate" [class]="getEditActivatedTag()" (click)="onEditToolClicked()" + *ngIf="false" > From b81604a3477515392fa75c669134cd4aa4861b49 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Tue, 6 Aug 2024 15:41:15 +0200 Subject: [PATCH 32/38] hack: disable file imports --- .../editor-tools-view.component.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/view/editor-tools-view-component/editor-tools-view.component.html b/src/app/view/editor-tools-view-component/editor-tools-view.component.html index 2b9fd681..cbd00181 100644 --- a/src/app/view/editor-tools-view-component/editor-tools-view.component.html +++ b/src/app/view/editor-tools-view-component/editor-tools-view.component.html @@ -40,7 +40,7 @@

    {{ 'app.view.editor-side-view.editor-tools-view-compone {{ 'app.view.editor-side-view.editor-tools-view-component.export-netzgrafik-as-json' | translate }} -
    +
    diff --git a/src/app/view/dialogs/trainrun-and-section-dialog/trainrun-tab/trainrun-tab.component.html b/src/app/view/dialogs/trainrun-and-section-dialog/trainrun-tab/trainrun-tab.component.html index 6e878063..61e11058 100644 --- a/src/app/view/dialogs/trainrun-and-section-dialog/trainrun-tab/trainrun-tab.component.html +++ b/src/app/view/dialogs/trainrun-and-section-dialog/trainrun-tab/trainrun-tab.component.html @@ -65,6 +65,7 @@ tabindex="-1" (click)="onDuplicateTrainrun()" [title]="'app.view.dialogs.trainrun-and-section-dialog.trainrun-tab.trainrunDuplicate' | translate " + *ngIf="false" > From 44d53df6c187ca755ff43e0e86a34fee55d39f20 Mon Sep 17 00:00:00 2001 From: Uriel-Sautron Date: Wed, 18 Sep 2024 10:12:04 +0200 Subject: [PATCH 37/38] hack: add label service --- src/app/app.component.ts | 15 +++++++++------ src/app/models/operation.model.ts | 14 +++++++++++++- src/app/services/data/label.serivce.ts | 10 +++++++++- .../editor-edit-tools-view.component.html | 9 +++++---- 4 files changed, 36 insertions(+), 12 deletions(-) diff --git a/src/app/app.component.ts b/src/app/app.component.ts index b37e3f49..8797726d 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -40,12 +40,14 @@ export class AppComponent { return this.authService.claims?.email; } - constructor(private authService: AuthService, - private dataService: DataService, - private trainrunService: TrainrunService, - private trainrunSectionService: TrainrunSectionService, - private nodeService: NodeService, - ) { + constructor( + private authService: AuthService, + private dataService: DataService, + private trainrunService: TrainrunService, + private trainrunSectionService: TrainrunSectionService, + private nodeService: NodeService, + private labelService: LabelService, + ) { if (!this.disableBackend) { this.authenticated = authService.initialized; } @@ -76,5 +78,6 @@ export class AppComponent { this.trainrunService.operation, this.trainrunSectionService.operation, this.nodeService.operation, + this.labelService.operation, ); } diff --git a/src/app/models/operation.model.ts b/src/app/models/operation.model.ts index b811e4cf..b2120789 100644 --- a/src/app/models/operation.model.ts +++ b/src/app/models/operation.model.ts @@ -1,5 +1,6 @@ import {Node} from "./node.model"; import {Trainrun} from "./trainrun.model"; +import {Label} from "./label.model"; enum OperationType { create = "create", @@ -10,7 +11,8 @@ enum OperationType { enum OperationObjectType { trainrun = "trainrun", node = "node", -}; + label = "label", +} abstract class Operation { readonly type: OperationType; @@ -40,9 +42,19 @@ class NodeOperation extends Operation { } } +class LabelOperation extends Operation { + readonly label: Label; + + constructor(operationType: OperationType, label: Label) { + super(operationType, OperationObjectType.label); + this.label = label; + } +} + export { OperationType, Operation, TrainrunOperation, NodeOperation, + LabelOperation, }; diff --git a/src/app/services/data/label.serivce.ts b/src/app/services/data/label.serivce.ts index 23a20fb1..250b8ae7 100644 --- a/src/app/services/data/label.serivce.ts +++ b/src/app/services/data/label.serivce.ts @@ -1,4 +1,4 @@ -import {Injectable, OnDestroy} from "@angular/core"; +import {EventEmitter, Injectable, OnDestroy} from "@angular/core"; import {BehaviorSubject, Subject} from "rxjs"; import {LogService} from "../../logger/log.service"; import { @@ -7,6 +7,11 @@ import { } from "../../data-structures/business.data.structures"; import {Label} from "../../models/label.model"; import {LabelGroupService} from "./labelgroup.service"; +import { + LabelOperation, + Operation, + OperationType, +} from "src/app/models/operation.model"; @Injectable({ providedIn: "root", @@ -16,6 +21,8 @@ export class LabelService implements OnDestroy { readonly labels = this.labelSubject.asObservable(); private labelStore: {labels: Label[]} = {labels: []}; // store the data in memory + readonly operation = new EventEmitter(); + private destroyed = new Subject(); constructor( @@ -36,6 +43,7 @@ export class LabelService implements OnDestroy { labelObject.setLabel(newLabelValue); } this.labelUpdated(); + this.operation.emit(new LabelOperation(OperationType.update, labelObject)); } doUserDefinedLabelsOrdering(labelIds: number[]) { diff --git a/src/app/view/editor-edit-tools-view-component/editor-edit-tools-view.component.html b/src/app/view/editor-edit-tools-view-component/editor-edit-tools-view.component.html index baaf2efc..37591d4b 100644 --- a/src/app/view/editor-edit-tools-view-component/editor-edit-tools-view.component.html +++ b/src/app/view/editor-edit-tools-view-component/editor-edit-tools-view.component.html @@ -1,5 +1,5 @@

    {{ 'app.view.editor-edit-tools-view-component.edit' | translate }}

    - + {{ 'app.view.editor-edit-tools-view-component.edit' | t [componentLabelRef]="'Trainrun'" > - + + {{ 'app.view.editor-edit-tools-view-component.nodes' | translate }} {{ 'app.view.editor-edit-tools-view-component.edit' | t - + {{ 'app.view.editor-edit-tools-view-component.delete-netzgrafik-title' | translate }} {{ 'app.view.editor-edit-tools-view-component.edit' | t {{ 'app.view.editor-edit-tools-view-component.delete-all-visible-elements' | translate }} - + {{ 'app.view.editor-edit-tools-view-component.merge-netzgrafik-title' | translate }} From 6753314c79f2cdb8cb17079e5e933277c57beb19 Mon Sep 17 00:00:00 2001 From: Uriel-Sautron Date: Tue, 10 Sep 2024 11:33:36 +0200 Subject: [PATCH 38/38] Revert "hack: disable edit sidebar" This reverts commit cc18f00f8e2c2eab5e549e4b2b1b5449156a36fb. --- .../netzgrafik-application/netzgrafik-application.component.html | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/netzgrafik-application/netzgrafik-application.component.html b/src/app/netzgrafik-application/netzgrafik-application.component.html index 60779a20..6ac8fef8 100644 --- a/src/app/netzgrafik-application/netzgrafik-application.component.html +++ b/src/app/netzgrafik-application/netzgrafik-application.component.html @@ -36,7 +36,6 @@ [label]="'app.netzgrafik-application.edit' | translate" [class]="getEditActivatedTag()" (click)="onEditToolClicked()" - *ngIf="false" >