mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
add select/deselect all to backups and enum lists (#1590)
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -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/
|
||||||
|
|||||||
@@ -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" />
|
||||||
|
|||||||
@@ -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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
@@ -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() {
|
||||||
|
|||||||
Reference in New Issue
Block a user