only one modal submit block needed

This commit is contained in:
Drew Ansbacher
2021-08-30 18:42:23 -06:00
committed by Aiden McClelland
parent 7ec2d26fe7
commit 033af493ab
3 changed files with 7 additions and 2 deletions

View File

@@ -27,8 +27,10 @@ export class AppComponent {
@HostListener('document:keypress', ['$event'])
handleKeyboardEvent (event: KeyboardEvent) {
if (event.key === 'Enter') {
const elems = document.getElementsByClassName('enter-click')
const elem = elems[elems.length - 1] as HTMLButtonElement
if (elem.classList.contains('no-click')) return
if (elem) elem.click()
}
}
@@ -99,7 +101,7 @@ export class AppComponent {
this.patch.watch$()
.pipe(
filter(data => !isEmptyObject(data)),
filter(data => !isEmptyObject(data as object)),
take(1),
)
.subscribe(_ => {

View File

@@ -81,7 +81,7 @@
<ion-footer>
<ion-toolbar *ngIf="patch.data['package-data'][pkgId] as pkg">
<ion-buttons slot="end" class="ion-padding-end">
<ion-button fill="outline" [disabled]="loadingText" (click)="save(pkg)" class="enter-click">
<ion-button fill="outline" [disabled]="saving" (click)="save(pkg)" class="enter-click" [class.no-click]="saving">
Save
</ion-button>
</ion-buttons>

View File

@@ -23,6 +23,7 @@ export class AppConfigPage {
configForm: FormGroup
current: object
hasConfig = false
saving = false
rec: Recommendation | null = null
showRec = true
@@ -128,6 +129,7 @@ export class AppConfigPage {
const config = this.configForm.value
try {
this.saving = true
const breakages = await this.embassyApi.drySetPackageConfig({
id: pkg.manifest.id,
config,
@@ -152,6 +154,7 @@ export class AppConfigPage {
} catch (e) {
this.errToast.present(e)
} finally {
this.saving = false
loader.dismiss()
}
}