misc fixes

This commit is contained in:
Drew Ansbacher
2021-08-26 11:04:38 -06:00
committed by Matt Hill
parent f78d6c3034
commit 601604a3d0
3 changed files with 26 additions and 21 deletions

View File

@@ -30,16 +30,20 @@ export class LogsPage {
} }
async fetch (isBefore: boolean = true) { async fetch (isBefore: boolean = true) {
const logs = await this.fetchLogs({ try {
before: isBefore ? this.before : undefined, const logs = await this.fetchLogs({
after: !isBefore ? this.after : undefined, before: isBefore ? this.before : undefined,
limit: this.limit, after: !isBefore ? this.after : undefined,
}) limit: this.limit,
this.before = logs[0]?.timestamp })
this.after = logs[logs.length - 1]?.timestamp this.before = logs[0]?.timestamp
this.loading = false this.after = logs[logs.length - 1]?.timestamp
this.loading = false
return logs return logs
} catch (e) {
this.errToast.present(e)
}
} }
async getLogs () { async getLogs () {
@@ -63,20 +67,20 @@ export class LogsPage {
this.needInfinite = false this.needInfinite = false
} }
} catch (e) { } catch (e) { }
this.errToast.present(e)
}
} }
async loadMore () { async loadMore () {
this.loadingMore = true try {
const logs = await this.fetch(false) this.loadingMore = true
const container = document.getElementById('container') const logs = await this.fetch(false)
const newLogs = document.getElementById('template').cloneNode(true) as HTMLElement const container = document.getElementById('container')
newLogs.innerHTML = logs.map(l => `${l.timestamp} ${l.log}`).join('\n\n') + (logs.length ? '\n\n' : '') const newLogs = document.getElementById('template').cloneNode(true) as HTMLElement
container.append(newLogs) newLogs.innerHTML = logs.map(l => `${l.timestamp} ${l.log}`).join('\n\n') + (logs.length ? '\n\n' : '')
this.loadingMore = false container.append(newLogs)
this.scrollEvent() this.loadingMore = false
this.scrollEvent()
} catch (e) { }
} }
scrollEvent () { scrollEvent () {

View File

@@ -107,7 +107,7 @@ export class AppConfigPage {
} }
async dismiss () { async dismiss () {
if (this.configForm.dirty) { if (this.configForm?.dirty) {
await this.presentAlertUnsaved() await this.presentAlertUnsaved()
} else { } else {
this.modalCtrl.dismiss() this.modalCtrl.dismiss()

View File

@@ -143,6 +143,7 @@ export class AppActionsPage {
} }
private async executeAction (pkgId: string, actionId: string, input?: object): Promise<boolean> { private async executeAction (pkgId: string, actionId: string, input?: object): Promise<boolean> {
console.log('executing action')
const loader = await this.loadingCtrl.create({ const loader = await this.loadingCtrl.create({
spinner: 'lines', spinner: 'lines',
message: 'Executing action...', message: 'Executing action...',