diff --git a/src/app/core/basic-datatypes/configurable-enum/configure-enum-popup/configure-enum-popup.component.html b/src/app/core/basic-datatypes/configurable-enum/configure-enum-popup/configure-enum-popup.component.html index f0e54c54cc..599b384fc6 100644 --- a/src/app/core/basic-datatypes/configurable-enum/configure-enum-popup/configure-enum-popup.component.html +++ b/src/app/core/basic-datatypes/configurable-enum/configure-enum-popup/configure-enum-popup.component.html @@ -2,6 +2,7 @@

Edit dropdown options

+ matIconPrefix class="grab-icon margin-right-small" > + + + + + + Add new option + + + diff --git a/src/app/core/basic-datatypes/configurable-enum/configure-enum-popup/configure-enum-popup.component.spec.ts b/src/app/core/basic-datatypes/configurable-enum/configure-enum-popup/configure-enum-popup.component.spec.ts index f1d171a757..32bd4619d7 100644 --- a/src/app/core/basic-datatypes/configurable-enum/configure-enum-popup/configure-enum-popup.component.spec.ts +++ b/src/app/core/basic-datatypes/configurable-enum/configure-enum-popup/configure-enum-popup.component.spec.ts @@ -17,6 +17,7 @@ import { entityRegistry, EntityRegistry, } from "../../../entity/database-entity.decorator"; +import { NoopAnimationsModule } from "@angular/platform-browser/animations"; describe("ConfigureEnumPopupComponent", () => { let component: ConfigureEnumPopupComponent; @@ -26,7 +27,11 @@ describe("ConfigureEnumPopupComponent", () => { beforeEach(async () => { entityMapper = mockEntityMapper(); await TestBed.configureTestingModule({ - imports: [ConfigureEnumPopupComponent, FontAwesomeTestingModule], + imports: [ + ConfigureEnumPopupComponent, + FontAwesomeTestingModule, + NoopAnimationsModule, + ], providers: [ { provide: MAT_DIALOG_DATA, useValue: new ConfigurableEnum() }, { provide: MatDialogRef, useValue: { afterClosed: () => EMPTY } }, diff --git a/src/app/core/basic-datatypes/configurable-enum/configure-enum-popup/configure-enum-popup.component.ts b/src/app/core/basic-datatypes/configurable-enum/configure-enum-popup/configure-enum-popup.component.ts index 949bb3f46d..bffccff20a 100644 --- a/src/app/core/basic-datatypes/configurable-enum/configure-enum-popup/configure-enum-popup.component.ts +++ b/src/app/core/basic-datatypes/configurable-enum/configure-enum-popup/configure-enum-popup.component.ts @@ -43,6 +43,8 @@ import { Entity } from "../../../entity/model/entity"; standalone: true, }) export class ConfigureEnumPopupComponent { + newOptionInput: string; + constructor( @Inject(MAT_DIALOG_DATA) public enumEntity: ConfigurableEnum, private dialog: MatDialogRef, @@ -125,4 +127,13 @@ export class ConfigureEnumPopupComponent { ), ); } + + createNewOption() { + this.enumEntity.values.push({ + id: this.newOptionInput, + label: this.newOptionInput, + }); + this.newOptionInput = ""; + } + mynewFun() {} }