feat(portal): add notifications sidebar (#2516)

* feat(portal): add notifications sidebar

* chore: add service

* chore: simplify style

* chore: fix comments

* WIP, moving notifications to patch-db

* revamp notifications

* chore: small adjustments

---------

Co-authored-by: Matt Hill <mattnine@protonmail.com>
This commit is contained in:
Alex Inkin
2023-12-08 20:12:03 +04:00
committed by GitHub
parent 8bc93d23b2
commit 7324a4973f
52 changed files with 1181 additions and 255 deletions

View File

@@ -4,6 +4,8 @@ import {
StartOSDiskInfo,
Log,
SetupStatus,
FollowLogsRes,
FollowLogsReq,
} from '@start9labs/shared'
import { Observable } from 'rxjs'
import { WebSocketSubjectConfig } from 'rxjs/webSocket'
@@ -19,7 +21,7 @@ export abstract class ApiService {
abstract execute(setupInfo: ExecuteReq): Promise<void> // setup.execute
abstract complete(): Promise<CompleteRes> // setup.complete
abstract exit(): Promise<void> // setup.exit
abstract followLogs(): Promise<string> // setup.logs.follow
abstract followServerLogs(params: FollowLogsReq): Promise<FollowLogsRes> // setup.logs.follow
abstract openLogsWebsocket$(
config: WebSocketSubjectConfig<Log>,
): Observable<Log>

View File

@@ -9,6 +9,8 @@ import {
RpcError,
RPCOptions,
SetupStatus,
FollowLogsRes,
FollowLogsReq,
} from '@start9labs/shared'
import {
ApiService,
@@ -90,8 +92,8 @@ export class LiveApiService extends ApiService {
})
}
async followLogs(): Promise<string> {
return this.rpcRequest({ method: 'setup.logs.follow', params: {} })
async followServerLogs(params: FollowLogsReq): Promise<FollowLogsRes> {
return this.rpcRequest({ method: 'setup.logs.follow', params })
}
openLogsWebsocket$({ url }: WebSocketSubjectConfig<Log>): Observable<Log> {

View File

@@ -1,6 +1,8 @@
import { Injectable } from '@angular/core'
import {
encodeBase64,
FollowLogsReq,
FollowLogsRes,
getSetupStatusMock,
Log,
pauseFor,
@@ -134,9 +136,12 @@ export class MockApiService extends ApiService {
await pauseFor(1000)
}
async followLogs(): Promise<string> {
async followServerLogs(params: FollowLogsReq): Promise<FollowLogsRes> {
await pauseFor(1000)
return 'fake-guid'
return {
'start-cursor': 'fakestartcursor',
guid: 'fake-guid',
}
}
openLogsWebsocket$(config: WebSocketSubjectConfig<Log>): Observable<Log> {