mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-31 04:23:40 +00:00
0.2.5 initial commit
Makefile incomplete
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { NgModule } from '@angular/core'
|
||||
import { CommonModule } from '@angular/common'
|
||||
import { IonicModule } from '@ionic/angular'
|
||||
import { AppConfigUnionPage } from './app-config-union.page'
|
||||
import { ObjectConfigComponentModule } from 'src/app/components/object-config/object-config.component.module'
|
||||
import { FormsModule } from '@angular/forms'
|
||||
import { ConfigHeaderComponentModule } from 'src/app/components/config-header/config-header.component.module'
|
||||
|
||||
|
||||
@NgModule({
|
||||
declarations: [AppConfigUnionPage],
|
||||
imports: [
|
||||
CommonModule,
|
||||
IonicModule,
|
||||
FormsModule,
|
||||
ObjectConfigComponentModule,
|
||||
ConfigHeaderComponentModule,
|
||||
],
|
||||
entryComponents: [AppConfigUnionPage],
|
||||
exports: [AppConfigUnionPage],
|
||||
})
|
||||
export class AppConfigUnionPageModule { }
|
||||
@@ -0,0 +1,31 @@
|
||||
<ion-header>
|
||||
<ion-toolbar>
|
||||
<ion-buttons slot="start">
|
||||
<ion-button (click)="dismiss()">
|
||||
<ion-icon name="arrow-back"></ion-icon>
|
||||
</ion-button>
|
||||
</ion-buttons>
|
||||
<ion-title>{{ spec.name }}</ion-title>
|
||||
</ion-toolbar>
|
||||
</ion-header>
|
||||
|
||||
<ion-content>
|
||||
|
||||
<config-header [spec]="spec" [error]="error"></config-header>
|
||||
|
||||
<!-- union -->
|
||||
<ion-item-group>
|
||||
<ion-item-divider></ion-item-divider>
|
||||
<ion-item>
|
||||
<ion-label>{{ spec.tag.name }}</ion-label>
|
||||
<ion-select slot="end" [interfaceOptions]="setSelectOptions()" placeholder="Select One" [(ngModel)]="value[spec.tag.id]" [selectedText]="spec.tag.variantNames[value[spec.tag.id]]" (ngModelChange)="handleUnionChange()">
|
||||
<ion-select-option *ngFor="let option of spec.variants | keyvalue: asIsOrder" [value]="option.key">
|
||||
{{ spec.tag.variantNames[option.key] }}
|
||||
<span *ngIf="option.key === spec.default"> (default)</span>
|
||||
</ion-select-option>
|
||||
</ion-select>
|
||||
</ion-item>
|
||||
<object-config [cursor]="cursor" (onEdit)="handleObjectEdit()"></object-config>
|
||||
</ion-item-group>
|
||||
|
||||
</ion-content>
|
||||
58
ui/src/app/modals/app-config-union/app-config-union.page.ts
Normal file
58
ui/src/app/modals/app-config-union/app-config-union.page.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { Component, Input, ViewChild } from '@angular/core'
|
||||
import { ModalController } from '@ionic/angular'
|
||||
import { ConfigCursor } from 'src/app/app-config/config-cursor'
|
||||
import { ValueSpecUnion } from 'src/app/app-config/config-types'
|
||||
import { ObjectConfigComponent } from 'src/app/components/object-config/object-config.component'
|
||||
import { mapUnionSpec } from '../../app-config/config-utilities'
|
||||
|
||||
@Component({
|
||||
selector: 'app-config-union',
|
||||
templateUrl: './app-config-union.page.html',
|
||||
styleUrls: ['./app-config-union.page.scss'],
|
||||
})
|
||||
export class AppConfigUnionPage {
|
||||
@Input() cursor: ConfigCursor<'union'>
|
||||
|
||||
@ViewChild(ObjectConfigComponent)
|
||||
objectConfig: ObjectConfigComponent
|
||||
|
||||
spec: ValueSpecUnion
|
||||
value: object
|
||||
error: string
|
||||
|
||||
constructor (
|
||||
private readonly modalCtrl: ModalController,
|
||||
) { }
|
||||
|
||||
ngOnInit () {
|
||||
this.spec = this.cursor.spec()
|
||||
this.value = this.cursor.config()
|
||||
this.error = this.cursor.checkInvalid()
|
||||
}
|
||||
|
||||
async dismiss () {
|
||||
this.modalCtrl.dismiss(this.value)
|
||||
}
|
||||
|
||||
async handleUnionChange () {
|
||||
this.value = mapUnionSpec(this.spec, this.value)
|
||||
this.objectConfig.annotations = this.objectConfig.cursor.getAnnotations()
|
||||
}
|
||||
|
||||
setSelectOptions () {
|
||||
return {
|
||||
header: this.spec.tag.name,
|
||||
subHeader: this.spec.changeWarning ? 'Warning!' : undefined,
|
||||
message: this.spec.changeWarning ? `${this.spec.changeWarning}` : undefined,
|
||||
cssClass: 'select-change-warning',
|
||||
}
|
||||
}
|
||||
|
||||
handleObjectEdit () {
|
||||
this.error = this.cursor.checkInvalid()
|
||||
}
|
||||
|
||||
asIsOrder () {
|
||||
return 0
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user