Skip to content

Commit

Permalink
fix: disable notes in filter sidebar in standalone mode (#211)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
emersion and aiAdrian authored Aug 6, 2024
1 parent 930441c commit df335ef
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 10 deletions.
5 changes: 4 additions & 1 deletion src/app/view/dialogs/note-dialog/note-dialog.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
(noteDeleted)="closeDialog()"
></sbb-note-edit-element>
</sbb-tab>
<sbb-tab [label]="'app.view.dialogs.note-dialog.filterable-labels-tab' | translate" id="note-filterable-labels-tab">
<sbb-tab
[label]="'app.view.dialogs.note-dialog.filterable-labels-tab' | translate" id="note-filterable-labels-tab"
*ngIf="!disableBackend"
>
<sbb-note-filter-tab
[noteDialogParameter]="data"
(noteDeleted)="closeDialog()"
Expand Down
3 changes: 3 additions & 0 deletions src/app/view/dialogs/note-dialog/note-dialog.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {GeneralViewFunctions} from "../../util/generalViewFunctions";
import {Subject} from "rxjs";
import {NoteFormComponentModel} from "./note-form/note-form.component";
import {takeUntil} from "rxjs/operators";
import {environment} from "../../../../environments/environment";

export enum NoteDialogType {
NOTE_DIALOG,
Expand Down Expand Up @@ -47,6 +48,8 @@ export class NoteDialogComponent implements OnDestroy {
public noteTitle: string;
public noteText: string;

readonly disableBackend = environment.disableBackend;

private destroyed = new Subject<void>();
private deleteNoteCallback = null;
private saveNoteCallback = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ <h2 class="SummaryTitle">{{ 'app.view.editor-edit-tools-view-component.edit' | t
></sbb-label-drop-list-component>
</sbb-expansion-panel>

<sbb-expansion-panel [expanded]="false">
<sbb-expansion-panel [expanded]="false" *ngIf="!disableBackend">
<sbb-expansion-panel-header>{{ 'app.view.editor-edit-tools-view-component.notes' | translate }}</sbb-expansion-panel-header>
<sbb-label-drop-list-component
[componentLabelRef]="'Note'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {LabelRef} from "../../data-structures/business.data.structures";
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";

@Component({
selector: "sbb-editor-edit-tools-view-component",
Expand All @@ -32,6 +33,8 @@ export class EditorEditToolsViewComponent implements OnDestroy {
public trainrunLabelGroups: LabelGroup[];
private destroyed = new Subject<void>();

readonly disableBackend = environment.disableBackend;

constructor(
private dataService: DataService,
private nodeService: NodeService,
Expand Down
18 changes: 10 additions & 8 deletions src/app/view/editor-filter-view/editor-filter-view.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ <h2 class="SummaryTitle">{{ 'app.view.editor-filter-view.filter' | translate }}<
></sbb-filterable-label-filter-view>
</sbb-expansion-panel>

<sbb-expansion-panel [expanded]="hasFilteringNoteLabels">
<sbb-expansion-panel [expanded]="hasFilteringNoteLabels" *ngIf="!disableBackend">
<sbb-expansion-panel-header>
<ng-container *ngIf="!isFilteringNoteLabels()">
{{ 'app.view.editor-filter-view.filterable-labels-notes' | translate }}
Expand Down Expand Up @@ -177,13 +177,15 @@ <h2 class="SummaryTitle">{{ 'app.view.editor-filter-view.filter' | translate }}<
</sbb-checkbox>
</div>

<br />
<sbb-label>{{ 'app.view.editor-filter-view.notes' | translate }}</sbb-label>
<div class="sbb-checkbox-group-vertical">
<sbb-checkbox [(ngModel)]="filterNotes" (change)="filterNotesChanged()"
>{{ 'app.view.editor-filter-view.display-notes' | translate }}
</sbb-checkbox>
</div>
<ng-container *ngIf="!disableBackend">
<br />
<sbb-label>{{ 'app.view.editor-filter-view.notes' | translate }}</sbb-label>
<div class="sbb-checkbox-group-vertical">
<sbb-checkbox [(ngModel)]="filterNotes" (change)="filterNotesChanged()"
>{{ 'app.view.editor-filter-view.display-notes' | translate }}
</sbb-checkbox>
</div>
</ng-container>

<button
sbb-secondary-button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {Subject} from "rxjs";
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";

@Component({
selector: "sbb-editor-filter-view",
Expand All @@ -36,6 +37,8 @@ export class EditorFilterViewComponent implements OnInit, OnDestroy {
activeFilterName: string;
activeEditFilterSettingId: number;

readonly disableBackend = environment.disableBackend;

private destroyed = new Subject<void>();

constructor(
Expand Down

0 comments on commit df335ef

Please sign in to comment.