mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
use notification system for OS updates (#2670)
* use notification system for OS updates * feat: Include the version update notification in the update in rs * chore: Change the location of the comment * progress on release notes * fill out missing sections * fix build * fix build --------- Co-authored-by: J H <dragondef@gmail.com> Co-authored-by: Aiden McClelland <me@drbonez.dev>
This commit is contained in:
@@ -9,6 +9,8 @@ import { configBuilderToSpec } from 'src/app/util/configBuilderToSpec'
|
||||
import { T, ISB, IST } from '@start9labs/start-sdk'
|
||||
import { GetPackagesRes } from '@start9labs/marketplace'
|
||||
|
||||
import markdown from 'raw-loader!../../../../../shared/assets/markdown/md-sample.md'
|
||||
|
||||
const mockMerkleArchiveCommitment: T.MerkleArchiveCommitment = {
|
||||
rootSighash: 'fakehash',
|
||||
rootMaxsize: 0,
|
||||
@@ -759,7 +761,7 @@ export module Mock {
|
||||
id: 2,
|
||||
packageId: null,
|
||||
createdAt: '2019-12-26T14:20:30.872Z',
|
||||
code: 2,
|
||||
code: 0,
|
||||
level: NotificationLevel.Warning,
|
||||
title: 'SSH Key Added',
|
||||
message: 'A new SSH key was added. If you did not do this, shit is bad.',
|
||||
@@ -769,7 +771,7 @@ export module Mock {
|
||||
id: 3,
|
||||
packageId: null,
|
||||
createdAt: '2019-12-26T14:20:30.872Z',
|
||||
code: 3,
|
||||
code: 0,
|
||||
level: NotificationLevel.Info,
|
||||
title: 'SSH Key Removed',
|
||||
message: 'A SSH key was removed.',
|
||||
@@ -779,7 +781,7 @@ export module Mock {
|
||||
id: 4,
|
||||
packageId: 'bitcoind',
|
||||
createdAt: '2019-12-26T14:20:30.872Z',
|
||||
code: 4,
|
||||
code: 0,
|
||||
level: NotificationLevel.Error,
|
||||
title: 'Service Crashed',
|
||||
message: new Array(40)
|
||||
@@ -792,6 +794,16 @@ export module Mock {
|
||||
.join(''),
|
||||
data: null,
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
packageId: null,
|
||||
createdAt: '2019-12-26T14:20:30.872Z',
|
||||
code: 2,
|
||||
level: NotificationLevel.Success,
|
||||
title: 'Welcome to StartOS 0.3.6!',
|
||||
message: 'Click "View Details" to learn all about the new version',
|
||||
data: markdown,
|
||||
},
|
||||
]
|
||||
|
||||
export function getServerMetrics() {
|
||||
|
||||
@@ -442,6 +442,8 @@ export type NotificationData<T> = T extends 0
|
||||
? null
|
||||
: T extends 1
|
||||
? BackupReport
|
||||
: T extends 2
|
||||
? string
|
||||
: any
|
||||
|
||||
export interface BackupReport {
|
||||
|
||||
@@ -6,7 +6,6 @@ const version = require('../../../../../../package.json').version
|
||||
export const mockPatchData: DataModel = {
|
||||
ui: {
|
||||
name: `Matt's Server`,
|
||||
ackWelcome: '1.0.0',
|
||||
theme: 'Dark',
|
||||
widgets: BUILT_IN_WIDGETS.filter(
|
||||
({ id }) =>
|
||||
|
||||
@@ -1,13 +1,9 @@
|
||||
import { Inject, Injectable } from '@angular/core'
|
||||
import { ModalController } from '@ionic/angular'
|
||||
import { Observable } from 'rxjs'
|
||||
import { filter, map, share, switchMap, take, tap } from 'rxjs/operators'
|
||||
import { filter, map, share, switchMap, take } from 'rxjs/operators'
|
||||
import { PatchDB } from 'patch-db-client'
|
||||
import { DataModel } from 'src/app/services/patch-db/data-model'
|
||||
import { EOSService } from 'src/app/services/eos.service'
|
||||
import { OSWelcomePage } from 'src/app/modals/os-welcome/os-welcome.page'
|
||||
import { ConfigService } from 'src/app/services/config.service'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
import { MarketplaceService } from 'src/app/services/marketplace.service'
|
||||
import { AbstractMarketplaceService } from '@start9labs/marketplace'
|
||||
import { ConnectionService } from 'src/app/services/connection.service'
|
||||
@@ -27,8 +23,6 @@ export class PatchDataService extends Observable<void> {
|
||||
if (index === 0) {
|
||||
// check for updates to StartOS and services
|
||||
this.checkForUpdates()
|
||||
// show eos welcome message
|
||||
this.showEosWelcome(cache.ui.ackWelcome)
|
||||
}
|
||||
}),
|
||||
share(),
|
||||
@@ -37,9 +31,6 @@ export class PatchDataService extends Observable<void> {
|
||||
constructor(
|
||||
private readonly patch: PatchDB<DataModel>,
|
||||
private readonly eosService: EOSService,
|
||||
private readonly config: ConfigService,
|
||||
private readonly modalCtrl: ModalController,
|
||||
private readonly embassyApi: ApiService,
|
||||
@Inject(AbstractMarketplaceService)
|
||||
private readonly marketplaceService: MarketplaceService,
|
||||
private readonly connection$: ConnectionService,
|
||||
@@ -52,23 +43,4 @@ export class PatchDataService extends Observable<void> {
|
||||
this.eosService.loadEos()
|
||||
this.marketplaceService.getMarketplace$().pipe(take(1)).subscribe()
|
||||
}
|
||||
|
||||
private async showEosWelcome(ackVersion: string): Promise<void> {
|
||||
if (this.config.skipStartupAlerts || ackVersion === this.config.version) {
|
||||
return
|
||||
}
|
||||
|
||||
const modal = await this.modalCtrl.create({
|
||||
component: OSWelcomePage,
|
||||
presentingElement: await this.modalCtrl.getTop(),
|
||||
backdropDismiss: false,
|
||||
})
|
||||
modal.onWillDismiss().then(() => {
|
||||
this.embassyApi
|
||||
.setDbValue<string>(['ackWelcome'], this.config.version)
|
||||
.catch()
|
||||
})
|
||||
|
||||
await modal.present()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ export type DataModel = T.Public & {
|
||||
|
||||
export interface UIData {
|
||||
name: string | null
|
||||
ackWelcome: string // eOS emver
|
||||
marketplace: UIMarketplaceData
|
||||
gaming: {
|
||||
snake: {
|
||||
|
||||
Reference in New Issue
Block a user