address comments

This commit is contained in:
Matt Hill
2024-08-10 05:57:33 -06:00
parent 657aac0d68
commit 846189b15b
5 changed files with 10 additions and 88 deletions

View File

@@ -12,7 +12,7 @@ import {
import { TuiCardLarge, TuiCell } from '@taiga-ui/layout' import { TuiCardLarge, TuiCell } from '@taiga-ui/layout'
import { CIFS, CifsResponse } from 'src/app/components/cifs.component' import { CIFS, CifsResponse } from 'src/app/components/cifs.component'
import { ServerComponent } from 'src/app/components/server.component' import { ServerComponent } from 'src/app/components/server.component'
import { ApiService, StartOSDiskInfoWithId } from 'src/app/services/api.service' import { ApiService, StartOSDiskInfoFull } from 'src/app/services/api.service'
import { StateService } from 'src/app/services/state.service' import { StateService } from 'src/app/services/state.service'
@Component({ @Component({
@@ -47,7 +47,7 @@ import { StateService } from 'src/app/services/state.service'
@for (server of servers; track $index) { @for (server of servers; track $index) {
<button <button
[server]="server" [server]="server"
(password)="select($event, server.id)" (password)="select($event, server)"
></button> ></button>
} }
@@ -76,7 +76,7 @@ export default class RecoverPage {
private readonly stateService = inject(StateService) private readonly stateService = inject(StateService)
loading = true loading = true
servers: StartOSDiskInfoWithId[] = [] servers: StartOSDiskInfoFull[] = []
async ngOnInit() { async ngOnInit() {
this.stateService.setupType = 'restore' this.stateService.setupType = 'restore'
@@ -111,15 +111,14 @@ export default class RecoverPage {
} }
} }
select(password: string, serverId: string) { select(password: string, server: StartOSDiskInfoFull) {
this.stateService.recoverySource = { this.stateService.recoverySource = {
type: 'backup', type: 'backup',
target: { target: {
type: 'disk', type: 'disk',
// @TODO Matt where to get logicalname? logicalname: server.partition.logicalname,
logicalname: '',
}, },
serverId, serverId: server.id,
password, password,
} }
this.router.navigate(['storage']) this.router.navigate(['storage'])

View File

@@ -1,11 +1,5 @@
import { NgModule } from '@angular/core' import { NgModule } from '@angular/core'
import { RouterModule, Routes } from '@angular/router' import { RouterModule, Routes } from '@angular/router'
import { WorkspaceConfig } from '@start9labs/shared'
import { DiagnosticService } from './services/diagnostic.service'
import { MockDiagnosticService } from './services/mock-diagnostic.service'
import { LiveDiagnosticService } from './services/live-diagnostic.service'
const { useMocks } = require('../../../../../../config.json') as WorkspaceConfig
const ROUTES: Routes = [ const ROUTES: Routes = [
{ {
@@ -22,11 +16,5 @@ const ROUTES: Routes = [
@NgModule({ @NgModule({
imports: [RouterModule.forChild(ROUTES)], imports: [RouterModule.forChild(ROUTES)],
providers: [
{
provide: DiagnosticService,
useClass: useMocks ? MockDiagnosticService : LiveDiagnosticService,
},
],
}) })
export class DiagnosticModule {} export class DiagnosticModule {}

View File

@@ -1,17 +1,10 @@
<<<<<<<< HEAD:web/projects/ui/src/app/routes/diagnostic/home/home.page.ts
import { TUI_CONFIRM } from '@taiga-ui/kit' import { TUI_CONFIRM } from '@taiga-ui/kit'
import { Component, Inject } from '@angular/core' import { Component, Inject } from '@angular/core'
import { WINDOW } from '@ng-web-apis/common' import { WINDOW } from '@ng-web-apis/common'
import { LoadingService } from '@start9labs/shared' import { LoadingService } from '@start9labs/shared'
import { TuiDialogService } from '@taiga-ui/core' import { TuiDialogService } from '@taiga-ui/core'
import { filter } from 'rxjs' import { filter } from 'rxjs'
import { DiagnosticService } from '../services/diagnostic.service'
========
import { Component } from '@angular/core'
import { AlertController } from '@ionic/angular'
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'
>>>>>>>> 94a5075b6daa1375433420abf5d121171dae72cb:web/projects/ui/src/app/pages/diagnostic-routes/home/home.page.ts
@Component({ @Component({
selector: 'diagnostic-home', selector: 'diagnostic-home',
@@ -29,14 +22,9 @@ export class HomePage {
constructor( constructor(
private readonly loader: LoadingService, private readonly loader: LoadingService,
<<<<<<<< HEAD:web/projects/ui/src/app/routes/diagnostic/home/home.page.ts private readonly api: ApiService,
private readonly api: DiagnosticService,
private readonly dialogs: TuiDialogService, private readonly dialogs: TuiDialogService,
@Inject(WINDOW) private readonly window: Window, @Inject(WINDOW) private readonly window: Window,
========
private readonly api: ApiService,
private readonly alertCtrl: AlertController,
>>>>>>>> 94a5075b6daa1375433420abf5d121171dae72cb:web/projects/ui/src/app/pages/diagnostic-routes/home/home.page.ts
) {} ) {}
async ngOnInit() { async ngOnInit() {
@@ -102,11 +90,7 @@ export class HomePage {
} }
async restart(): Promise<void> { async restart(): Promise<void> {
<<<<<<<< HEAD:web/projects/ui/src/app/routes/diagnostic/home/home.page.ts
const loader = this.loader.open('').subscribe()
========
const loader = this.loader.open('Loading...').subscribe() const loader = this.loader.open('Loading...').subscribe()
>>>>>>>> 94a5075b6daa1375433420abf5d121171dae72cb:web/projects/ui/src/app/pages/diagnostic-routes/home/home.page.ts
try { try {
await this.api.diagnosticRestart() await this.api.diagnosticRestart()
@@ -119,11 +103,7 @@ export class HomePage {
} }
async forgetDrive(): Promise<void> { async forgetDrive(): Promise<void> {
<<<<<<<< HEAD:web/projects/ui/src/app/routes/diagnostic/home/home.page.ts
const loader = this.loader.open('').subscribe()
========
const loader = this.loader.open('Loading...').subscribe() const loader = this.loader.open('Loading...').subscribe()
>>>>>>>> 94a5075b6daa1375433420abf5d121171dae72cb:web/projects/ui/src/app/pages/diagnostic-routes/home/home.page.ts
try { try {
await this.api.diagnosticForgetDrive() await this.api.diagnosticForgetDrive()
@@ -136,31 +116,6 @@ export class HomePage {
} }
} }
<<<<<<<< HEAD:web/projects/ui/src/app/routes/diagnostic/home/home.page.ts
async presentAlertSystemRebuild() {
this.dialogs
.open(TUI_CONFIRM, {
label: 'Warning',
size: 's',
data: {
no: 'Cancel',
yes: 'Rebuild',
content:
'<p>This action will tear down all service containers and rebuild them from scratch. No data will be deleted.</p><p>A system rebuild can be useful if your system gets into a bad state, and it should only be performed if you are experiencing general performance or reliability issues.</p><p>It may take up to an hour to complete. During this time, you will lose all connectivity to your Start9 server.</p>',
},
})
.pipe(filter(Boolean))
.subscribe(() => {
try {
this.systemRebuild()
} catch (e) {
console.error(e)
}
})
}
========
>>>>>>>> 94a5075b6daa1375433420abf5d121171dae72cb:web/projects/ui/src/app/pages/diagnostic-routes/home/home.page.ts
async presentAlertRepairDisk() { async presentAlertRepairDisk() {
this.dialogs this.dialogs
.open(TUI_CONFIRM, { .open(TUI_CONFIRM, {
@@ -187,27 +142,8 @@ export class HomePage {
this.window.location.reload() this.window.location.reload()
} }
<<<<<<<< HEAD:web/projects/ui/src/app/routes/diagnostic/home/home.page.ts
private async systemRebuild(): Promise<void> {
const loader = this.loader.open('').subscribe()
try {
await this.api.systemRebuild()
await this.api.restart()
this.restarted = true
} catch (e) {
console.error(e)
} finally {
loader.unsubscribe()
}
}
private async repairDisk(): Promise<void> {
const loader = this.loader.open('').subscribe()
========
private async repairDisk(): Promise<void> { private async repairDisk(): Promise<void> {
const loader = this.loader.open('Loading...').subscribe() const loader = this.loader.open('Loading...').subscribe()
>>>>>>>> 94a5075b6daa1375433420abf5d121171dae72cb:web/projects/ui/src/app/pages/diagnostic-routes/home/home.page.ts
try { try {
await this.api.diagnosticRepairDisk() await this.api.diagnosticRepairDisk()

View File

@@ -2,7 +2,7 @@ import { Component, ElementRef, inject, OnInit, ViewChild } from '@angular/core'
import { INTERSECTION_ROOT } from '@ng-web-apis/intersection-observer' import { INTERSECTION_ROOT } from '@ng-web-apis/intersection-observer'
import { convertAnsi, ErrorService } from '@start9labs/shared' import { convertAnsi, ErrorService } from '@start9labs/shared'
import { TuiScrollbar } from '@taiga-ui/core' import { TuiScrollbar } from '@taiga-ui/core'
import { DiagnosticService } from 'src/app/routes/diagnostic/services/diagnostic.service' import { ApiService } from 'src/app/services/api/embassy-api.service'
@Component({ @Component({
selector: 'logs', selector: 'logs',
@@ -28,7 +28,7 @@ import { DiagnosticService } from 'src/app/routes/diagnostic/services/diagnostic
export class LogsPage implements OnInit { export class LogsPage implements OnInit {
@ViewChild(TuiScrollbar, { read: ElementRef }) @ViewChild(TuiScrollbar, { read: ElementRef })
private readonly scrollbar?: ElementRef<HTMLElement> private readonly scrollbar?: ElementRef<HTMLElement>
private readonly api = inject(DiagnosticService) private readonly api = inject(ApiService)
private readonly errorService = inject(ErrorService) private readonly errorService = inject(ErrorService)
startCursor?: string startCursor?: string
@@ -59,7 +59,7 @@ export class LogsPage implements OnInit {
this.loading = true this.loading = true
try { try {
const response = await this.api.getLogs({ const response = await this.api.diagnosticGetLogs({
cursor: this.startCursor, cursor: this.startCursor,
before: !!this.startCursor, before: !!this.startCursor,
limit: 200, limit: 200,

View File

@@ -5,7 +5,6 @@ import {
provideSetupLogsService, provideSetupLogsService,
provideSetupService, provideSetupService,
} from '@start9labs/shared' } from '@start9labs/shared'
import { ApiService } from 'src/app/services/api/embassy-api.service' import { ApiService } from 'src/app/services/api/embassy-api.service'
@Component({ @Component({