add select/deselect all to backups and enum lists (#1590)

This commit is contained in:
Lucy C
2022-06-30 12:02:16 -06:00
committed by GitHub
parent 7d7f03da4f
commit e9a2d81bbe
5 changed files with 19 additions and 3 deletions

1
.gitignore vendored
View File

@@ -13,3 +13,4 @@ libs/js_engine/src/artifacts/ARM_JS_SNAPSHOT.bin
libs/js_engine/src/artifacts/JS_SNAPSHOT.bin libs/js_engine/src/artifacts/JS_SNAPSHOT.bin
deploy_web.sh deploy_web.sh
secrets.db secrets.db
.vscode/

View File

@@ -11,6 +11,13 @@
<ion-content> <ion-content>
<ion-item-group> <ion-item-group>
<ion-item-divider>
<ion-buttons slot="end" style="padding-bottom: 6px">
<ion-button fill="clear" (click)="toggleSelectAll()">
<b>{{ selectAll ? 'Select All' : 'Deselect All' }}</b>
</ion-button>
</ion-buttons>
</ion-item-divider>
<ion-item *ngFor="let pkg of pkgs"> <ion-item *ngFor="let pkg of pkgs">
<ion-avatar slot="start"> <ion-avatar slot="start">
<img alt="" [src]="pkg.icon" /> <img alt="" [src]="pkg.icon" />

View File

@@ -12,6 +12,7 @@ import { PatchDbService } from 'src/app/services/patch-db/patch-db.service'
export class BackupSelectPage { export class BackupSelectPage {
hasSelection = false hasSelection = false
error: string | IonicSafeString = '' error: string | IonicSafeString = ''
selectAll = true
pkgs: { pkgs: {
id: string id: string
title: string title: string
@@ -58,4 +59,9 @@ export class BackupSelectPage {
handleChange() { handleChange() {
this.hasSelection = this.pkgs.some(p => p.checked) this.hasSelection = this.pkgs.some(p => p.checked)
} }
toggleSelectAll() {
this.pkgs.forEach(pkg => (pkg.checked = this.selectAll))
this.selectAll = !this.selectAll
}
} }

View File

@@ -11,10 +11,10 @@
<ion-content> <ion-content>
<ion-item-group> <ion-item-group>
<ion-item-divider style="padding-bottom: 4px"> <ion-item-divider style="padding-bottom: 6px">
<ion-buttons slot="end"> <ion-buttons slot="end">
<ion-button fill="clear" (click)="toggleSelectAll()"> <ion-button fill="clear" (click)="toggleSelectAll()">
<b>{{ selectAll ? 'All' : 'None' }}</b> <b>{{ selectAll ? 'Select All' : 'Deselect All' }}</b>
</ion-button> </ion-button>
</ion-buttons> </ion-buttons>
</ion-item-divider> </ion-item-divider>

View File

@@ -12,7 +12,7 @@ export class EnumListPage {
@Input() spec: ValueSpecListOf<'enum'> @Input() spec: ValueSpecListOf<'enum'>
@Input() current: string[] @Input() current: string[]
options: { [option: string]: boolean } = {} options: { [option: string]: boolean } = {}
selectAll = true selectAll = false
constructor(private readonly modalCtrl: ModalController) {} constructor(private readonly modalCtrl: ModalController) {}
@@ -20,6 +20,8 @@ export class EnumListPage {
for (let val of this.spec.spec.values) { for (let val of this.spec.spec.values) {
this.options[val] = this.current.includes(val) this.options[val] = this.current.includes(val)
} }
// if none are selected, set selectAll to true
this.selectAll = Object.values(this.options).some(k => !k)
} }
dismiss() { dismiss() {