mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
begin logs improvement and combination
This commit is contained in:
@@ -10,6 +10,7 @@ import { Subscription } from 'rxjs'
|
|||||||
import { GenericFormPage } from 'src/app/modals/generic-form/generic-form.page'
|
import { GenericFormPage } from 'src/app/modals/generic-form/generic-form.page'
|
||||||
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||||
import { AppRestoreComponent } from 'src/app/modals/app-restore/app-restore.component'
|
import { AppRestoreComponent } from 'src/app/modals/app-restore/app-restore.component'
|
||||||
|
import { isEmptyObject } from 'src/app/util/misc.util'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-actions',
|
selector: 'app-actions',
|
||||||
@@ -48,7 +49,7 @@ export class AppActionsPage {
|
|||||||
|
|
||||||
async handleAction (pkg: PackageDataEntry, action: { key: string, value: Action }) {
|
async handleAction (pkg: PackageDataEntry, action: { key: string, value: Action }) {
|
||||||
if ((action.value['allowed-statuses'] as PackageMainStatus[]).includes(pkg.installed.status.main.status)) {
|
if ((action.value['allowed-statuses'] as PackageMainStatus[]).includes(pkg.installed.status.main.status)) {
|
||||||
if (action.value['input-spec']) {
|
if (!isEmptyObject(action.value['input-spec'])) {
|
||||||
const modal = await this.modalCtrl.create({
|
const modal = await this.modalCtrl.create({
|
||||||
component: GenericFormPage,
|
component: GenericFormPage,
|
||||||
componentProps: {
|
componentProps: {
|
||||||
|
|||||||
@@ -14,13 +14,13 @@
|
|||||||
</ion-header>
|
</ion-header>
|
||||||
|
|
||||||
<ion-content id="ion-content" class="ion-padding">
|
<ion-content id="ion-content" class="ion-padding">
|
||||||
<ion-infinite-scroll id="scroller" *ngIf="firstTimeLoaded && needInfinite" position="top" threshold="0" (ionInfinite)="loadData($event)">
|
<ion-infinite-scroll id="scroller" *ngIf="!loading && needInfinite" position="top" threshold="0" (ionInfinite)="loadData($event)">
|
||||||
<ion-infinite-scroll-content
|
<ion-infinite-scroll-content
|
||||||
loadingSpinner="bubbles">
|
loadingSpinner="bubbles">
|
||||||
</ion-infinite-scroll-content>
|
</ion-infinite-scroll-content>
|
||||||
</ion-infinite-scroll>
|
</ion-infinite-scroll>
|
||||||
|
|
||||||
<text-spinner *ngIf="!firstTimeLoaded" text="Loading Logs"></text-spinner>
|
<text-spinner *ngIf="loading" text="Loading Logs"></text-spinner>
|
||||||
|
|
||||||
<div id="container"><div id="template" style="white-space: pre-line;"></div></div>
|
<div id="container"><div id="template" style="white-space: pre-line;"></div></div>
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import { ErrorToastService } from 'src/app/services/error-toast.service'
|
|||||||
export class AppLogsPage {
|
export class AppLogsPage {
|
||||||
@ViewChild(IonContent, { static: false }) private content: IonContent
|
@ViewChild(IonContent, { static: false }) private content: IonContent
|
||||||
pkgId: string
|
pkgId: string
|
||||||
firstTimeLoaded = false
|
loading = true
|
||||||
needInfinite = true
|
needInfinite = true
|
||||||
before: string
|
before: string
|
||||||
|
|
||||||
@@ -22,11 +22,21 @@ export class AppLogsPage {
|
|||||||
private readonly embassyApi: ApiService,
|
private readonly embassyApi: ApiService,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit () {
|
async ngOnInit () {
|
||||||
this.pkgId = this.route.snapshot.paramMap.get('pkgId')
|
this.pkgId = this.route.snapshot.paramMap.get('pkgId')
|
||||||
this.getLogs()
|
this.getLogs()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async refresh () {
|
||||||
|
this.before = undefined
|
||||||
|
this.loading = true
|
||||||
|
const container = document.getElementById('container')
|
||||||
|
const newLogs = document.getElementById('template').cloneNode(true) as HTMLElement
|
||||||
|
while (container.firstChild) { container.removeChild(container.firstChild) }
|
||||||
|
container.append(newLogs)
|
||||||
|
this.getLogs()
|
||||||
|
}
|
||||||
|
|
||||||
async getLogs () {
|
async getLogs () {
|
||||||
const limit = 200
|
const limit = 200
|
||||||
try {
|
try {
|
||||||
@@ -37,8 +47,6 @@ export class AppLogsPage {
|
|||||||
limit,
|
limit,
|
||||||
})
|
})
|
||||||
|
|
||||||
this.firstTimeLoaded = true
|
|
||||||
|
|
||||||
this.before = logs[0].timestamp
|
this.before = logs[0].timestamp
|
||||||
|
|
||||||
const container = document.getElementById('container')
|
const container = document.getElementById('container')
|
||||||
@@ -57,6 +65,8 @@ export class AppLogsPage {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
this.errToast.present(e)
|
this.errToast.present(e)
|
||||||
|
} finally {
|
||||||
|
this.loading = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,9 +38,9 @@
|
|||||||
<ion-skeleton-text animated style="width: 150px; margin-bottom: 18px;"></ion-skeleton-text>
|
<ion-skeleton-text animated style="width: 150px; margin-bottom: 18px;"></ion-skeleton-text>
|
||||||
<ion-skeleton-text animated style="width: 300px;"></ion-skeleton-text>
|
<ion-skeleton-text animated style="width: 300px;"></ion-skeleton-text>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
<ion-avatar slot="end">
|
<ion-button slot="end" fill="clear">
|
||||||
<ion-skeleton-text animated style="width: 80px; border-radius: 0"></ion-skeleton-text>
|
<ion-skeleton-text animated style="width: 60px; border-radius: 0"></ion-skeleton-text>
|
||||||
</ion-avatar>
|
</ion-button>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
</ng-container>
|
</ng-container>
|
||||||
|
|
||||||
|
|||||||
@@ -24,18 +24,18 @@
|
|||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-label class="break-all">
|
<ion-label class="break-all">
|
||||||
<h2>Tor Address</h2>
|
<h2>Tor Address</h2>
|
||||||
<p>http://{{ server['tor-address'] }}</p>
|
<p>{{ server['tor-address'] }}</p>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
<ion-button slot="end" fill="clear" (click)="copy('http://' + server['tor-address'])">
|
<ion-button slot="end" fill="clear" (click)="copy(server['tor-address'])">
|
||||||
<ion-icon slot="icon-only" name="copy-outline"></ion-icon>
|
<ion-icon slot="icon-only" name="copy-outline"></ion-icon>
|
||||||
</ion-button>
|
</ion-button>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
<ion-item>
|
<ion-item>
|
||||||
<ion-label class="break-all">
|
<ion-label class="break-all">
|
||||||
<h2>LAN Address</h2>
|
<h2>LAN Address</h2>
|
||||||
<p>https://{{ server['lan-address'] }}</p>
|
<p>{{ server['lan-address'] }}</p>
|
||||||
</ion-label>
|
</ion-label>
|
||||||
<ion-button slot="end" fill="clear" (click)="copy('https://' + server['lan-address'])">
|
<ion-button slot="end" fill="clear" (click)="copy(server['lan-address'])">
|
||||||
<ion-icon slot="icon-only" name="copy-outline"></ion-icon>
|
<ion-icon slot="icon-only" name="copy-outline"></ion-icon>
|
||||||
</ion-button>
|
</ion-button>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|||||||
@@ -1517,7 +1517,7 @@ export module Mock {
|
|||||||
// expireId: null,
|
// expireId: null,
|
||||||
// value: {
|
// value: {
|
||||||
// 'server-info': {
|
// 'server-info': {
|
||||||
// id: 'start9-abcdefgmm',
|
// id: 'start9-abcdefgm',
|
||||||
// version: '1.0.0',
|
// version: '1.0.0',
|
||||||
// status: ServerStatus.Running,
|
// status: ServerStatus.Running,
|
||||||
// 'lan-address': 'start9-abcdefgh.local',
|
// 'lan-address': 'start9-abcdefgh.local',
|
||||||
|
|||||||
Reference in New Issue
Block a user