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)) {
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)) {
const widget = dashboard.configuration.widgets[id];
mainLayout.widgets[id] = {

View File

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

View File

@ -18,6 +18,6 @@
<mat-select class="default-state-controller" [class.!hidden]="!displayStateSelection()"
[(ngModel)]="stateObject[0].id" (ngModelChange)="selectedStateIdChanged()">
<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-select>

View File

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