mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-04 22:39:46 +00:00
* closes #2340 and #2431, fixes bug with select all for backup * revefrt mock
This commit is contained in:
4
web/package-lock.json
generated
4
web/package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "startos-ui",
|
"name": "startos-ui",
|
||||||
"version": "0.3.6-alpha.6",
|
"version": "0.3.6-alpha.8",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "startos-ui",
|
"name": "startos-ui",
|
||||||
"version": "0.3.6-alpha.6",
|
"version": "0.3.6-alpha.8",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "^14.1.0",
|
"@angular/animations": "^14.1.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Component } from '@angular/core'
|
import { Component } from '@angular/core'
|
||||||
import { ModalController } from '@ionic/angular'
|
import { ModalController } from '@ionic/angular'
|
||||||
import { map, take } from 'rxjs/operators'
|
import { map } from 'rxjs/operators'
|
||||||
import { DataModel } from 'src/app/services/patch-db/data-model'
|
import { DataModel } from 'src/app/services/patch-db/data-model'
|
||||||
import { PatchDB } from 'patch-db-client'
|
import { PatchDB } from 'patch-db-client'
|
||||||
import { firstValueFrom } from 'rxjs'
|
import { firstValueFrom } from 'rxjs'
|
||||||
@@ -13,7 +13,7 @@ import { getManifest } from 'src/app/util/get-package-data'
|
|||||||
})
|
})
|
||||||
export class BackupSelectPage {
|
export class BackupSelectPage {
|
||||||
hasSelection = false
|
hasSelection = false
|
||||||
selectAll = false
|
selectAll = true
|
||||||
pkgs: {
|
pkgs: {
|
||||||
id: string
|
id: string
|
||||||
title: string
|
title: string
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
<ion-content>
|
<ion-content>
|
||||||
<div style="padding: 48px">
|
<div style="padding: 48px">
|
||||||
<ng-container *ngIf="!restarted; else refresh">
|
<ng-container *ngIf="!restarted; else refresh">
|
||||||
<h1
|
<div class="ion-text-center" style="padding-bottom: 36px">
|
||||||
class="ion-text-center"
|
<h1 style="font-size: calc(2vw + 14px)">StartOS - Diagnostic Mode</h1>
|
||||||
style="padding-bottom: 36px; font-size: calc(2vw + 14px)"
|
<p>StartOS version: {{ config.version }}</p>
|
||||||
>
|
</div>
|
||||||
StartOS - Diagnostic Mode
|
|
||||||
</h1>
|
|
||||||
|
|
||||||
<ng-container *ngIf="error">
|
<ng-container *ngIf="error">
|
||||||
<h2
|
<h2
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import { Component } from '@angular/core'
|
|||||||
import { AlertController } from '@ionic/angular'
|
import { AlertController } from '@ionic/angular'
|
||||||
import { LoadingService } from '@start9labs/shared'
|
import { LoadingService } from '@start9labs/shared'
|
||||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||||
|
import { ConfigService } from 'src/app/services/config.service'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'diagnostic-home',
|
selector: 'diagnostic-home',
|
||||||
@@ -22,6 +23,7 @@ export class HomePage {
|
|||||||
private readonly loader: LoadingService,
|
private readonly loader: LoadingService,
|
||||||
private readonly api: ApiService,
|
private readonly api: ApiService,
|
||||||
private readonly alertCtrl: AlertController,
|
private readonly alertCtrl: AlertController,
|
||||||
|
readonly config: ConfigService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
|||||||
@@ -4,6 +4,16 @@
|
|||||||
<ion-back-button defaultHref="/"></ion-back-button>
|
<ion-back-button defaultHref="/"></ion-back-button>
|
||||||
</ion-buttons>
|
</ion-buttons>
|
||||||
<ion-title>Logs</ion-title>
|
<ion-title>Logs</ion-title>
|
||||||
|
<ion-button
|
||||||
|
slot="end"
|
||||||
|
class="ion-padding-end"
|
||||||
|
fill="clear"
|
||||||
|
strong
|
||||||
|
(click)="download()"
|
||||||
|
>
|
||||||
|
Download
|
||||||
|
<ion-icon slot="end" name="download-outline"></ion-icon>
|
||||||
|
</ion-button>
|
||||||
</ion-toolbar>
|
</ion-toolbar>
|
||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
import { Component, ViewChild } from '@angular/core'
|
import { Component, ViewChild } from '@angular/core'
|
||||||
import { IonContent } from '@ionic/angular'
|
import { IonContent } from '@ionic/angular'
|
||||||
import { ErrorService, toLocalIsoString } from '@start9labs/shared'
|
import {
|
||||||
|
DownloadHTMLService,
|
||||||
|
ErrorService,
|
||||||
|
LoadingService,
|
||||||
|
Log,
|
||||||
|
toLocalIsoString,
|
||||||
|
} from '@start9labs/shared'
|
||||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||||
|
|
||||||
var Convert = require('ansi-to-html')
|
var Convert = require('ansi-to-html')
|
||||||
@@ -24,6 +30,8 @@ export class LogsPage {
|
|||||||
constructor(
|
constructor(
|
||||||
private readonly api: ApiService,
|
private readonly api: ApiService,
|
||||||
private readonly errorService: ErrorService,
|
private readonly errorService: ErrorService,
|
||||||
|
private readonly loader: LoadingService,
|
||||||
|
private readonly downloadHtml: DownloadHTMLService,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@@ -47,6 +55,30 @@ export class LogsPage {
|
|||||||
e.target.complete()
|
e.target.complete()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async download() {
|
||||||
|
const loader = this.loader.open('Processing 10,000 logs...').subscribe()
|
||||||
|
|
||||||
|
try {
|
||||||
|
const { entries } = await this.api.diagnosticGetLogs({
|
||||||
|
before: true,
|
||||||
|
limit: 10000,
|
||||||
|
})
|
||||||
|
|
||||||
|
const styles = {
|
||||||
|
'background-color': '#222428',
|
||||||
|
color: '#e0e0e0',
|
||||||
|
'font-family': 'monospace',
|
||||||
|
}
|
||||||
|
const html = this.convertToAnsi(entries)
|
||||||
|
|
||||||
|
this.downloadHtml.download('diagnostic-logs.html', html, styles)
|
||||||
|
} catch (e: any) {
|
||||||
|
this.errorService.handleError(e)
|
||||||
|
} finally {
|
||||||
|
loader.unsubscribe()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async getLogs() {
|
private async getLogs() {
|
||||||
try {
|
try {
|
||||||
const { startCursor, entries } = await this.api.diagnosticGetLogs({
|
const { startCursor, entries } = await this.api.diagnosticGetLogs({
|
||||||
@@ -92,4 +124,15 @@ export class LogsPage {
|
|||||||
this.errorService.handleError(e)
|
this.errorService.handleError(e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private convertToAnsi(entries: Log[]) {
|
||||||
|
return entries
|
||||||
|
.map(
|
||||||
|
entry =>
|
||||||
|
`<span style="color: #FFF; font-weight: bold;">${toLocalIsoString(
|
||||||
|
new Date(entry.timestamp),
|
||||||
|
)}</span> ${convert.toHtml(entry.message)}`,
|
||||||
|
)
|
||||||
|
.join('<br />')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user