mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 02:11:53 +00:00
add Tor logs to UI
This commit is contained in:
@@ -54,7 +54,6 @@ const ICONS = [
|
||||
'mail-outline',
|
||||
'map-outline',
|
||||
'medkit-outline',
|
||||
'newspaper-outline',
|
||||
'notifications-outline',
|
||||
'open-outline',
|
||||
'options-outline',
|
||||
|
||||
@@ -34,6 +34,11 @@ const routes: Routes = [
|
||||
m => m.KernelLogsPageModule,
|
||||
),
|
||||
},
|
||||
{
|
||||
path: 'tor-logs',
|
||||
loadChildren: () =>
|
||||
import('./tor-logs/tor-logs.module').then(m => m.TorLogsPageModule),
|
||||
},
|
||||
{
|
||||
path: 'metrics',
|
||||
loadChildren: () =>
|
||||
|
||||
@@ -470,7 +470,7 @@ export class ServerShowPage {
|
||||
{
|
||||
title: 'OS Logs',
|
||||
description: 'Raw, unfiltered operating system logs',
|
||||
icon: 'newspaper-outline',
|
||||
icon: 'receipt-outline',
|
||||
action: () =>
|
||||
this.navCtrl.navigateForward(['logs'], { relativeTo: this.route }),
|
||||
detail: true,
|
||||
@@ -488,6 +488,17 @@ export class ServerShowPage {
|
||||
detail: true,
|
||||
disabled$: of(false),
|
||||
},
|
||||
{
|
||||
title: 'Tor Logs',
|
||||
description: 'Diagnostic log stream for the Tor daemon on StartOS',
|
||||
icon: 'receipt-outline',
|
||||
action: () =>
|
||||
this.navCtrl.navigateForward(['tor-logs'], {
|
||||
relativeTo: this.route,
|
||||
}),
|
||||
detail: true,
|
||||
disabled$: of(false),
|
||||
},
|
||||
],
|
||||
Support: [
|
||||
{
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
import { NgModule } from '@angular/core'
|
||||
import { CommonModule } from '@angular/common'
|
||||
import { Routes, RouterModule } from '@angular/router'
|
||||
import { IonicModule } from '@ionic/angular'
|
||||
import { TorLogsPage } from './tor-logs.page'
|
||||
import { LogsComponentModule } from 'src/app/components/logs/logs.component.module'
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
path: '',
|
||||
component: TorLogsPage,
|
||||
},
|
||||
]
|
||||
|
||||
@NgModule({
|
||||
imports: [
|
||||
CommonModule,
|
||||
IonicModule,
|
||||
RouterModule.forChild(routes),
|
||||
LogsComponentModule,
|
||||
],
|
||||
declarations: [TorLogsPage],
|
||||
})
|
||||
export class TorLogsPageModule {}
|
||||
@@ -0,0 +1,8 @@
|
||||
<logs
|
||||
[fetchLogs]="fetchLogs()"
|
||||
[followLogs]="followLogs()"
|
||||
context="tor"
|
||||
defaultBack="system"
|
||||
pageTitle="Tor Logs"
|
||||
class="ion-page"
|
||||
></logs>
|
||||
@@ -0,0 +1,24 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { RR } from 'src/app/services/api/api.types'
|
||||
import { ApiService } from 'src/app/services/api/embassy-api.service'
|
||||
|
||||
@Component({
|
||||
selector: 'tor-logs',
|
||||
templateUrl: './tor-logs.page.html',
|
||||
styleUrls: ['./tor-logs.page.scss'],
|
||||
})
|
||||
export class TorLogsPage {
|
||||
constructor(private readonly api: ApiService) {}
|
||||
|
||||
followLogs() {
|
||||
return async (params: RR.FollowServerLogsReq) => {
|
||||
return this.api.followTorLogs(params)
|
||||
}
|
||||
}
|
||||
|
||||
fetchLogs() {
|
||||
return async (params: RR.GetServerLogsReq) => {
|
||||
return this.api.getTorLogs(params)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,6 +73,8 @@ export abstract class ApiService {
|
||||
params: RR.GetServerLogsReq,
|
||||
): Promise<RR.GetServerLogsRes>
|
||||
|
||||
abstract getTorLogs(params: RR.GetServerLogsReq): Promise<RR.GetServerLogsRes>
|
||||
|
||||
abstract followServerLogs(
|
||||
params: RR.FollowServerLogsReq,
|
||||
): Promise<RR.FollowServerLogsRes>
|
||||
@@ -81,6 +83,10 @@ export abstract class ApiService {
|
||||
params: RR.FollowServerLogsReq,
|
||||
): Promise<RR.FollowServerLogsRes>
|
||||
|
||||
abstract followTorLogs(
|
||||
params: RR.FollowServerLogsReq,
|
||||
): Promise<RR.FollowServerLogsRes>
|
||||
|
||||
abstract getServerMetrics(
|
||||
params: RR.GetServerMetricsReq,
|
||||
): Promise<RR.GetServerMetricsRes>
|
||||
|
||||
@@ -135,6 +135,10 @@ export class LiveApiService extends ApiService {
|
||||
return this.rpcRequest({ method: 'server.kernel-logs', params })
|
||||
}
|
||||
|
||||
async getTorLogs(params: RR.GetServerLogsReq): Promise<RR.GetServerLogsRes> {
|
||||
return this.rpcRequest({ method: 'server.tor-logs', params })
|
||||
}
|
||||
|
||||
async followServerLogs(
|
||||
params: RR.FollowServerLogsReq,
|
||||
): Promise<RR.FollowServerLogsRes> {
|
||||
@@ -147,6 +151,12 @@ export class LiveApiService extends ApiService {
|
||||
return this.rpcRequest({ method: 'server.kernel-logs.follow', params })
|
||||
}
|
||||
|
||||
async followTorLogs(
|
||||
params: RR.FollowServerLogsReq,
|
||||
): Promise<RR.FollowServerLogsRes> {
|
||||
return this.rpcRequest({ method: 'server.tor-logs.follow', params })
|
||||
}
|
||||
|
||||
async getServerMetrics(
|
||||
params: RR.GetServerMetricsReq,
|
||||
): Promise<RR.GetServerMetricsRes> {
|
||||
|
||||
@@ -211,6 +211,17 @@ export class MockApiService extends ApiService {
|
||||
}
|
||||
}
|
||||
|
||||
async getTorLogs(params: RR.GetServerLogsReq): Promise<RR.GetServerLogsRes> {
|
||||
await pauseFor(2000)
|
||||
const entries = this.randomLogs(params.limit)
|
||||
|
||||
return {
|
||||
entries,
|
||||
'start-cursor': 'startCursor',
|
||||
'end-cursor': 'endCursor',
|
||||
}
|
||||
}
|
||||
|
||||
async followServerLogs(
|
||||
params: RR.FollowServerLogsReq,
|
||||
): Promise<RR.FollowServerLogsRes> {
|
||||
@@ -231,6 +242,16 @@ export class MockApiService extends ApiService {
|
||||
}
|
||||
}
|
||||
|
||||
async followTorLogs(
|
||||
params: RR.FollowServerLogsReq,
|
||||
): Promise<RR.FollowServerLogsRes> {
|
||||
await pauseFor(2000)
|
||||
return {
|
||||
'start-cursor': 'start-cursor',
|
||||
guid: '7251d5be-645f-4362-a51b-3a85be92b31e',
|
||||
}
|
||||
}
|
||||
|
||||
randomLogs(limit = 1): Log[] {
|
||||
const arrLength = Math.ceil(limit / Mock.ServerLogs.length)
|
||||
const logs = new Array(arrLength)
|
||||
|
||||
Reference in New Issue
Block a user