begin logs improvement and combination

This commit is contained in:
Matt Hill
2021-08-23 16:00:53 -06:00
committed by Matt Hill
parent 72f3fee54a
commit 89229cdd1f
6 changed files with 26 additions and 15 deletions

View File

@@ -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: {

View File

@@ -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>

View File

@@ -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
}
}

View File

@@ -38,9 +38,9 @@
<ion-skeleton-text animated style="width: 150px; margin-bottom: 18px;"></ion-skeleton-text>
<ion-skeleton-text animated style="width: 300px;"></ion-skeleton-text>
</ion-label>
<ion-avatar slot="end">
<ion-skeleton-text animated style="width: 80px; border-radius: 0"></ion-skeleton-text>
</ion-avatar>
<ion-button slot="end" fill="clear">
<ion-skeleton-text animated style="width: 60px; border-radius: 0"></ion-skeleton-text>
</ion-button>
</ion-item>
</ng-container>

View File

@@ -24,18 +24,18 @@
<ion-item>
<ion-label class="break-all">
<h2>Tor Address</h2>
<p>http://{{ server['tor-address'] }}</p>
<p>{{ server['tor-address'] }}</p>
</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-button>
</ion-item>
<ion-item>
<ion-label class="break-all">
<h2>LAN Address</h2>
<p>https://{{ server['lan-address'] }}</p>
<p>{{ server['lan-address'] }}</p>
</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-button>
</ion-item>

View File

@@ -1517,7 +1517,7 @@ export module Mock {
// expireId: null,
// value: {
// 'server-info': {
// id: 'start9-abcdefgmm',
// id: 'start9-abcdefgm',
// version: '1.0.0',
// status: ServerStatus.Running,
// 'lan-address': 'start9-abcdefgh.local',