mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 12:11:56 +00:00
remove NEW from config
This commit is contained in:
committed by
Aiden McClelland
parent
ddf1f9bcd5
commit
f6e142baf5
@@ -9,7 +9,6 @@
|
||||
|
||||
<span>{{ data.name }}</span>
|
||||
|
||||
<ion-text color="success" *ngIf="data.new"> (New)</ion-text>
|
||||
<ion-text color="success" *ngIf="data.newOptions"> (New Options)</ion-text>
|
||||
<ion-text color="warning" *ngIf="data.edited"> (Edited)</ion-text>
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ export class FormLabelComponent {
|
||||
name: string
|
||||
description: string | null
|
||||
edited?: boolean
|
||||
new?: boolean
|
||||
required?: boolean
|
||||
newOptions?: boolean
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
[data]="{
|
||||
name: spec.name,
|
||||
description: spec.description,
|
||||
new: form.original?.[name] === undefined,
|
||||
edited: control.dirty,
|
||||
required: !spec.nullable
|
||||
}"
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
[data]="{
|
||||
name: spec.name,
|
||||
description: spec.description,
|
||||
new: original?.[entry.key] === undefined,
|
||||
edited: entry.value.dirty
|
||||
}"
|
||||
></form-label>
|
||||
@@ -68,7 +67,6 @@
|
||||
[data]="{
|
||||
name: spec.name,
|
||||
description: spec.description,
|
||||
new: original?.[entry.key] === undefined,
|
||||
edited: entry.value.dirty,
|
||||
newOptions: objectDisplay[entry.key].hasNewOptions
|
||||
}"
|
||||
@@ -121,7 +119,6 @@
|
||||
[data]="{
|
||||
name: spec.name,
|
||||
description: spec.description,
|
||||
new: original?.[entry.key] === undefined,
|
||||
edited: entry.value.dirty,
|
||||
required: !!(spec.range | toRange).min
|
||||
}"
|
||||
@@ -166,7 +163,6 @@
|
||||
objectListDisplay[entry.key][i].displayAs ||
|
||||
'Entry ' + (i + 1),
|
||||
description: null,
|
||||
new: false,
|
||||
edited: abstractControl.dirty
|
||||
}"
|
||||
></form-label>
|
||||
@@ -272,7 +268,6 @@
|
||||
[data]="{
|
||||
name: spec.name,
|
||||
description: spec.description,
|
||||
new: original?.[entry.key] === undefined,
|
||||
edited: entry.value.dirty
|
||||
}"
|
||||
></form-label>
|
||||
|
||||
@@ -62,13 +62,7 @@ export class FormObjectComponent {
|
||||
|
||||
// setTimeout hack to avoid ExpressionChangedAfterItHasBeenCheckedError
|
||||
setTimeout(() => {
|
||||
if (
|
||||
this.original &&
|
||||
Object.keys(this.current || {}).some(
|
||||
key => this.original![key] === undefined,
|
||||
)
|
||||
)
|
||||
this.hasNewOptions.emit()
|
||||
// if (this.original && Object.values(this.objectSpec).some(spec => spec['is-new'])) this.hasNewOptions.emit()
|
||||
})
|
||||
}
|
||||
|
||||
@@ -144,7 +138,7 @@ export class FormObjectComponent {
|
||||
this.hasNewOptions.emit()
|
||||
setTimeout(() => {
|
||||
this.objectDisplay[key].hasNewOptions = true
|
||||
}, 100)
|
||||
})
|
||||
}
|
||||
|
||||
handleBooleanChange(key: string, spec: ValueSpecBoolean) {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
[data]="{
|
||||
name: spec.tag.name,
|
||||
description: spec.tag.description,
|
||||
new: isNew,
|
||||
newOptions: hasNewOptions,
|
||||
edited: formGroup.dirty
|
||||
}"
|
||||
@@ -19,7 +18,7 @@
|
||||
slot="end"
|
||||
placeholder="Select"
|
||||
[formControlName]="spec.tag.id"
|
||||
[selectedText]="spec.tag['variant-names'][unionValue]"
|
||||
[selectedText]="variantName"
|
||||
(ionChange)="updateUnion($event)"
|
||||
>
|
||||
<ion-select-option
|
||||
@@ -31,9 +30,9 @@
|
||||
</ion-select>
|
||||
</ion-item-divider>
|
||||
|
||||
<tui-elastic-container [id]="objectId | toElementId: 'union'" class="indent">
|
||||
<tui-elastic-container [id]="objectId | toElementId : 'union'" class="indent">
|
||||
<form-object
|
||||
[objectSpec]="spec.variants[unionValue]"
|
||||
[objectSpec]="variantSpec"
|
||||
[formGroup]="formGroup"
|
||||
[current]="current"
|
||||
[original]="original"
|
||||
|
||||
@@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
|
||||
import { UntypedFormGroup } from '@angular/forms'
|
||||
import { v4 } from 'uuid'
|
||||
import { FormService } from 'src/app/services/form.service'
|
||||
import { ValueSpecUnion } from 'start-sdk/types/config-types'
|
||||
import { ValueSpecUnion, InputSpec } from 'start-sdk/types/config-types'
|
||||
|
||||
@Component({
|
||||
selector: 'form-union',
|
||||
@@ -16,22 +16,21 @@ export class FormUnionComponent {
|
||||
@Input() current?: Record<string, any>
|
||||
@Input() original?: Record<string, any>
|
||||
|
||||
get unionValue() {
|
||||
get selectedVariant(): string {
|
||||
return this.formGroup.get(this.spec.tag.id)?.value
|
||||
}
|
||||
|
||||
get isNew() {
|
||||
return !this.original
|
||||
get variantName(): string {
|
||||
return this.spec.tag['variant-names'][this.selectedVariant]
|
||||
}
|
||||
|
||||
get hasNewOptions() {
|
||||
const tagId = this.spec.tag.id
|
||||
return (
|
||||
this.original?.[tagId] === this.current?.[tagId] &&
|
||||
!!Object.keys(this.current || {}).find(
|
||||
key => this.original![key] === undefined,
|
||||
)
|
||||
)
|
||||
get variantSpec(): InputSpec {
|
||||
return this.spec.variants[this.selectedVariant]
|
||||
}
|
||||
|
||||
get hasNewOptions(): boolean {
|
||||
// return Object.values(this.variantSpec).some(spec => spec['is-new'])
|
||||
return false
|
||||
}
|
||||
|
||||
objectId = v4()
|
||||
|
||||
Reference in New Issue
Block a user