Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
Merge pull request #266 from admin-ch/feature/VACCINECER-2404-bugfix-…
Browse files Browse the repository at this point in the history
…master-select-state

button enable/disable fixed, version updated
  • Loading branch information
Armin-Isenring-Bit authored Feb 22, 2023
2 parents e672596 + 064a611 commit ac44d24
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"title": "cc-management-ui",
"name": "cc-management-ui",
"version": "4.11.3",
"version": "4.11.4",
"scripts": {
"start": "ng serve",
"build": "ng build",
Expand Down
2 changes: 1 addition & 1 deletion src/app/cache-reset/cache-reset.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h1>{{ "cache.reset.title" | translate }}</h1>
<mat-checkbox (change)="isAllSelected()" [(ngModel)]="item.isSelected">{{ item.value }}</mat-checkbox>
</div>
</div>
<button (click)="resetCache()" id="reset-cache-button" [disabled]="indeterminate" mat-button obButton="primary">
<button (click)="resetCache()" id="reset-cache-button" [disabled]="allUnselected" mat-button obButton="primary">
{{ "cache.reset.resetCaches" | translate }}
</button>
</div>
7 changes: 5 additions & 2 deletions src/app/cache-reset/cache-reset.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ type Checklist = {value: Caches; isSelected: boolean}[];
export class CacheResetComponent {
masterSelected: boolean;
indeterminate: boolean;
allUnselected: boolean;
checklist: Checklist;

constructor(private readonly cacheResetService: CacheResetService) {
this.masterSelected = false;
this.indeterminate = false;
this.allUnselected = true;
this.checklist = [
{value: Caches.KeyIdentifier, isSelected: false},
{value: Caches.SigningInformation, isSelected: false},
Expand All @@ -38,16 +40,17 @@ export class CacheResetComponent {
for (const value of this.checklist) {
value.isSelected = this.masterSelected;
}
this.allUnselected = !this.masterSelected;
this.indeterminate = false;
}

isAllSelected() {
const allUnselected = this.checklist.every(item => !item.isSelected);
this.allUnselected = this.checklist.every(item => !item.isSelected);
const allSelected = this.checklist.every(item => item.isSelected);
if (allSelected) {
this.masterSelected = true;
this.indeterminate = false;
} else if (allUnselected) {
} else if (this.allUnselected) {
this.masterSelected = false;
this.indeterminate = false;
} else {
Expand Down

0 comments on commit ac44d24

Please sign in to comment.