diff --git a/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.html b/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.html
index c324efd8b..7d4881a77 100644
--- a/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.html
+++ b/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.html
@@ -13,6 +13,8 @@
bindLabel="name"
[(ngModel)]="field"
[placeholder]="placeholderText"
+ [notFoundText]="notFoundText"
+ (createNew)="createField($event)"
bindValue="id">
diff --git a/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.spec.ts b/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.spec.ts
index c5edfaf68..a95697b1e 100644
--- a/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.spec.ts
+++ b/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.spec.ts
@@ -124,4 +124,14 @@ describe('CustomFieldsDropdownComponent', () => {
expect(toastInfoSpy).toHaveBeenCalled()
expect(getFieldsSpy).toHaveBeenCalled()
})
+
+ it('should support creating field with name', () => {
+ let modal: NgbModalRef
+ modalService.activeInstances.subscribe((m) => (modal = m[m.length - 1]))
+ component.createField('Foo bar')
+
+ expect(modal).not.toBeUndefined()
+ const editDialog = modal.componentInstance as CustomFieldEditDialogComponent
+ expect(editDialog.object.name).toEqual('Foo bar')
+ })
})
diff --git a/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.ts b/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.ts
index 7cf47a91b..12c51133d 100644
--- a/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.ts
+++ b/src-ui/src/app/components/common/custom-fields-dropdown/custom-fields-dropdown.component.ts
@@ -44,6 +44,10 @@ export class CustomFieldsDropdownComponent implements OnDestroy {
return $localize`Choose field`
}
+ get notFoundText(): string {
+ return $localize`No unused fields found`
+ }
+
constructor(
private customFieldsService: CustomFieldsService,
private modalService: NgbModal,
@@ -82,8 +86,9 @@ export class CustomFieldsDropdownComponent implements OnDestroy {
this.added.emit(this.customFields.find((f) => f.id === this.field))
}
- createField() {
+ createField(newName: string = null) {
const modal = this.modalService.open(CustomFieldEditDialogComponent)
+ if (newName) modal.componentInstance.object = { name: newName }
modal.componentInstance.succeeded
.pipe(takeUntil(this.unsubscribeNotifier))
.subscribe((newField) => {
diff --git a/src-ui/src/app/components/common/input/check/check.component.html b/src-ui/src/app/components/common/input/check/check.component.html
index 230a6d02b..9d75088b4 100644
--- a/src-ui/src/app/components/common/input/check/check.component.html
+++ b/src-ui/src/app/components/common/input/check/check.component.html
@@ -8,7 +8,7 @@
Remove
-