mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +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 { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
import { AppRestoreComponent } from 'src/app/modals/app-restore/app-restore.component'
|
||||
import { isEmptyObject } from 'src/app/util/misc.util'
|
||||
|
||||
@Component({
|
||||
selector: 'app-actions',
|
||||
@@ -48,7 +49,7 @@ export class AppActionsPage {
|
||||
|
||||
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['input-spec']) {
|
||||
if (!isEmptyObject(action.value['input-spec'])) {
|
||||
const modal = await this.modalCtrl.create({
|
||||
component: GenericFormPage,
|
||||
componentProps: {
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
</ion-header>
|
||||
|
||||
<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
|
||||
loadingSpinner="bubbles">
|
||||
</ion-infinite-scroll-content>
|
||||
</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>
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import { ErrorToastService } from 'src/app/services/error-toast.service'
|
||||
export class AppLogsPage {
|
||||
@ViewChild(IonContent, { static: false }) private content: IonContent
|
||||
pkgId: string
|
||||
firstTimeLoaded = false
|
||||
loading = true
|
||||
needInfinite = true
|
||||
before: string
|
||||
|
||||
@@ -22,11 +22,21 @@ export class AppLogsPage {
|
||||
private readonly embassyApi: ApiService,
|
||||
) { }
|
||||
|
||||
ngOnInit () {
|
||||
async ngOnInit () {
|
||||
this.pkgId = this.route.snapshot.paramMap.get('pkgId')
|
||||
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 () {
|
||||
const limit = 200
|
||||
try {
|
||||
@@ -37,8 +47,6 @@ export class AppLogsPage {
|
||||
limit,
|
||||
})
|
||||
|
||||
this.firstTimeLoaded = true
|
||||
|
||||
this.before = logs[0].timestamp
|
||||
|
||||
const container = document.getElementById('container')
|
||||
@@ -57,6 +65,8 @@ export class AppLogsPage {
|
||||
}
|
||||
} catch (e) {
|
||||
this.errToast.present(e)
|
||||
} finally {
|
||||
this.loading = false
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user