diff --git a/ui/src/app/components/logs/logs.page.ts b/ui/src/app/components/logs/logs.page.ts index 1d9320f8c..c11a5dffd 100644 --- a/ui/src/app/components/logs/logs.page.ts +++ b/ui/src/app/components/logs/logs.page.ts @@ -89,7 +89,7 @@ export class LogsPage { const container = document.getElementById('container') const newLogs = document.getElementById('template').cloneNode(true) as HTMLElement - newLogs.innerHTML = logs.map(l => `${l.timestamp} ${l.message}`).join('\n\n') + (logs.length ? '\n\n' : '') + newLogs.innerHTML = logs.map(l => `${l.timestamp} ${convert.toHtml(l.message)}`).join('\n\n') + (logs.length ? '\n\n' : '') container.append(newLogs) this.loadingMore = false this.scrollEvent() diff --git a/ui/src/app/pages/notifications/notifications.page.html b/ui/src/app/pages/notifications/notifications.page.html index 8cf0ed46d..91fc44eb4 100644 --- a/ui/src/app/pages/notifications/notifications.page.html +++ b/ui/src/app/pages/notifications/notifications.page.html @@ -53,29 +53,31 @@ - - + Delete All

- {{ not.title }} + + {{ not['package-id'] }} - + {{ not.title }} +

{{ not.message }} - - - View Report -

{{ not['created-at'] | date: 'short' }} - - - {{ not['package-id'] }} -

+ + View Report + + + View Service + diff --git a/ui/src/app/pages/notifications/notifications.page.ts b/ui/src/app/pages/notifications/notifications.page.ts index e73d58b9d..7a89a2343 100644 --- a/ui/src/app/pages/notifications/notifications.page.ts +++ b/ui/src/app/pages/notifications/notifications.page.ts @@ -1,7 +1,7 @@ import { Component } from '@angular/core' import { ApiService } from 'src/app/services/api/embassy-api.service' import { ServerNotification, ServerNotifications } from 'src/app/services/api/api.types' -import { LoadingController, ModalController } from '@ionic/angular' +import { AlertController, LoadingController, ModalController } from '@ionic/angular' import { ActivatedRoute } from '@angular/router' import { ErrorToastService } from 'src/app/services/error-toast.service' import { BackupReportPage } from 'src/app/modals/backup-report/backup-report.page' @@ -21,6 +21,7 @@ export class NotificationsPage { constructor ( private readonly embassyApi: ApiService, + private readonly alertCtrl: AlertController, private readonly loadingCtrl: LoadingController, private readonly modalCtrl: ModalController, private readonly errToast: ErrorToastService, @@ -71,7 +72,40 @@ export class NotificationsPage { } } - async deleteAll (): Promise { + async presentAlertDeleteAll () { + const alert = await this.alertCtrl.create({ + backdropDismiss: false, + header: 'Delete All?', + message: 'Are you sure you want to delete all notifications?', + buttons: [ + { + text: 'Cancel', + role: 'cancel', + }, + { + text: 'Delete', + cssClass: 'enter-click', + handler: () => { + this.deleteAll() + }, + }, + ], + }) + await alert.present() + } + + async viewBackupReport (notification: ServerNotification<1>) { + const modal = await this.modalCtrl.create({ + component: BackupReportPage, + componentProps: { + report: notification.data, + timestamp: notification['created-at'], + }, + }) + await modal.present() + } + + private async deleteAll (): Promise { const loader = await this.loadingCtrl.create({ spinner: 'lines', message: 'Deleting...', @@ -89,16 +123,5 @@ export class NotificationsPage { loader.dismiss() } } - - async viewBackupReport (notification: ServerNotification<1>) { - const modal = await this.modalCtrl.create({ - component: BackupReportPage, - componentProps: { - report: notification.data, - timestamp: notification['created-at'], - }, - }) - await modal.present() - } } diff --git a/ui/src/app/services/api/api.fixures.ts b/ui/src/app/services/api/api.fixures.ts index b66dd583b..09efc414c 100644 --- a/ui/src/app/services/api/api.fixures.ts +++ b/ui/src/app/services/api/api.fixures.ts @@ -752,7 +752,7 @@ export module Mock { }, { id: 2, - 'package-id': 'bitcoind', + 'package-id': null, 'created-at': '2019-12-26T14:20:30.872Z', code: 2, level: NotificationLevel.Warning, @@ -762,7 +762,7 @@ export module Mock { }, { id: 3, - 'package-id': 'bitcoind', + 'package-id': null, 'created-at': '2019-12-26T14:20:30.872Z', code: 3, level: NotificationLevel.Info,