From 061a350cc6796a26b73e61c17384cd65c9a7c91f Mon Sep 17 00:00:00 2001 From: Matt Hill Date: Fri, 23 Sep 2022 14:51:28 -0600 Subject: [PATCH] Multiple (#1823) * display preference for suto check and better messaging on properties page * improve logs by a lot * clean up * fix searchbar and url in marketplace --- .../pages/list/search/search.component.html | 5 +-- .../app/components/logs/logs.component.html | 2 +- .../src/app/components/logs/logs.component.ts | 39 ++++++++----------- .../app-properties/app-properties.page.html | 4 +- .../app-properties/app-properties.page.ts | 4 +- .../marketplace-list.page.html | 1 - .../preferences/preferences.page.html | 8 ++-- .../preferences/preferences.page.ts | 2 +- .../services/api/embassy-mock-api.service.ts | 2 +- 9 files changed, 31 insertions(+), 36 deletions(-) diff --git a/frontend/projects/marketplace/src/pages/list/search/search.component.html b/frontend/projects/marketplace/src/pages/list/search/search.component.html index e0b261d79..8471d11b0 100644 --- a/frontend/projects/marketplace/src/pages/list/search/search.component.html +++ b/frontend/projects/marketplace/src/pages/list/search/search.component.html @@ -1,9 +1,8 @@ - - + + { this.websocketFail = false - this.processJob() }, }, } + let totalLogs = 0 + this.api .openLogsWebsocket$(config) - .pipe(takeUntil(this.destroy$)) + .pipe( + tap(_ => { + totalLogs++ + if (totalLogs === this.limit) this.needInfinite = true + }), + bufferTime(500), + tap(msgs => { + this.loading = false + this.processRes({ entries: msgs }) + }), + takeUntil(this.destroy$), + ) .subscribe({ - next: msg => { - this.toProcess.push(msg) - }, error: () => { this.websocketFail = true if (this.isOnBottom) this.scrollToBottom() @@ -151,19 +159,6 @@ export class LogsComponent { } } - private processJob() { - timer(100, 500) - .pipe( - map((_, index) => index), - takeUntil(this.destroy$), - ) - .subscribe(index => { - this.processRes({ entries: this.toProcess }) - this.toProcess = [] - if (index === 0) this.loading = false - }) - } - private processRes(res: LogsRes) { const { entries, 'start-cursor': startCursor } = res @@ -176,7 +171,7 @@ export class LogsComponent { newLogs.innerHTML = this.convertToAnsi(entries) - // if respone contains startCursor, it means we are scrolling backwards + // if response contains a startCursor, it means we are scrolling backwards if (startCursor) { this.startCursor = startCursor diff --git a/frontend/projects/ui/src/app/pages/apps-routes/app-properties/app-properties.page.html b/frontend/projects/ui/src/app/pages/apps-routes/app-properties/app-properties.page.html index 34789357d..94862c315 100644 --- a/frontend/projects/ui/src/app/pages/apps-routes/app-properties/app-properties.page.html +++ b/frontend/projects/ui/src/app/pages/apps-routes/app-properties/app-properties.page.html @@ -21,11 +21,11 @@ - +

Service not running. Information on this page could be + >Service is stopped. Information on this page could be inaccurate.

diff --git a/frontend/projects/ui/src/app/pages/apps-routes/app-properties/app-properties.page.ts b/frontend/projects/ui/src/app/pages/apps-routes/app-properties/app-properties.page.ts index 722bca8d5..65f0e54a9 100644 --- a/frontend/projects/ui/src/app/pages/apps-routes/app-properties/app-properties.page.ts +++ b/frontend/projects/ui/src/app/pages/apps-routes/app-properties/app-properties.page.ts @@ -40,9 +40,9 @@ export class AppPropertiesPage { properties: PackageProperties = {} unmasked: { [key: string]: boolean } = {} - notRunning$ = this.patch + stopped$ = this.patch .watch$('package-data', this.pkgId, 'installed', 'status', 'main', 'status') - .pipe(map(status => status !== PackageMainStatus.Running)) + .pipe(map(status => status === PackageMainStatus.Stopped)) @ViewChild(IonBackButtonDelegate, { static: false }) backButton?: IonBackButtonDelegate diff --git a/frontend/projects/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.html b/frontend/projects/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.html index 8ebb1ecd5..dd15dcc53 100644 --- a/frontend/projects/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.html +++ b/frontend/projects/ui/src/app/pages/marketplace-routes/marketplace-list/marketplace-list.page.html @@ -23,7 +23,6 @@

{{ details.name }}

-

{{ details.url }}

diff --git a/frontend/projects/ui/src/app/pages/server-routes/preferences/preferences.page.html b/frontend/projects/ui/src/app/pages/server-routes/preferences/preferences.page.html index 44d1bd1cd..72159f3db 100644 --- a/frontend/projects/ui/src/app/pages/server-routes/preferences/preferences.page.html +++ b/frontend/projects/ui/src/app/pages/server-routes/preferences/preferences.page.html @@ -17,12 +17,14 @@ Marketplace Auto Check for Updates - {{ auto ? 'Enabled' : 'Disabled' }} + + {{ ui['auto-check-updates'] ? 'Enabled' : 'Disabled' }} + diff --git a/frontend/projects/ui/src/app/pages/server-routes/preferences/preferences.page.ts b/frontend/projects/ui/src/app/pages/server-routes/preferences/preferences.page.ts index 56e022f23..b0f76da1d 100644 --- a/frontend/projects/ui/src/app/pages/server-routes/preferences/preferences.page.ts +++ b/frontend/projects/ui/src/app/pages/server-routes/preferences/preferences.page.ts @@ -27,7 +27,7 @@ import { DataModel } from 'src/app/services/patch-db/data-model' export class PreferencesPage { clicks = 0 - readonly autoCheck$ = this.patch.watch$('ui', 'auto-check-updates') + readonly ui$ = this.patch.watch$('ui') readonly server$ = this.patch.watch$('server-info') readonly name$ = this.serverNameService.name$ diff --git a/frontend/projects/ui/src/app/services/api/embassy-mock-api.service.ts b/frontend/projects/ui/src/app/services/api/embassy-mock-api.service.ts index 3c0497b7e..80e778d36 100644 --- a/frontend/projects/ui/src/app/services/api/embassy-mock-api.service.ts +++ b/frontend/projects/ui/src/app/services/api/embassy-mock-api.service.ts @@ -120,7 +120,7 @@ export class MockApiService extends ApiService { } openLogsWebsocket$(config: WebSocketSubjectConfig): Observable { - return interval(100).pipe( + return interval(50).pipe( map((_, index) => { // mock fire open observer if (index === 0) config.openObserver?.next(new Event(''))