[Dashboard] [Control] Remove support for scripted fields for options list (#144643)

* Remove support for scripted fields for all controls

* Remove support only for options list

* Add functional test
This commit is contained in:
Hannah Mudge 2022-11-07 09:51:11 -07:00 committed by GitHub
parent 2619f0488f
commit 508f0127e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -56,9 +56,10 @@ export class OptionsListEmbeddableFactory
public isFieldCompatible = (dataControlField: DataControlField) => {
if (
(dataControlField.field.aggregatable && dataControlField.field.type === 'string') ||
dataControlField.field.type === 'boolean' ||
dataControlField.field.type === 'ip'
!dataControlField.field.spec.scripted &&
((dataControlField.field.aggregatable && dataControlField.field.type === 'string') ||
dataControlField.field.type === 'boolean' ||
dataControlField.field.type === 'ip')
) {
dataControlField.compatibleControlTypes.push(this.type);
}

View file

@ -195,6 +195,15 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
await dashboard.clearUnsavedChanges();
});
it('cannot create options list for scripted field', async () => {
expect(await dashboardControls.optionsListEditorGetCurrentDataView(true)).to.eql(
'animals-*'
);
await dashboardControls.openCreateControlFlyout();
await testSubjects.missingOrFail('field-picker-select-isDog');
await dashboardControls.controlEditorCancel(true);
});
after(async () => {
await dashboardControls.clearAllControls();
});