Skip to content

Commit

Permalink
fix for config adjustment and wrong toast colour
Browse files Browse the repository at this point in the history
  • Loading branch information
datomo committed Jul 4, 2024
1 parent 8df3d99 commit 8a594c1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 31 deletions.
35 changes: 7 additions & 28 deletions src/app/components/data-view/input/input.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,34 +19,13 @@

<ng-container *ngSwitchCase="_types.booleanTypes().includes(header.dataType.toLowerCase()) ? header.dataType : ''">
<span cInputGroupText *ngIf="showLabel">{{header.name}}</span>
<c-button-group aria-label="boolean entry" class="mx-auto" role="group" size="sm">
<button cButton color="primary" style="border-top-left-radius: 4px !important; border-bottom-left-radius: 4px !important;" (click)="onValueChange(true)" [variant]="value === true ? undefined:'outline'">true</button>
<button cButton color="primary" (click)="onValueChange(false)" [variant]="value === false ? undefined:'outline'">false</button>
@if (header.nullable){
<button cButton color="primary" (click)="onValueChange(null)" [variant]="value === null ? undefined:'outline'" >null</button>
}
</c-button-group>

<!--
<c-form-check class="form-check form-check-inline switch-wrapper" switch sizing="lg">
<input cFormCheckInput [id]="'insertRow'+header.name"
class="align-self-center"
[checked]="value === true"
[disabled]="value === null && header.nullable === true"
(change)="onValueChange(checkboxInput.checked)" #checkboxInput>
<label cFormCheckLabel class="switch switch-label switch-pill switch-outline-primary-alt switch-sm" >
<span class="switch-slider"></span>
</label>
<label cInputGroupText class="insertRowLabel">
{{ value === null ? 'null' : value }}
</label>
<button cButton size="sm"
*ngIf="header.nullable"
[ngClass]="{'btn-primary': value === null || value == undefined, 'btn-light': value !== null}"
(click)="onValueChange( triggerNull(value) )">null
</button>
</c-form-check>-->
<c-button-group aria-label="boolean entry" class="mx-auto" role="group" size="sm">
<button cButton color="primary" style="border-top-left-radius: 4px !important; border-bottom-left-radius: 4px !important;" (click)="onValueChange(true)" [variant]="value === true ? undefined:'outline'">true</button>
<button cButton color="primary" (click)="onValueChange(false)" [variant]="value === false ? undefined:'outline'">false</button>
@if (header.nullable){
<button cButton color="primary" (click)="onValueChange(null)" [variant]="value === null ? undefined:'outline'" >null</button>
}
</c-button-group>
</ng-container>

<ng-container *ngSwitchCase="_types.dateTimeTypes().includes(header.dataType.toLowerCase()) ? header.dataType : ''">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,13 +277,13 @@ export class FormGeneratorComponent implements OnInit, OnDestroy {
this._config.saveChanges(changes).subscribe({
next: res => {
interface Feedback {
success?: boolean;
successful?: boolean;
message?: string;
}

const f: Feedback = <Feedback>res;
//console.log(f);
if (f.success) {
console.log(f);
if (f.successful) {
this._toast.success('Saved changes.', null, null, ToastDuration.SHORT);
this.loadPage();// reload config-page after updating a config, because it can lead to additional groups or elements
} else {
Expand Down

0 comments on commit 8a594c1

Please sign in to comment.