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