From 601604a3d0f7308aa17048a472d84c851b2aba0d Mon Sep 17 00:00:00 2001 From: Drew Ansbacher Date: Thu, 26 Aug 2021 11:04:38 -0600 Subject: [PATCH] misc fixes --- ui/src/app/components/logs/logs.page.ts | 44 ++++++++++--------- .../app/modals/app-config/app-config.page.ts | 2 +- .../app-actions/app-actions.page.ts | 1 + 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/ui/src/app/components/logs/logs.page.ts b/ui/src/app/components/logs/logs.page.ts index 119ba22e3..9e097363b 100644 --- a/ui/src/app/components/logs/logs.page.ts +++ b/ui/src/app/components/logs/logs.page.ts @@ -30,16 +30,20 @@ export class LogsPage { } async fetch (isBefore: boolean = true) { - const logs = await this.fetchLogs({ - before: isBefore ? this.before : undefined, - after: !isBefore ? this.after : undefined, - limit: this.limit, - }) - this.before = logs[0]?.timestamp - this.after = logs[logs.length - 1]?.timestamp - this.loading = false + try { + const logs = await this.fetchLogs({ + before: isBefore ? this.before : undefined, + after: !isBefore ? this.after : undefined, + limit: this.limit, + }) + this.before = logs[0]?.timestamp + this.after = logs[logs.length - 1]?.timestamp + this.loading = false - return logs + return logs + } catch (e) { + this.errToast.present(e) + } } async getLogs () { @@ -63,20 +67,20 @@ export class LogsPage { this.needInfinite = false } - } catch (e) { - this.errToast.present(e) - } + } catch (e) { } } async loadMore () { - this.loadingMore = true - const logs = await this.fetch(false) - const container = document.getElementById('container') - const newLogs = document.getElementById('template').cloneNode(true) as HTMLElement - newLogs.innerHTML = logs.map(l => `${l.timestamp} ${l.log}`).join('\n\n') + (logs.length ? '\n\n' : '') - container.append(newLogs) - this.loadingMore = false - this.scrollEvent() + try { + this.loadingMore = true + const logs = await this.fetch(false) + const container = document.getElementById('container') + const newLogs = document.getElementById('template').cloneNode(true) as HTMLElement + newLogs.innerHTML = logs.map(l => `${l.timestamp} ${l.log}`).join('\n\n') + (logs.length ? '\n\n' : '') + container.append(newLogs) + this.loadingMore = false + this.scrollEvent() + } catch (e) { } } scrollEvent () { diff --git a/ui/src/app/modals/app-config/app-config.page.ts b/ui/src/app/modals/app-config/app-config.page.ts index 2f64c9e0f..66558c084 100644 --- a/ui/src/app/modals/app-config/app-config.page.ts +++ b/ui/src/app/modals/app-config/app-config.page.ts @@ -107,7 +107,7 @@ export class AppConfigPage { } async dismiss () { - if (this.configForm.dirty) { + if (this.configForm?.dirty) { await this.presentAlertUnsaved() } else { this.modalCtrl.dismiss() diff --git a/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts b/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts index e05637b12..9ba8ae6fd 100644 --- a/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts +++ b/ui/src/app/pages/apps-routes/app-actions/app-actions.page.ts @@ -143,6 +143,7 @@ export class AppActionsPage { } private async executeAction (pkgId: string, actionId: string, input?: object): Promise { + console.log('executing action') const loader = await this.loadingCtrl.create({ spinner: 'lines', message: 'Executing action...',