mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-26 10:21:52 +00:00
fix manifest page
This commit is contained in:
committed by
Aiden McClelland
parent
5d24d9324c
commit
97b5f17f4a
@@ -5,6 +5,7 @@ import { IonicModule } from '@ionic/angular'
|
||||
import { AppManifestPage } from './app-manifest.page'
|
||||
import { PwaBackComponentModule } from 'src/app/components/pwa-back-button/pwa-back.component.module'
|
||||
import { SharingModule } from 'src/app/modules/sharing.module'
|
||||
import { FormsModule } from '@angular/forms'
|
||||
|
||||
const routes: Routes = [
|
||||
{
|
||||
@@ -17,6 +18,7 @@ const routes: Routes = [
|
||||
imports: [
|
||||
CommonModule,
|
||||
IonicModule,
|
||||
FormsModule,
|
||||
RouterModule.forChild(routes),
|
||||
PwaBackComponentModule,
|
||||
SharingModule,
|
||||
|
||||
@@ -3,43 +3,65 @@
|
||||
<ion-buttons slot="start">
|
||||
<pwa-back-button></pwa-back-button>
|
||||
</ion-buttons>
|
||||
<ion-title>Manifest</ion-title>
|
||||
<ion-title>Package Manifest</ion-title>
|
||||
</ion-toolbar>
|
||||
<ion-toolbar>
|
||||
<ion-segment [(ngModel)]="segmentValue">
|
||||
<ion-segment-button value="formatted">
|
||||
<ion-label>Formatted</ion-label>
|
||||
</ion-segment-button>
|
||||
<ion-segment-button value="raw">
|
||||
<ion-label>Raw</ion-label>
|
||||
</ion-segment-button>
|
||||
</ion-segment>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content *ngIf="pkg">
|
||||
<ion-item *ngIf="error" style="margin-bottom: 16px;">
|
||||
<ion-text class="ion-text-wrap" color="danger">{{ error }}</ion-text>
|
||||
</ion-item>
|
||||
|
||||
<ion-item-group *ngIf="node | typeof === 'object'">
|
||||
<div *ngFor="let prop of node | keyvalue : asIsOrder">
|
||||
<!-- object/array -->
|
||||
<ng-container *ngIf="['object', 'array'] | includes : (prop.value | typeof); else notObj">
|
||||
<ion-item button detail="true" *ngIf="!(prop.value | empty)" (click)="goToNested(prop.key)">
|
||||
<ion-label class="ion-text-wrap">
|
||||
<h2>{{ prop.key }}</h2>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
</ng-container>
|
||||
<!-- not object/array -->
|
||||
<ng-template #notObj>
|
||||
<ion-item *ngIf="prop.value">
|
||||
<ion-label class="ion-text-wrap">
|
||||
<h2>{{ prop.key }}</h2>
|
||||
<p>{{ prop.value }}</p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
</ng-template>
|
||||
</div>
|
||||
</ion-item-group>
|
||||
<!-- Arrays -->
|
||||
<ion-item-group *ngIf="node | typeof === 'array'">
|
||||
<ion-item *ngFor="let prop of node">
|
||||
<ion-label class="ion-text-wrap">
|
||||
{{ prop }}
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
</ion-item-group>
|
||||
<ion-content *ngIf="pkg" class="ion-padding">
|
||||
|
||||
<div *ngIf="segmentValue === 'formatted'" style="background-color: var(--ion-color-light);">
|
||||
<ion-toolbar>
|
||||
<ion-title>Formatted Manifest</ion-title>
|
||||
<ion-buttons slot="start" *ngIf="!!pointer">
|
||||
<ion-button (click)="handleFormattedBack()">
|
||||
<ion-icon slot="icon-only" name="arrow-back-outline"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
</ion-toolbar>
|
||||
<!-- node is object -->
|
||||
<ion-item-group *ngIf="(node | typeof) === 'object'">
|
||||
<div *ngFor="let prop of node | keyvalue : asIsOrder">
|
||||
<!-- object/array -->
|
||||
<ng-container *ngIf="['object', 'array'] | includes : (prop.value | typeof); else notObj">
|
||||
<ion-item button detail="true" *ngIf="!(prop.value | empty)" (click)="goToNested(prop.key)">
|
||||
<ion-label class="ion-text-wrap">
|
||||
<h2>{{ prop.key }}</h2>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
</ng-container>
|
||||
<!-- not object/array -->
|
||||
<ng-template #notObj>
|
||||
<ion-item *ngIf="prop.value">
|
||||
<ion-label class="ion-text-wrap">
|
||||
<h2>{{ prop.key }}</h2>
|
||||
<p>{{ prop.value }}</p>
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
</ng-template>
|
||||
</div>
|
||||
</ion-item-group>
|
||||
<!-- node is array -->
|
||||
<ion-item-group *ngIf="(node | typeof) === 'array'">
|
||||
<ion-item *ngFor="let prop of node">
|
||||
<ion-label class="ion-text-wrap">
|
||||
{{ prop }}
|
||||
</ion-label>
|
||||
</ion-item>
|
||||
</ion-item-group>
|
||||
</div>
|
||||
|
||||
<div *ngIf="segmentValue === 'raw'" class="raw">
|
||||
<pre [innerHTML]="pkg | manifest | json"></pre>
|
||||
</div>
|
||||
</ion-content>
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
.metric-note {
|
||||
font-size: 16px;
|
||||
.raw {
|
||||
background-color: var(--ion-color-light);
|
||||
pre {
|
||||
margin: 0;
|
||||
padding: 12px;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
import { Component } from '@angular/core'
|
||||
import { ActivatedRoute } from '@angular/router'
|
||||
import { NavController } from '@ionic/angular'
|
||||
import * as JsonPointer from 'json-pointer'
|
||||
import { Subscription } from 'rxjs'
|
||||
import { distinctUntilChanged } from 'rxjs/operators'
|
||||
import { PackageDataEntry } from 'src/app/models/patch-db/data-model'
|
||||
import { PatchDbModel } from 'src/app/models/patch-db/patch-db-model'
|
||||
import { getManifest } from 'src/app/services/config.service'
|
||||
import * as JsonPointer from 'json-pointer'
|
||||
|
||||
@Component({
|
||||
selector: 'app-manifest',
|
||||
@@ -19,11 +17,11 @@ export class AppManifestPage {
|
||||
pointer: string
|
||||
node: object
|
||||
subs: Subscription[]
|
||||
segmentValue: 'formatted' | 'raw' = 'formatted'
|
||||
|
||||
constructor (
|
||||
private readonly route: ActivatedRoute,
|
||||
private readonly patch: PatchDbModel,
|
||||
private readonly navCtrl: NavController,
|
||||
) { }
|
||||
|
||||
ngOnInit () {
|
||||
@@ -35,12 +33,6 @@ export class AppManifestPage {
|
||||
this.pkg = pkg
|
||||
this.setNode()
|
||||
}),
|
||||
this.route.queryParams
|
||||
.pipe(distinctUntilChanged())
|
||||
.subscribe(queryParams => {
|
||||
this.pointer = queryParams['pointer']
|
||||
this.setNode()
|
||||
}),
|
||||
]
|
||||
|
||||
this.setNode()
|
||||
@@ -50,16 +42,20 @@ export class AppManifestPage {
|
||||
this.subs.forEach(sub => sub.unsubscribe())
|
||||
}
|
||||
|
||||
setNode () {
|
||||
handleFormattedBack () {
|
||||
const arr = this.pointer.split('/')
|
||||
arr.pop()
|
||||
this.pointer = arr.join('/')
|
||||
this.setNode()
|
||||
}
|
||||
|
||||
private setNode () {
|
||||
this.node = JsonPointer.get(getManifest(this.pkg), this.pointer || '')
|
||||
}
|
||||
|
||||
async goToNested (key: string): Promise<any> {
|
||||
this.navCtrl.navigateForward(`/services/installed/${this.pkgId}/manifest`, {
|
||||
queryParams: {
|
||||
pointer: `${this.pointer || ''}/${key}`,
|
||||
},
|
||||
})
|
||||
this.pointer = `${this.pointer || ''}/${key}`
|
||||
this.setNode()
|
||||
}
|
||||
|
||||
asIsOrder (a: any, b: any) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<ion-buttons slot="start">
|
||||
<pwa-back-button></pwa-back-button>
|
||||
</ion-buttons>
|
||||
<ion-title>Monitor</ion-title>
|
||||
<ion-title>Health</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<ion-buttons slot="start">
|
||||
<pwa-back-button></pwa-back-button>
|
||||
</ion-buttons>
|
||||
<ion-title>Restore From Backup</ion-title>
|
||||
<ion-title>Restore Backup</ion-title>
|
||||
<ion-buttons slot="end">
|
||||
<ion-button (click)="doRefresh()" color="primary">
|
||||
<ion-icon slot="icon-only" name="reload-outline"></ion-icon>
|
||||
|
||||
Reference in New Issue
Block a user