From b918ad0947a8b8ec103049c21d58487447a883bd Mon Sep 17 00:00:00 2001 From: adrian_egli Date: Tue, 20 Aug 2024 15:25:09 +0200 Subject: [PATCH 01/17] German - translation typo fixed --- src/assets/i18n/de.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json index 776617ce..bcb5dc0d 100644 --- a/src/assets/i18n/de.json +++ b/src/assets/i18n/de.json @@ -272,7 +272,7 @@ }, "editor-edit-tools-view-component": { "edit": "Bearbeiten", - "filterable-labels": "Filterbare labels", + "filterable-labels": "Filterbare Labels", "trainruns": "Zugfahrten", "nodes": "Knoten", "notes": "Kommentare", From 2ec2c8afb99afbf5e8172a2bb546b73c872392d7 Mon Sep 17 00:00:00 2001 From: adrian_egli Date: Tue, 20 Aug 2024 15:32:10 +0200 Subject: [PATCH 02/17] German - translation typo fixed --- src/assets/i18n/de.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json index bcb5dc0d..0997a4f9 100644 --- a/src/assets/i18n/de.json +++ b/src/assets/i18n/de.json @@ -443,7 +443,7 @@ "import-netzgrafik": "Netzgrafik importieren", "import-netzgrafik-as-json": "Netzgrafik aus JSON importieren", "export-trainruns": "Zugfahrten exportieren", - "export-trainruns-as-csv": "Netzgrafik aus JSON importieren", + "export-trainruns-as-csv": "Zugfahrten als CSV exportieren", "export-trainruns-as-csv-excel": "In Excel: Daten -> Aus Text/CSV -> Filename ... importieren", "base-data": "Stammdaten", "import-base-data": "Stammdaten importieren", From 541305dc663ada6a764d514ca16a1f2e5c8f9f73 Mon Sep 17 00:00:00 2001 From: adrian_egli Date: Tue, 20 Aug 2024 15:39:06 +0200 Subject: [PATCH 03/17] UI / Dialog - if the variant is not editable -> readonly : disable user interactions --- .../netzgrafik-application.component.ts | 5 +---- .../perlenkette-node.component.html | 4 +++- .../perlenkette-node.component.scss | 4 ++++ .../perlenkette-node.component.ts | 6 ++++++ .../perlenkette-section.component.html | 1 + .../perlenkette-section.component.scss | 6 ++++++ .../perlenkette-section.component.ts | 6 ++++++ .../services/data/version-control.service.ts | 7 +++++++ .../trainrun-filter-tab.component.html | 4 ++-- .../trainrun-filter-tab.component.scss | 8 ++++++++ .../trainrun-filter-tab.component.ts | 19 +++++++++++++++++++ .../trainrun-tab/trainrun-tab.component.html | 4 ++-- .../trainrun-tab/trainrun-tab.component.scss | 8 ++++++++ .../trainrun-tab/trainrun-tab.component.ts | 18 +++++++++++++++--- .../trainrun-section-tab.component.html | 4 ++-- .../trainrun-section-tab.component.scss | 10 ++++++++++ .../trainrun-section-tab.component.ts | 18 ++++++++++++++++++ .../editor-edit-tools-view.component.html | 10 +++++++--- .../editor-edit-tools-view.component.ts | 6 ++++++ .../editor-menu/editor-menu.component.html | 6 ++++-- .../editor-menu/editor-menu.component.scss | 8 ++++++++ .../view/editor-menu/editor-menu.component.ts | 4 ++++ .../editor-tools-view.component.html | 6 ++++++ .../editor-tools-view.component.scss | 5 +++++ .../editor-tools-view.component.ts | 5 +++++ 25 files changed, 163 insertions(+), 19 deletions(-) diff --git a/src/app/netzgrafik-application/netzgrafik-application.component.ts b/src/app/netzgrafik-application/netzgrafik-application.component.ts index 55ce56b0..ec5273d7 100644 --- a/src/app/netzgrafik-application/netzgrafik-application.component.ts +++ b/src/app/netzgrafik-application/netzgrafik-application.component.ts @@ -71,10 +71,7 @@ export class NetzgrafikApplicationComponent { } getVariantIsWritable(): boolean { - if (this.versionControlService.variant === null) { - return true; - } - return this.versionControlService.variant.isWritable; + return this.versionControlService.getVariantIsWritable(); } onVariantenClicked() { diff --git a/src/app/perlenkette/perlenkette-node/perlenkette-node.component.html b/src/app/perlenkette/perlenkette-node/perlenkette-node.component.html index ad5d5eaa..d94ad322 100644 --- a/src/app/perlenkette/perlenkette-node/perlenkette-node.component.html +++ b/src/app/perlenkette/perlenkette-node/perlenkette-node.component.html @@ -1,4 +1,6 @@ -
+
+
-
+
{{ 'app.view.editor-edit-tools-view-component.delete-all-visible-elements' | translate }} - + {{ 'app.view.editor-edit-tools-view-component.merge-netzgrafik-title' | translate }} diff --git a/src/app/view/editor-edit-tools-view-component/editor-edit-tools-view.component.ts b/src/app/view/editor-edit-tools-view-component/editor-edit-tools-view.component.ts index e1f2bbea..e640a999 100644 --- a/src/app/view/editor-edit-tools-view-component/editor-edit-tools-view.component.ts +++ b/src/app/view/editor-edit-tools-view-component/editor-edit-tools-view.component.ts @@ -16,6 +16,7 @@ import {LabelService} from "../../services/data/label.serivce"; import {LabelGroupService} from "../../services/data/labelgroup.service"; import {LabelGroup} from "../../models/labelGroup.model"; import {environment} from "../../../environments/environment"; +import {VersionControlService} from "../../services/data/version-control.service"; @Component({ selector: "sbb-editor-edit-tools-view-component", @@ -46,6 +47,7 @@ export class EditorEditToolsViewComponent implements OnDestroy { private logger: LogService, public filterService: FilterService, private uiInteractionService: UiInteractionService, + private versionControlService : VersionControlService ) { this.nodeLabelGroups = this.labelGroupService.getLabelGroupsFromLabelRef( LabelRef.Node, @@ -76,6 +78,10 @@ export class EditorEditToolsViewComponent implements OnDestroy { this.destroyed.complete(); } + getVariantIsWritable() { + return this.versionControlService.getVariantIsWritable(); + } + onClearAllFiltered() { const confirmationDialogParamter = new ConfirmationDialogParameter( $localize`:@@app.view.editor-edit-tools-view-component.delete:Delete`, diff --git a/src/app/view/editor-menu/editor-menu.component.html b/src/app/view/editor-menu/editor-menu.component.html index dfed58c5..85158b84 100644 --- a/src/app/view/editor-menu/editor-menu.component.html +++ b/src/app/view/editor-menu/editor-menu.component.html @@ -142,7 +142,8 @@ [class.isStreckengrafikEditing]=" isStreckengrafikEditing() || isAnalytics() " - [disabled]="isStreckengrafikEditing() || isAnalytics()" + [class.readonly]="!getVariantIsWritable()" + [disabled]="isStreckengrafikEditing() || isAnalytics() || !getVariantIsWritable()" (click)="onTopologieEditor()" [title]="'app.view.editor-menu.topology-editor-disabled' | translate" > @@ -242,7 +243,8 @@ [class.isStreckengrafikEditing]=" isStreckengrafikEditing() || isAnalytics() " - [disabled]="isStreckengrafikEditing() || isAnalytics()" + [class.readonly]="!getVariantIsWritable()" + [disabled]="isStreckengrafikEditing() || isAnalytics() || !getVariantIsWritable()" (click)="onNoteEditor()" [title]="'app.view.editor-menu.note-editor-disabled' | translate" > diff --git a/src/app/view/editor-menu/editor-menu.component.scss b/src/app/view/editor-menu/editor-menu.component.scss index a7d5436e..c853a5e5 100644 --- a/src/app/view/editor-menu/editor-menu.component.scss +++ b/src/app/view/editor-menu/editor-menu.component.scss @@ -510,3 +510,11 @@ div.LabelNetzgrafik{ div.NodeZoomValue{ background: var(--sbb-header-lean-background-color); } + +button.ButtonTopologieEditor.readonly { + fill-opacity: 0.35; +} + +button.ButtonNoteEditor.readonly { + fill-opacity: 0.35; +} diff --git a/src/app/view/editor-menu/editor-menu.component.ts b/src/app/view/editor-menu/editor-menu.component.ts index 497ac174..c5532ebe 100644 --- a/src/app/view/editor-menu/editor-menu.component.ts +++ b/src/app/view/editor-menu/editor-menu.component.ts @@ -100,6 +100,10 @@ export class EditorMenuComponent implements OnInit, OnDestroy { this.destroyed.complete(); } + getVariantIsWritable() : boolean { + return this.versionControlService.getVariantIsWritable(); + } + onZoomIn() { if ( this.uiInteractionService.getEditorMode() === 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..b21f6d5f 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 @@ -45,6 +45,8 @@

{{ 'app.view.editor-side-view.editor-tools-view-compone (click)="onLoadButton()" [title]="'app.view.editor-side-view.editor-tools-view-component.import-netzgrafik' | translate" class="TrainrunDialog EditorToolButton" + [disabled]="!getVariantIsWritable()" + [class.readonly]="!getVariantIsWritable()" > @@ -54,6 +56,8 @@

{{ 'app.view.editor-side-view.editor-tools-view-compone type="file" accept=".json" (change)="onLoad($event)" + [disabled]="!getVariantIsWritable()" + [class.readonly]="!getVariantIsWritable()" /> {{ 'app.view.editor-side-view.editor-tools-view-component.import-netzgrafik-as-json' | translate }}
@@ -75,6 +79,8 @@

{{ 'app.view.editor-side-view.editor-tools-view-compone (click)="onLoadStammdatenButton()" [title]="'app.view.editor-side-view.editor-tools-view-component.import-base-data' | translate" class="TrainrunDialog EditorToolButton" + [disabled]="!getVariantIsWritable()" + [class.readonly]="!getVariantIsWritable()" > diff --git a/src/app/view/editor-tools-view-component/editor-tools-view.component.scss b/src/app/view/editor-tools-view-component/editor-tools-view.component.scss index d71a0be0..6b8e01f7 100644 --- a/src/app/view/editor-tools-view-component/editor-tools-view.component.scss +++ b/src/app/view/editor-tools-view-component/editor-tools-view.component.scss @@ -21,3 +21,8 @@ .link-reset { vertical-align: initial; } + +button.TrainrunDialog.EditorToolButton.readonly { + opacity: 0.25; + pointer-events: none; +} diff --git a/src/app/view/editor-tools-view-component/editor-tools-view.component.ts b/src/app/view/editor-tools-view-component/editor-tools-view.component.ts index eea5b40d..577ed715 100644 --- a/src/app/view/editor-tools-view-component/editor-tools-view.component.ts +++ b/src/app/view/editor-tools-view-component/editor-tools-view.component.ts @@ -194,6 +194,11 @@ export class EditorToolsViewComponent { window.URL.revokeObjectURL(url); } + + getVariantIsWritable() { + return this.versionControlService.getVariantIsWritable(); + } + private convertToStammdatenCSV(): string { const separator = ";"; const comma = ","; From 628096defa54d897beb834b5acf91aa602748d17 Mon Sep 17 00:00:00 2001 From: adrian_egli Date: Tue, 20 Aug 2024 16:01:31 +0200 Subject: [PATCH 04/17] UI / Dialog - if the variant is not editable -> readonly interactive drawing --- .../data-views/d3.utils.spec.ts | 3 +- .../data-views/data.view.spec.ts | 3 +- .../data-views/editor.view.ts | 5 ++- .../data-views/nodes.view.scss | 4 ++ .../data-views/nodes.view.spec.ts | 1 + .../editor-main-view/data-views/nodes.view.ts | 20 +++++++-- .../data-views/notes.view.spec.ts | 3 +- .../editor-main-view/data-views/notes.view.ts | 42 +++++++++++++++---- .../data-views/static.dom.tags.ts | 1 + .../trainrunsection.previewline.view.ts | 21 ++++++++++ .../data-views/trainrunsections.view.spec.ts | 3 +- .../data-views/transitions.view.spec.ts | 3 +- .../data-views/transitions.view.ts | 5 +++ .../editor-main-view.component.ts | 3 +- 14 files changed, 98 insertions(+), 19 deletions(-) diff --git a/src/app/view/editor-main-view/data-views/d3.utils.spec.ts b/src/app/view/editor-main-view/data-views/d3.utils.spec.ts index 8305516d..35bf64b1 100644 --- a/src/app/view/editor-main-view/data-views/d3.utils.spec.ts +++ b/src/app/view/editor-main-view/data-views/d3.utils.spec.ts @@ -167,7 +167,8 @@ describe("3d.Utils.tests", () => { copyService, logService, viewportCullSerivce, - levelOfDetailService + levelOfDetailService, + undefined ); controller.bindViewToServices(); editorView = controller.editorView; diff --git a/src/app/view/editor-main-view/data-views/data.view.spec.ts b/src/app/view/editor-main-view/data-views/data.view.spec.ts index 4137a1e7..79ae5eaf 100644 --- a/src/app/view/editor-main-view/data-views/data.view.spec.ts +++ b/src/app/view/editor-main-view/data-views/data.view.spec.ts @@ -172,7 +172,8 @@ describe("Editor-DataView", () => { copyService, logService, viewportCullSerivce, - levelOfDetailService + levelOfDetailService, + undefined ); controller.bindViewToServices(); diff --git a/src/app/view/editor-main-view/data-views/editor.view.ts b/src/app/view/editor-main-view/data-views/editor.view.ts index 659cfb5c..12d2e7c3 100644 --- a/src/app/view/editor-main-view/data-views/editor.view.ts +++ b/src/app/view/editor-main-view/data-views/editor.view.ts @@ -33,6 +33,7 @@ import {CopyService} from "../../../services/data/copy.service"; import {StreckengrafikDrawingContext} from "../../../streckengrafik/model/util/streckengrafik.drawing.context"; import {LevelOfDetail, LevelOfDetailService} from "../../../services/ui/level.of.detail.service"; import {ViewportCullService} from "../../../services/ui/viewport.cull.service"; +import {VersionControlService} from "../../../services/data/version-control.service"; export class EditorView implements SVGMouseControllerObserver { static svgName = "graphContainer"; @@ -128,7 +129,8 @@ export class EditorView implements SVGMouseControllerObserver { private copyService: CopyService, private logService: LogService, private viewportCullService: ViewportCullService, - private levelOfDetailService: LevelOfDetailService + private levelOfDetailService: LevelOfDetailService, + private versionControlService : VersionControlService ) { this.controller = controller; this.svgMouseController = new SVGMouseController(EditorView.svgName, this); @@ -139,6 +141,7 @@ export class EditorView implements SVGMouseControllerObserver { this.trainrunSectionPreviewLineView = new TrainrunSectionPreviewLineView( nodeService, filterService, + versionControlService ); this.multiSelectRenderer = new MultiSelectRenderer(); this.notesView = new NotesView(this); diff --git a/src/app/view/editor-main-view/data-views/nodes.view.scss b/src/app/view/editor-main-view/data-views/nodes.view.scss index 7be45f8e..e1238eb4 100644 --- a/src/app/view/editor-main-view/data-views/nodes.view.scss +++ b/src/app/view/editor-main-view/data-views/nodes.view.scss @@ -55,6 +55,10 @@ font-size: $BP_LABEL_FONT_SIZE; } +::ng-deep text.node_text.readonly { + cursor: default; +} + ::ng-deep text.node_text.hover { fill: $COLOR_Edit; } diff --git a/src/app/view/editor-main-view/data-views/nodes.view.spec.ts b/src/app/view/editor-main-view/data-views/nodes.view.spec.ts index 8675ad75..664456bb 100644 --- a/src/app/view/editor-main-view/data-views/nodes.view.spec.ts +++ b/src/app/view/editor-main-view/data-views/nodes.view.spec.ts @@ -167,6 +167,7 @@ describe("Nodes-View", () => { logService, viewportCullSerivce, levelOfDetailService, + undefined ); controller.bindViewToServices(); editorView = controller.editorView; diff --git a/src/app/view/editor-main-view/data-views/nodes.view.ts b/src/app/view/editor-main-view/data-views/nodes.view.ts index fbfea1f6..a0a6ecdb 100644 --- a/src/app/view/editor-main-view/data-views/nodes.view.ts +++ b/src/app/view/editor-main-view/data-views/nodes.view.ts @@ -352,7 +352,9 @@ export class NodesView { } private makeHoverDragRoot(groupEnter: any) { - + if ( !this.editorView.trainrunSectionPreviewLineView.getVariantIsWritable() ){ + return; + } groupEnter .append(StaticDomTags.NODE_HOVER_DRAG_AREA_SVG) .attr("class", StaticDomTags.NODE_HOVER_DRAG_AREA_CLASS) @@ -561,9 +563,9 @@ export class NodesView { } private makeLabelText(groupEnter: any) { - - groupEnter - .append(StaticDomTags.NODE_LABELAREA_TEXT_SVG) + const added = groupEnter + .append(StaticDomTags.NODE_LABELAREA_TEXT_SVG); + added .attr("class", StaticDomTags.NODE_LABELAREA_TEXT_CLASS) .attr(StaticDomTags.NODE_ID, (n: NodeViewObject) => n.node.getId()) .attr("x", NODE_TEXT_LEFT_SPACING) @@ -576,6 +578,16 @@ export class NodesView { StaticDomTags.NODE_HAS_CONNECTIONS, (n: NodeViewObject) => n.node.getConnections().length > 0, ) + .classed( + StaticDomTags.NODE_READONLY, + !this.editorView.trainrunSectionPreviewLineView.getVariantIsWritable() + ); + + if ( !this.editorView.trainrunSectionPreviewLineView.getVariantIsWritable() ){ + return; + } + + added .call(this.draggable) .on("mouseover", (n: NodeViewObject, i, a) => this.onNodeLabelAreaMouseover(n.node, a[i]), diff --git a/src/app/view/editor-main-view/data-views/notes.view.spec.ts b/src/app/view/editor-main-view/data-views/notes.view.spec.ts index 281e3f30..882e579e 100644 --- a/src/app/view/editor-main-view/data-views/notes.view.spec.ts +++ b/src/app/view/editor-main-view/data-views/notes.view.spec.ts @@ -166,7 +166,8 @@ describe("Notes-View", () => { copyService, logService, viewportCullSerivce, - levelOfDetailService + levelOfDetailService, + undefined ); controller.bindViewToServices(); editorView = controller.editorView; diff --git a/src/app/view/editor-main-view/data-views/notes.view.ts b/src/app/view/editor-main-view/data-views/notes.view.ts index 0cc47553..4e0dd6d5 100644 --- a/src/app/view/editor-main-view/data-views/notes.view.ts +++ b/src/app/view/editor-main-view/data-views/notes.view.ts @@ -227,9 +227,9 @@ export class NotesView { } private makeNoteHoverRoot(groupEnter: any) { - - groupEnter - .append(StaticDomTags.NOTE_HOVER_ROOT_SVG) + const added = groupEnter + .append(StaticDomTags.NOTE_HOVER_ROOT_SVG); + added .attr("class", StaticDomTags.NOTE_HOVER_ROOT_CLASS) .attr(StaticDomTags.NOTE_ID, (n: NoteViewObject) => n.note.getId()) .attr( @@ -241,7 +241,13 @@ export class NotesView { (n: NoteViewObject) => NotesView.extractTextBasedHeight(n.note) + 48, ) .attr("x", -24) - .attr("y", -24) + .attr("y", -24); + + if ( !this.editorView.trainrunSectionPreviewLineView.getVariantIsWritable() ){ + return; + } + + added .call(this.draggable) .on("mouseout", (n: NoteViewObject) => this.onNoteMouseout(n.note, null)) .on("mouseover", (n: NoteViewObject, i, a) => @@ -377,8 +383,10 @@ export class NotesView { private makeNoteDragAreaBackground(groupEnter: any) { - groupEnter - .append(StaticDomTags.NOTE_HOVER_DRAG_AREA_BACKGROUND_SVG) + const added = groupEnter + .append(StaticDomTags.NOTE_HOVER_DRAG_AREA_BACKGROUND_SVG); + + added .attr("class", StaticDomTags.NOTE_HOVER_DRAG_AREA_BACKGROUND_CLASS) .classed(StaticDomTags.TAG_SELECTED, (n: NoteViewObject) => n.note.selected(), @@ -388,7 +396,13 @@ export class NotesView { .attr("width", 28) .attr("height", 28) .attr("x", 0) - .attr("y", 0) + .attr("y", 0); + + if ( !this.editorView.trainrunSectionPreviewLineView.getVariantIsWritable() ){ + return; + } + + added .on("mouseout", (n: NoteViewObject) => this.onNoteMouseoutDragButton(n.note, null), ) @@ -399,7 +413,9 @@ export class NotesView { } private makeNoteDragArea(groupEnter: any) { - + if ( !this.editorView.trainrunSectionPreviewLineView.getVariantIsWritable() ){ + return; + } groupEnter .append(StaticDomTags.NOTE_HOVER_DRAG_AREA_SVG) .attr("class", StaticDomTags.NOTE_HOVER_DRAG_AREA_CLASS) @@ -427,6 +443,11 @@ export class NotesView { } onNoteMousedown(note: Note) { + if ( !this.editorView.trainrunSectionPreviewLineView.getVariantIsWritable() ){ + d3.event.stopPropagation(); + return; + } + if (this.editorView.editorMode === EditorMode.MultiNodeMoving) { const multiSelected = this.editorView.isNoteSelected(note.getId()); if (multiSelected) { @@ -439,6 +460,11 @@ export class NotesView { } onNoteMouseup(note: Note, domObj: any) { + if ( !this.editorView.trainrunSectionPreviewLineView.getVariantIsWritable() ){ + d3.event.stopPropagation(); + return; + } + const rect: DOMRect = d3.select(domObj).node().getBoundingClientRect(); const clickPosition = new Vec2D( rect.x + rect.width / 2, diff --git a/src/app/view/editor-main-view/data-views/static.dom.tags.ts b/src/app/view/editor-main-view/data-views/static.dom.tags.ts index 35ea7546..c3e19c57 100644 --- a/src/app/view/editor-main-view/data-views/static.dom.tags.ts +++ b/src/app/view/editor-main-view/data-views/static.dom.tags.ts @@ -77,6 +77,7 @@ export class StaticDomTags { static NODE_TAG_REQ_FOR_DRAGGING = "req_for_dragging"; static NODE_TAG_JUNCTION_ONLY = "junction_only"; static NODE_HAS_CONNECTIONS = "has_connections"; + static NODE_READONLY = "readonly"; static NODE_HOVER_ROOT_SVG = "rect"; static NODE_HOVER_ROOT_CLASS = "node_hover_root"; diff --git a/src/app/view/editor-main-view/data-views/trainrunsection.previewline.view.ts b/src/app/view/editor-main-view/data-views/trainrunsection.previewline.view.ts index 4eaab377..d51f7353 100644 --- a/src/app/view/editor-main-view/data-views/trainrunsection.previewline.view.ts +++ b/src/app/view/editor-main-view/data-views/trainrunsection.previewline.view.ts @@ -8,6 +8,7 @@ import {Transition} from "../../../models/transition.model"; import {SimpleTrainrunSectionRouter} from "../../../services/util/trainrunsection.routing"; import {NodeService} from "../../../services/data/node.service"; import {FilterService} from "../../../services/ui/filter.service"; +import {VersionControlService} from "../../../services/data/version-control.service"; export enum PreviewLineMode { NotDragging, @@ -55,6 +56,7 @@ export class TrainrunSectionPreviewLineView { constructor( private nodeService: NodeService, private filterService: FilterService, + private versionControlService : VersionControlService ) {} static setGroup(nodeGroup: d3.Selector) { @@ -69,6 +71,13 @@ export class TrainrunSectionPreviewLineView { .attr("class", StaticDomTags.PREVIEW_CONNECTION_LINE_ROOT_CLASS); } + getVariantIsWritable() : boolean { + if ( !this.versionControlService?.getVariantIsWritable()){ + return false; + } + return true; + } + getMode(): PreviewLineMode { return this.mode; } @@ -93,6 +102,9 @@ export class TrainrunSectionPreviewLineView { dragIntermediateStopInfo: DragIntermediateStopInfo, startPosition: Vec2D, ) { + if ( !this.versionControlService?.getVariantIsWritable()){ + return; + } this.mode = PreviewLineMode.DragIntermediateStop; this.dragIntermediateStopInfo = dragIntermediateStopInfo; this.startIntermediatePos = startPosition; @@ -105,6 +117,9 @@ export class TrainrunSectionPreviewLineView { dragTransition: DragTransitionInfo, startPosition: Vec2D, ) { + if ( !this.versionControlService?.getVariantIsWritable()){ + return; + } this.filterService.switchOffTemporaryEmptyAndNonStopFiltering(); this.mode = PreviewLineMode.DragTransition; this.dragTransitionInfo = dragTransition; @@ -143,6 +158,9 @@ export class TrainrunSectionPreviewLineView { } startPreviewLine(nodeId: number) { + if ( !this.versionControlService?.getVariantIsWritable()){ + return; + } this.mode = PreviewLineMode.DragNewTrainrunSection; const mousePosition = d3.mouse( d3.select(StaticDomTags.PREVIEW_LINE_ROOT_DOM_REF).node(), @@ -153,6 +171,9 @@ export class TrainrunSectionPreviewLineView { } startPreviewLineAtPosition(startNode: Node, startPosition: Vec2D) { + if ( !this.versionControlService?.getVariantIsWritable()){ + return; + } this.mode = PreviewLineMode.DragExistingTrainrunSection; this.startNode = startNode; this.startPos = startPosition; diff --git a/src/app/view/editor-main-view/data-views/trainrunsections.view.spec.ts b/src/app/view/editor-main-view/data-views/trainrunsections.view.spec.ts index 7f6cd843..5c4befa2 100644 --- a/src/app/view/editor-main-view/data-views/trainrunsections.view.spec.ts +++ b/src/app/view/editor-main-view/data-views/trainrunsections.view.spec.ts @@ -171,7 +171,8 @@ describe("TrainrunSection-View", () => { copyService, logService, viewportCullSerivce, - levelOfDetailService + levelOfDetailService, + undefined ); controller.bindViewToServices(); diff --git a/src/app/view/editor-main-view/data-views/transitions.view.spec.ts b/src/app/view/editor-main-view/data-views/transitions.view.spec.ts index 302cfd11..9a168d30 100644 --- a/src/app/view/editor-main-view/data-views/transitions.view.spec.ts +++ b/src/app/view/editor-main-view/data-views/transitions.view.spec.ts @@ -167,7 +167,8 @@ describe("Transitions-View", () => { copyService, logService, viewportCullSerivce, - levelOfDetailService + levelOfDetailService, + undefined ); controller.bindViewToServices(); diff --git a/src/app/view/editor-main-view/data-views/transitions.view.ts b/src/app/view/editor-main-view/data-views/transitions.view.ts index 8a6f166a..5cc3a87f 100644 --- a/src/app/view/editor-main-view/data-views/transitions.view.ts +++ b/src/app/view/editor-main-view/data-views/transitions.view.ts @@ -327,6 +327,11 @@ export class TransitionsView { onTransitionMouseup(trainrun: Trainrun, domObj: any, transition: Transition) { d3.event.stopPropagation(); + + if ( !this.editorView.trainrunSectionPreviewLineView.getVariantIsWritable() ){ + return; + } + const node: Node = this.editorView.getNodeFromTransition(transition); if ( this.editorView.trainrunSectionPreviewLineView.getMode() === diff --git a/src/app/view/editor-main-view/editor-main-view.component.ts b/src/app/view/editor-main-view/editor-main-view.component.ts index 365192af..1e3caa73 100644 --- a/src/app/view/editor-main-view/editor-main-view.component.ts +++ b/src/app/view/editor-main-view/editor-main-view.component.ts @@ -91,7 +91,8 @@ export class EditorMainViewComponent implements AfterViewInit, OnDestroy { copyService, logService, viewportCullSerivce, - levelOfDetailService + levelOfDetailService, + versionControlService ); this.uiInteractionService.zoomInObservable .pipe(takeUntil(this.destroyed)) From bb004ef18bb454441f79be65509d412347b6568c Mon Sep 17 00:00:00 2001 From: adrian_egli Date: Tue, 20 Aug 2024 16:04:50 +0200 Subject: [PATCH 05/17] UI / Dialog - if the variant is not editable -> readonly interactive drawing --- .../editor-main-view/data-views/trainrunsections.view.ts | 4 +++- .../view/editor-main-view/data-views/transitions.view.ts | 8 +++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/view/editor-main-view/data-views/trainrunsections.view.ts b/src/app/view/editor-main-view/data-views/trainrunsections.view.ts index 99d9ddeb..0232ec33 100644 --- a/src/app/view/editor-main-view/data-views/trainrunsections.view.ts +++ b/src/app/view/editor-main-view/data-views/trainrunsections.view.ts @@ -1221,7 +1221,9 @@ export class TrainrunSectionsView { connectedTrainIds: any, atSource: boolean, ) { - + if (!this.editorView.trainrunSectionPreviewLineView.getVariantIsWritable()){ + return; + } groupEnter .append(StaticDomTags.EDGE_LINE_PIN_SVG) .attr("class", StaticDomTags.EDGE_LINE_PIN_CLASS) diff --git a/src/app/view/editor-main-view/data-views/transitions.view.ts b/src/app/view/editor-main-view/data-views/transitions.view.ts index 5cc3a87f..4788acc6 100644 --- a/src/app/view/editor-main-view/data-views/transitions.view.ts +++ b/src/app/view/editor-main-view/data-views/transitions.view.ts @@ -151,6 +151,9 @@ export class TransitionsView { selectedTrainrun: Trainrun, connectedTrainIds: any, ) { + if (!this.editorView.trainrunSectionPreviewLineView.getVariantIsWritable()){ + return; + } grpEnter .append(StaticDomTags.TRANSITION_BUTTON_SVG) .attr( @@ -327,11 +330,6 @@ export class TransitionsView { onTransitionMouseup(trainrun: Trainrun, domObj: any, transition: Transition) { d3.event.stopPropagation(); - - if ( !this.editorView.trainrunSectionPreviewLineView.getVariantIsWritable() ){ - return; - } - const node: Node = this.editorView.getNodeFromTransition(transition); if ( this.editorView.trainrunSectionPreviewLineView.getMode() === From a567f7758f32f0dff903c37fa5bd2d01da80c907 Mon Sep 17 00:00:00 2001 From: adrian_egli Date: Tue, 20 Aug 2024 16:07:35 +0200 Subject: [PATCH 06/17] UI / Dialog - if the variant is not editable -> readonly interactive drawing --- .../data-views/nodes.view.scss | 4 ++++ .../editor-main-view/data-views/nodes.view.ts | 19 +++++++++++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/app/view/editor-main-view/data-views/nodes.view.scss b/src/app/view/editor-main-view/data-views/nodes.view.scss index e1238eb4..0dab3138 100644 --- a/src/app/view/editor-main-view/data-views/nodes.view.scss +++ b/src/app/view/editor-main-view/data-views/nodes.view.scss @@ -59,6 +59,10 @@ cursor: default; } +::ng-deep rect.node_hover_drag_root_background.readonly { + cursor: default; +} + ::ng-deep text.node_text.hover { fill: $COLOR_Edit; } diff --git a/src/app/view/editor-main-view/data-views/nodes.view.ts b/src/app/view/editor-main-view/data-views/nodes.view.ts index a0a6ecdb..1f43766b 100644 --- a/src/app/view/editor-main-view/data-views/nodes.view.ts +++ b/src/app/view/editor-main-view/data-views/nodes.view.ts @@ -324,9 +324,10 @@ export class NodesView { } private makeHoverDragBackground(groupEnter: any) { - - groupEnter - .append(StaticDomTags.NODE_HOVER_DRAG_AREA_BACKGROUND_SVG) + const added= + groupEnter + .append(StaticDomTags.NODE_HOVER_DRAG_AREA_BACKGROUND_SVG); + added .attr("class", StaticDomTags.NODE_HOVER_DRAG_AREA_BACKGROUND_CLASS) .classed(StaticDomTags.TAG_SELECTED, (n: NodeViewObject) => n.node.selected(), @@ -340,7 +341,17 @@ export class NodesView { "y", (n: NodeViewObject) => n.node.getNodeHeight() - NODE_TEXT_AREA_HEIGHT, ) - .call(this.draggable) + .classed( + StaticDomTags.NODE_READONLY, + !this.editorView.trainrunSectionPreviewLineView.getVariantIsWritable() + ); + + if ( this.editorView.trainrunSectionPreviewLineView.getVariantIsWritable() ){ + added + .call(this.draggable); + } + + added .on("mouseover", (n: NodeViewObject, i, a) => this.onNodeMouseoverDragButton(n.node, a[i]), ) From d2d23de966c32cdae9790f65495c9d80d0425f70 Mon Sep 17 00:00:00 2001 From: adrian_egli Date: Tue, 20 Aug 2024 16:14:31 +0200 Subject: [PATCH 07/17] UI / Dialog - if the variant is not editable -> readonly interactive drawing --- .../editor-node-detail-view.component.html | 42 +++++++++++++------ .../editor-node-detail-view.component.scss | 10 +++++ .../editor-node-detail-view.component.ts | 2 + 3 files changed, 41 insertions(+), 13 deletions(-) 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 3cc0681f..e30b3903 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 @@ -6,21 +6,30 @@

{{ 'app.view.editor-side-view.editor-node-detail-view.base-data' | translate }} - + - + - + {{ 'app.view.editor-side-view.editor-node-detail-view.filterable-labels' | translate }} - + - +
{{ 'app.view.editor-side-view.editor-node-detail-view.ipv' | translate }} @@ -300,12 +314,14 @@

- + + + diff --git a/src/app/view/editor-side-view/editor-node-detail-view/editor-node-detail-view.component.scss b/src/app/view/editor-side-view/editor-node-detail-view/editor-node-detail-view.component.scss index 2e851d09..95497863 100644 --- a/src/app/view/editor-side-view/editor-node-detail-view/editor-node-detail-view.component.scss +++ b/src/app/view/editor-side-view/editor-node-detail-view/editor-node-detail-view.component.scss @@ -61,3 +61,13 @@ } } } + +sbb-form-field.readonly { + pointer-events: none; + cursor: default; +} + +table.NodeDataTable.readonly { + pointer-events: none; + cursor: default; +} 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 ea68518e..1ac22d36 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 @@ -23,6 +23,7 @@ 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"; +import {VersionControlService} from "../../../services/data/version-control.service"; interface NodeProperties { nodeId: number; @@ -71,6 +72,7 @@ export class EditorNodeDetailViewComponent implements OnInit, OnDestroy { private nodeService: NodeService, private labelService: LabelService, private labelGroupService: LabelGroupService, + public versionControlService : VersionControlService, private cd: ChangeDetectorRef, ) {} From c819a5350d2f66b4045e818701d1a7a73404f8d8 Mon Sep 17 00:00:00 2001 From: adrian_egli Date: Tue, 20 Aug 2024 16:17:04 +0200 Subject: [PATCH 08/17] UI / Dialog - if the variant is not editable -> remove buttons --- .../editor-tools-view.component.html | 87 +++++++++---------- .../editor-tools-view.component.scss | 5 -- 2 files changed, 43 insertions(+), 49 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 b21f6d5f..fde30347 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,26 +40,25 @@

{{ 'app.view.editor-side-view.editor-tools-view-compone {{ 'app.view.editor-side-view.editor-tools-view-component.export-netzgrafik-as-json' | translate }} -
- - - {{ 'app.view.editor-side-view.editor-tools-view-component.import-netzgrafik-as-json' | translate }} + +
+ + + {{ 'app.view.editor-side-view.editor-tools-view-component.import-netzgrafik-as-json' | translate }} +
+
- {{ 'app.view.editor-side-view.editor-tools-view-component.import-base-data' | translate }} - {{ 'app.view.editor-side-view.editor-tools-view-component.help-csv-data' | translate }} - -
+ + + {{ 'app.view.editor-side-view.editor-tools-view-component.import-base-data' | translate }} + {{ 'app.view.editor-side-view.editor-tools-view-component.help-csv-data' | translate }} + +
+
- - - {{ 'app.view.editor-filter-view.saved-filters' | translate }} - -
- - - + + + + {{ 'app.view.editor-filter-view.saved-filters' | translate }} + +
+ + + - + + + + + + - - - - + + +
- -
- - -
-
+
+
+
diff --git a/src/app/view/editor-filter-view/editor-filter-view.component.ts b/src/app/view/editor-filter-view/editor-filter-view.component.ts index f71c1014..12cf52b1 100644 --- a/src/app/view/editor-filter-view/editor-filter-view.component.ts +++ b/src/app/view/editor-filter-view/editor-filter-view.component.ts @@ -13,6 +13,7 @@ import {FilterSetting} from "../../models/filterSettings.model"; import {takeUntil} from "rxjs/operators"; import {StaticDomTags} from "../editor-main-view/data-views/static.dom.tags"; import {environment} from "../../../environments/environment"; +import {VersionControlService} from "../../services/data/version-control.service"; @Component({ selector: "sbb-editor-filter-view", @@ -45,6 +46,7 @@ export class EditorFilterViewComponent implements OnInit, OnDestroy { public dataService: DataService, public uiInteractionService: UiInteractionService, public filterService: FilterService, + public versionControlService : VersionControlService, ) { this.activeFilterName = undefined; this.activeEditFilterSettingId = undefined; From 2b860d2ef02edd9a603842532219a41df3dd9345 Mon Sep 17 00:00:00 2001 From: adrian_egli Date: Tue, 20 Aug 2024 16:32:06 +0200 Subject: [PATCH 11/17] short key removed -> all editing function deleted (e.g. copy is allowed) --- .../editor-node-detail-view.component.html | 5 ++++- 1 file 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 e30b3903..d90ce735 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 @@ -45,7 +45,10 @@

- + Date: Mon, 26 Aug 2024 08:50:51 +0200 Subject: [PATCH 12/17] removed unused scss "tags" --- .../editor-menu/editor-menu.component.scss | 46 ------------------- 1 file changed, 46 deletions(-) diff --git a/src/app/view/editor-menu/editor-menu.component.scss b/src/app/view/editor-menu/editor-menu.component.scss index c853a5e5..36060317 100644 --- a/src/app/view/editor-menu/editor-menu.component.scss +++ b/src/app/view/editor-menu/editor-menu.component.scss @@ -87,52 +87,6 @@ $COLOR_TOPO_EDITOR_ACTIVE: #eb0000; } } -.ButtonSave { - width: $EDITOR_MENU_BUTTON_SIZE; - height: $INSIDE_OBJECT_HEIGHT; - min-width: $EDITOR_MENU_BUTTON_SIZE; - max-width: $EDITOR_MENU_BUTTON_SIZE; - text-align: center; - font-size: 25px; - padding: 8px 0 0 0; - margin: 0; - outline: none; - border: none; -} - -.ButtonSave:hover { - border-bottom: 3px solid var(--sbb-primary-alternative-button-background-color-hover); -} - -.ButtonSave:active { - border-bottom: 3px solid var(--sbb-primary-alternative-button-background-color-default); -} - -.ButtonLoad > input { - display: none; -} - -.ButtonLoad { - width: $EDITOR_MENU_BUTTON_SIZE; - height: $INSIDE_OBJECT_HEIGHT; - min-width: $EDITOR_MENU_BUTTON_SIZE; - max-width: $EDITOR_MENU_BUTTON_SIZE; - text-align: center; - font-size: 25px; - padding: 8px 0 0 0; - margin: 0; - outline: none; - border: none; -} - -.ButtonLoad:hover { - border-bottom: 3px solid var(--sbb-primary-alternative-button-background-color-hover); -} - -.ButtonLoad:active { - border-bottom: 3px solid var(--sbb-primary-alternative-button-background-color-default); -} - .ButtonFilter { width: $EDITOR_MENU_BUTTON_SIZE; height: $INSIDE_OBJECT_HEIGHT; From a08c62789da57bc1dfd1e76129c13535f7477907 Mon Sep 17 00:00:00 2001 From: adrian_egli Date: Mon, 26 Aug 2024 09:13:33 +0200 Subject: [PATCH 13/17] Styling and color editor - menu adjusted (polished) --- .../editor-menu/editor-menu.component.html | 2 +- .../editor-menu/editor-menu.component.scss | 53 +++++++++++++++++-- 2 files changed, 49 insertions(+), 6 deletions(-) diff --git a/src/app/view/editor-menu/editor-menu.component.html b/src/app/view/editor-menu/editor-menu.component.html index 85158b84..7ca57c1b 100644 --- a/src/app/view/editor-menu/editor-menu.component.html +++ b/src/app/view/editor-menu/editor-menu.component.html @@ -142,7 +142,7 @@ [class.isStreckengrafikEditing]=" isStreckengrafikEditing() || isAnalytics() " - [class.readonly]="!getVariantIsWritable()" + [class.readonly]="isStreckengrafikEditing() || isAnalytics() || !getVariantIsWritable()" [disabled]="isStreckengrafikEditing() || isAnalytics() || !getVariantIsWritable()" (click)="onTopologieEditor()" [title]="'app.view.editor-menu.topology-editor-disabled' | translate" diff --git a/src/app/view/editor-menu/editor-menu.component.scss b/src/app/view/editor-menu/editor-menu.component.scss index 36060317..646e5197 100644 --- a/src/app/view/editor-menu/editor-menu.component.scss +++ b/src/app/view/editor-menu/editor-menu.component.scss @@ -208,6 +208,7 @@ $COLOR_TOPO_EDITOR_ACTIVE: #eb0000; } .ButtonTopologieEditor.TopologyEditing { + border-bottom: 3px solid $COLOR_TOPO_EDITOR_ACTIVE; color: $COLOR_TOPO_EDITOR_ACTIVE; } @@ -248,6 +249,7 @@ $COLOR_TOPO_EDITOR_ACTIVE: #eb0000; } .ButtonNoteEditor.NoteEditing { + border-bottom: 3px solid $COLOR_TOPO_EDITOR_ACTIVE; color: $COLOR_TOPO_EDITOR_ACTIVE; } @@ -298,6 +300,7 @@ $COLOR_TOPO_EDITOR_ACTIVE: #eb0000; } .ButtonStreckengrafikEditor.StreckengrafikEditing { + border-bottom: 3px solid $COLOR_TOPO_EDITOR_ACTIVE; color: $COLOR_TOPO_EDITOR_ACTIVE; } @@ -348,7 +351,7 @@ $COLOR_TOPO_EDITOR_ACTIVE: #eb0000; } .ButtonMultiNodeMoving.MultiNodeMoving { - border-bottom: 3px solid var(--sbb-primary-alternative-button-background-color-default); + border-bottom: 3px solid $COLOR_TOPO_EDITOR_ACTIVE; color: $COLOR_TOPO_EDITOR_ACTIVE; } @@ -365,10 +368,6 @@ path.ButtonMultiNodeMoving { fill: currentColor; } -path.ButtonMultiNodeMoving.disabled { -} - - .ButtonAnalytics { width: $EDITOR_MENU_BUTTON_SIZE; height: $INSIDE_OBJECT_HEIGHT; @@ -396,6 +395,7 @@ path.ButtonMultiNodeMoving.disabled { } .ButtonAnalytics.ButtonAnalyticsActive { + border-bottom: 3px solid $COLOR_TOPO_EDITOR_ACTIVE; color: $COLOR_TOPO_EDITOR_ACTIVE; } @@ -472,3 +472,46 @@ button.ButtonTopologieEditor.readonly { button.ButtonNoteEditor.readonly { fill-opacity: 0.35; } + +button.ButtonTopologieEditor.readonly:hover { + border-bottom: 0 solid var(--sbb-header-lean-background-color); +} + +button.ButtonNoteEditor.readonly:hover { + border-bottom: 0 solid var(--sbb-header-lean-background-color); +} + +.ButtonTopologieEditor.NetzgrafikEditing.isStreckengrafikEditing.readonly { + border-bottom: 0 solid var(--sbb-header-lean-background-color); +} + +.ButtonStreckengrafikEditor.NetzgrafikEditing.isNotStreckengrafikAllowed:hover { + border-bottom: 0 solid var(--sbb-header-lean-background-color); +} + +.ButtonMultiNodeMoving.NetzgrafikEditing.isStreckengrafikEditing { + fill-opacity: 0.35; + border-bottom: 0 solid var(--sbb-header-lean-background-color); +} + +.ButtonNoteEditor.NetzgrafikEditing.isStreckengrafikEditing { + fill-opacity: 0.35; + border-bottom: 0 solid var(--sbb-header-lean-background-color); +} + +.ButtonMultiNodeMoving.NetzgrafikEditing.isStreckengrafikEditing:hover { + border-bottom: 0 solid var(--sbb-header-lean-background-color); +} + +.ButtonNoteEditor.NetzgrafikEditing.isStreckengrafikEditing:hover { + border-bottom: 0 solid var(--sbb-header-lean-background-color); +} + +.ButtonAnalytics.isStreckengrafikEditing { + fill-opacity: 0.35; + border-bottom: 0 solid var(--sbb-header-lean-background-color); +} + +.ButtonAnalytics.isStreckengrafikEditing:hover { + border-bottom: 0 solid var(--sbb-header-lean-background-color); +} From 99f7ccb41ecf824c4f353091f39c0cf6171ed497 Mon Sep 17 00:00:00 2001 From: Louis Greiner Date: Mon, 26 Aug 2024 15:57:16 +0200 Subject: [PATCH 14/17] fix: missing translations --- src/app/view/variant/variant-view/variant-view.component.html | 4 ++-- src/assets/i18n/de.json | 3 --- src/assets/i18n/en.json | 3 --- src/assets/i18n/fr.json | 3 --- src/assets/i18n/it.json | 3 --- 5 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/app/view/variant/variant-view/variant-view.component.html b/src/app/view/variant/variant-view/variant-view.component.html index 475355e1..c7654742 100644 --- a/src/app/view/variant/variant-view/variant-view.component.html +++ b/src/app/view/variant/variant-view/variant-view.component.html @@ -20,11 +20,11 @@

sbb-menu-item mode="icon" (click)="onDeleteVariant()" - [title]="'app.view.variant.variant-view.delete-variant' | translate" + [title]="'app.view.variant.variant-view.delete-variant.title' | translate" *ngIf="versionControlService.variant.isDeletable" > - {{ 'app.view.variant.variant-view.delete-variant' | translate }} + {{ 'app.view.variant.variant-view.delete-variant.title' | translate }}

diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json index a0bd48c0..0831f58c 100644 --- a/src/assets/i18n/de.json +++ b/src/assets/i18n/de.json @@ -590,7 +590,6 @@ "archived": "(archiviert)", "edit-variant": "Variante bearbeiten", "delete-variant": { - "_value": "Variante löschen", "title": "Variante löschen", "content": "Möchten Sie die Variante und alle enthaltenen Versionen endgültig löschen? Diese Aktion kann nicht rückgängig gemacht werden." }, @@ -604,13 +603,11 @@ "project-description": "Projekt Beschreibung", "edit-project": "Projekt bearbeiten", "archive-project": { - "_value": "Projekt archivieren", "title": "Projekt archivieren", "content": "Möchten Sie das Projekt jetzt archivieren?" }, "undo-archiving": "Archivierung rückgängig machen", "delete-project": { - "_value": "Projekt löschen", "title": "Projekt löschen", "content": "Möchten Sie das Projekt und alle enthaltenen Varianten endgültig löschen? Diese Aktion kann nicht rückgängig gemacht werden." }, diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 98ac66ce..04cbf5dc 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -590,7 +590,6 @@ "archived": "(archived)", "edit-variant": "Edit variant", "delete-variant": { - "_value": "Delete variant", "title": "Delete variant", "content": "Do you want to permanently delete the variant and all versions it contains? This action cannot be undone." }, @@ -604,13 +603,11 @@ "project-description": "Project description", "edit-project": "Edit project", "archive-project": { - "_value": "Archive project", "title": "Archive project", "content": "Would you like to archive the project now?" }, "undo-archiving": "Undo archiving", "delete-project": { - "_value": "Delete project", "title": "Delete projekt", "content": "Do you want to permanently delete the project and all the variants it contains? This action cannot be undone." }, diff --git a/src/assets/i18n/fr.json b/src/assets/i18n/fr.json index 98ac66ce..04cbf5dc 100644 --- a/src/assets/i18n/fr.json +++ b/src/assets/i18n/fr.json @@ -590,7 +590,6 @@ "archived": "(archived)", "edit-variant": "Edit variant", "delete-variant": { - "_value": "Delete variant", "title": "Delete variant", "content": "Do you want to permanently delete the variant and all versions it contains? This action cannot be undone." }, @@ -604,13 +603,11 @@ "project-description": "Project description", "edit-project": "Edit project", "archive-project": { - "_value": "Archive project", "title": "Archive project", "content": "Would you like to archive the project now?" }, "undo-archiving": "Undo archiving", "delete-project": { - "_value": "Delete project", "title": "Delete projekt", "content": "Do you want to permanently delete the project and all the variants it contains? This action cannot be undone." }, diff --git a/src/assets/i18n/it.json b/src/assets/i18n/it.json index 98ac66ce..04cbf5dc 100644 --- a/src/assets/i18n/it.json +++ b/src/assets/i18n/it.json @@ -590,7 +590,6 @@ "archived": "(archived)", "edit-variant": "Edit variant", "delete-variant": { - "_value": "Delete variant", "title": "Delete variant", "content": "Do you want to permanently delete the variant and all versions it contains? This action cannot be undone." }, @@ -604,13 +603,11 @@ "project-description": "Project description", "edit-project": "Edit project", "archive-project": { - "_value": "Archive project", "title": "Archive project", "content": "Would you like to archive the project now?" }, "undo-archiving": "Undo archiving", "delete-project": { - "_value": "Delete project", "title": "Delete projekt", "content": "Do you want to permanently delete the project and all the variants it contains? This action cannot be undone." }, From d95ad228f6e83674e03fd0bbf6581f7ea96ae103 Mon Sep 17 00:00:00 2001 From: adrian_egli Date: Tue, 27 Aug 2024 07:59:43 +0200 Subject: [PATCH 15/17] typo fixed --- .../perlenkette-node/perlenkette-node.component.html | 2 +- .../perlenkette/perlenkette-node/perlenkette-node.component.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/perlenkette/perlenkette-node/perlenkette-node.component.html b/src/app/perlenkette/perlenkette-node/perlenkette-node.component.html index d94ad322..4cccdfe7 100644 --- a/src/app/perlenkette/perlenkette-node/perlenkette-node.component.html +++ b/src/app/perlenkette/perlenkette-node/perlenkette-node.component.html @@ -1,4 +1,4 @@ -
Date: Tue, 27 Aug 2024 13:05:08 +0200 Subject: [PATCH 16/17] code clean up --- .../perlenkette-node/perlenkette-node.component.ts | 4 +++- .../perlenkette-section.component.ts | 4 +++- src/app/perlenkette/perlenkette.component.ts | 10 +++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/app/perlenkette/perlenkette-node/perlenkette-node.component.ts b/src/app/perlenkette/perlenkette-node/perlenkette-node.component.ts index 8dd6d97b..61d0ea4e 100644 --- a/src/app/perlenkette/perlenkette-node/perlenkette-node.component.ts +++ b/src/app/perlenkette/perlenkette-node/perlenkette-node.component.ts @@ -350,7 +350,9 @@ export class PerlenketteNodeComponent implements OnInit { } disableSectionView(event: MouseEvent) { - this.signalIsBeingEdited.next(undefined); + if (!this.getVariantIsWritable()) { + this.signalIsBeingEdited.next(undefined); + } event.stopPropagation(); } diff --git a/src/app/perlenkette/perlenkette-section/perlenkette-section.component.ts b/src/app/perlenkette/perlenkette-section/perlenkette-section.component.ts index 64229be8..7eae9aa3 100644 --- a/src/app/perlenkette/perlenkette-section/perlenkette-section.component.ts +++ b/src/app/perlenkette/perlenkette-section/perlenkette-section.component.ts @@ -222,7 +222,9 @@ export class PerlenketteSectionComponent } disableSectionView(event: MouseEvent) { - this.signalIsBeingEdited.next(this.perlenketteSection); + if (!this.getVariantIsWritable()) { + this.signalIsBeingEdited.next(this.perlenketteSection); + } event.stopPropagation(); } diff --git a/src/app/perlenkette/perlenkette.component.ts b/src/app/perlenkette/perlenkette.component.ts index 7e0f0bcd..34d8e4dd 100644 --- a/src/app/perlenkette/perlenkette.component.ts +++ b/src/app/perlenkette/perlenkette.component.ts @@ -21,6 +21,7 @@ import {EditorMode} from "../view/editor-menu/editor-mode"; import {NodeService} from "../services/data/node.service"; import {takeUntil} from "rxjs/operators"; import {PerlenketteConnection} from "./model/perlenketteConnection"; +import {VersionControlService} from "../services/data/version-control.service"; @Component({ selector: "sbb-perlenkette", @@ -53,6 +54,7 @@ export class PerlenketteComponent implements AfterContentChecked, OnDestroy { readonly filterService: FilterService, private readonly uiInteractionService: UiInteractionService, private readonly nodeService: NodeService, + private versionControlService : VersionControlService, private changeDetectorRef: ChangeDetectorRef, ) { this.selectedPerlenketteConnection = undefined; @@ -227,8 +229,14 @@ export class PerlenketteComponent implements AfterContentChecked, OnDestroy { return this.signalAllChildrenIsBeingEditedSubject.asObservable(); } + getVariantIsWritable() : boolean { + return this.versionControlService.getVariantIsWritable(); + } + disableSectionView() { - this.signalIsBeingEdited(undefined); + if (!this.getVariantIsWritable()) { + this.signalIsBeingEdited(undefined); + } } scrollFirst(event: MouseEvent) { From 4b6c5e52dc8680f973f5726eeac355ffd2e96167 Mon Sep 17 00:00:00 2001 From: adrian_egli Date: Tue, 27 Aug 2024 15:36:00 +0200 Subject: [PATCH 17/17] if the project is archvied -> variants archive stat can not be edited. => write control doesn't allow changes --- src/app/view/variant/variants-view/variants-view.component.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/app/view/variant/variants-view/variants-view.component.ts b/src/app/view/variant/variants-view/variants-view.component.ts index a744f1c5..9218b15a 100644 --- a/src/app/view/variant/variants-view/variants-view.component.ts +++ b/src/app/view/variant/variants-view/variants-view.component.ts @@ -166,6 +166,10 @@ export class VariantsViewComponent implements OnDestroy { } getVariantDataActions(variant: VariantSummaryDto): Observable { + if (this.project.isArchived) { + return undefined; + } + if (variant.isArchived) { return of([ {