Skip to content

Commit

Permalink
[Dashboard] [Control] Remove support for scripted fields for options …
Browse files Browse the repository at this point in the history
…list (#144643) (#144744)

* Remove support for scripted fields for all controls

* Remove support only for options list

* Add functional test

(cherry picked from commit 508f012)
  • Loading branch information
Heenawter authored Nov 7, 2022
1 parent adf0740 commit 91edd82
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ export class OptionsListEmbeddableFactory

public isFieldCompatible = (dataControlField: DataControlField) => {
if (
(dataControlField.field.aggregatable && dataControlField.field.type === 'string') ||
dataControlField.field.type === 'boolean'
!dataControlField.field.spec.scripted &&
((dataControlField.field.aggregatable && dataControlField.field.type === 'string') ||
dataControlField.field.type === 'boolean')
) {
dataControlField.compatibleControlTypes.push(this.type);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,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();
});
Expand Down

0 comments on commit 91edd82

Please sign in to comment.