Revert "force title case"

This reverts commit dc7f0110591cc18896e8d2171bca20e492ecaeba.
This commit is contained in:
mpetrov 2024-11-08 12:22:57 +02:00
parent b9d4092208
commit 508effe16a
4 changed files with 9 additions and 12 deletions

View File

@ -95,10 +95,10 @@ export class DashboardUtilsService {
} }
if (isUndefined(dashboard.configuration.states)) { if (isUndefined(dashboard.configuration.states)) {
dashboard.configuration.states = { dashboard.configuration.states = {
default: this.createDefaultState(dashboard.title, true) Default: this.createDefaultState(dashboard.title, true)
}; };
const mainLayout = dashboard.configuration.states.default.layouts.main; const mainLayout = dashboard.configuration.states.Default.layouts.main;
for (const id of Object.keys(dashboard.configuration.widgets)) { for (const id of Object.keys(dashboard.configuration.widgets)) {
const widget = dashboard.configuration.widgets[id]; const widget = dashboard.configuration.widgets[id];
mainLayout.widgets[id] = { mainLayout.widgets[id] = {

View File

@ -109,12 +109,10 @@ export class DashboardStateDialogComponent extends
private validateDuplicateStateId(): ValidatorFn { private validateDuplicateStateId(): ValidatorFn {
return (c: UntypedFormControl) => { return (c: UntypedFormControl) => {
const newStateId: string = c.value.toLowerCase(); const newStateId: string = c.value;
if (newStateId) { if (newStateId) {
const existing = Object.keys(this.states).some( const existing = this.states[newStateId];
key => key.toLowerCase() === newStateId if (existing && newStateId !== this.prevStateId) {
);
if (existing && newStateId !== this.prevStateId.toLowerCase()) {
return { return {
stateExists: true stateExists: true
}; };
@ -140,8 +138,7 @@ export class DashboardStateDialogComponent extends
save(): void { save(): void {
this.submitted = true; this.submitted = true;
this.state = {...this.state, ...this.stateFormGroup.value}; this.state = {...this.state, ...this.stateFormGroup.value};
this.state.name = this.state.name.toLowerCase().trim(); this.state.id = this.state.id.trim();
this.state.id = this.state.id.toLowerCase().trim();
this.dialogRef.close(this.state); this.dialogRef.close(this.state);
} }
} }

View File

@ -18,6 +18,6 @@
<mat-select class="default-state-controller" [class.!hidden]="!displayStateSelection()" <mat-select class="default-state-controller" [class.!hidden]="!displayStateSelection()"
[(ngModel)]="stateObject[0].id" (ngModelChange)="selectedStateIdChanged()"> [(ngModel)]="stateObject[0].id" (ngModelChange)="selectedStateIdChanged()">
<mat-option *ngFor="let stateKv of states | keyvalue" [value]="stateKv.key"> <mat-option *ngFor="let stateKv of states | keyvalue" [value]="stateKv.key">
{{ getStateName(stateKv.key, stateKv.value) | titlecase }} {{getStateName(stateKv.key, stateKv.value)}}
</mat-option> </mat-option>
</mat-select> </mat-select>

View File

@ -80,13 +80,13 @@
<ng-container matColumnDef="name"> <ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef mat-sort-header style="width: 60%"> {{ 'dashboard.state-name' | translate }} </mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header style="width: 60%"> {{ 'dashboard.state-name' | translate }} </mat-header-cell>
<mat-cell *matCellDef="let state"> <mat-cell *matCellDef="let state">
{{ state.name | titlecase }} {{ state.name }}
</mat-cell> </mat-cell>
</ng-container> </ng-container>
<ng-container matColumnDef="id"> <ng-container matColumnDef="id">
<mat-header-cell *matHeaderCellDef mat-sort-header style="width: 40%"> {{ 'dashboard.state-id' | translate }} </mat-header-cell> <mat-header-cell *matHeaderCellDef mat-sort-header style="width: 40%"> {{ 'dashboard.state-id' | translate }} </mat-header-cell>
<mat-cell *matCellDef="let state"> <mat-cell *matCellDef="let state">
{{ state.id | titlecase }} {{ state.id }}
</mat-cell> </mat-cell>
</ng-container> </ng-container>
<ng-container matColumnDef="root"> <ng-container matColumnDef="root">