diff --git a/frontend/projects/ui/src/app/components/form-object/form-label/form-label.component.html b/frontend/projects/ui/src/app/components/form-object/form-label/form-label.component.html index af68f02f0..3bf9a7951 100644 --- a/frontend/projects/ui/src/app/components/form-object/form-label/form-label.component.html +++ b/frontend/projects/ui/src/app/components/form-object/form-label/form-label.component.html @@ -9,7 +9,6 @@ {{ data.name }} - (New)  (New Options)  (Edited) diff --git a/frontend/projects/ui/src/app/components/form-object/form-label/form-label.component.ts b/frontend/projects/ui/src/app/components/form-object/form-label/form-label.component.ts index f4518defb..a798660ce 100644 --- a/frontend/projects/ui/src/app/components/form-object/form-label/form-label.component.ts +++ b/frontend/projects/ui/src/app/components/form-object/form-label/form-label.component.ts @@ -12,7 +12,6 @@ export class FormLabelComponent { name: string description: string | null edited?: boolean - new?: boolean required?: boolean newOptions?: boolean } diff --git a/frontend/projects/ui/src/app/components/form-object/form-object/controls/form-input/form-input.component.html b/frontend/projects/ui/src/app/components/form-object/form-object/controls/form-input/form-input.component.html index 649d6fcbb..b4a14447c 100644 --- a/frontend/projects/ui/src/app/components/form-object/form-object/controls/form-input/form-input.component.html +++ b/frontend/projects/ui/src/app/components/form-object/form-object/controls/form-input/form-input.component.html @@ -3,7 +3,6 @@ [data]="{ name: spec.name, description: spec.description, - new: form.original?.[name] === undefined, edited: control.dirty, required: !spec.nullable }" diff --git a/frontend/projects/ui/src/app/components/form-object/form-object/form-object.component.html b/frontend/projects/ui/src/app/components/form-object/form-object/form-object.component.html index 6004533e7..26406bbda 100644 --- a/frontend/projects/ui/src/app/components/form-object/form-object/form-object.component.html +++ b/frontend/projects/ui/src/app/components/form-object/form-object/form-object.component.html @@ -24,7 +24,6 @@ [data]="{ name: spec.name, description: spec.description, - new: original?.[entry.key] === undefined, edited: entry.value.dirty }" > @@ -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 }" > @@ -272,7 +268,6 @@ [data]="{ name: spec.name, description: spec.description, - new: original?.[entry.key] === undefined, edited: entry.value.dirty }" > diff --git a/frontend/projects/ui/src/app/components/form-object/form-object/form-object.component.ts b/frontend/projects/ui/src/app/components/form-object/form-object/form-object.component.ts index 565ce020a..72eb70bfd 100644 --- a/frontend/projects/ui/src/app/components/form-object/form-object/form-object.component.ts +++ b/frontend/projects/ui/src/app/components/form-object/form-object/form-object.component.ts @@ -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) { diff --git a/frontend/projects/ui/src/app/components/form-object/form-union/form-union.component.html b/frontend/projects/ui/src/app/components/form-object/form-union/form-union.component.html index ed9fc31be..f01abb277 100644 --- a/frontend/projects/ui/src/app/components/form-object/form-union/form-union.component.html +++ b/frontend/projects/ui/src/app/components/form-object/form-union/form-union.component.html @@ -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)" > - + @Input() original?: Record - 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()