Kibana editor vis issue

hi team, i create custom vis and have issue while updating my default state.

this is my editor script:

export class StandardDeviationFilterEditor extends React.Component {

 onChange = (selectedOptions) => {
     this.props.stageEditorParams({
      selected: selectedOptions,
     });
 };

render() {
    const { selectedOptions } = this.state;
    console.log("editor state: ",this.props.editorState.params.selected.label)

    return (
      <div>
       <EuiTitle size="xxs">
         <h1>Choose index for search in</h1>
       </EuiTitle>
     <EuiComboBox
       singleSelection={{ asPlainText: true }}
       options={this.options}
       selectedOptions={selectedOptions}
       onChange={this.onChange}
       isClearable={false}
       />
     </div>
    );
  }
}

this is default vis parameters:

return VisFactory.createReactVisualization({
   name: 'standard_deviation_filter_vis',
   title: 'Standard Deviation Filter Vis',
   icon: 'visGoal',
   description: 'Standard deviation filter vis search',
   visConfig: {
     component: StandardDeviationFilterComponent,
     defaults: {
       selected: {label:"None"},
    },
  },
  editorConfig: {
    optionTabs: [
      {
        name: 'options',
        title: 'Options',
        editor: StandardDeviationFilterEditor,
      },
    ],
  },
  requestHandler: 'none',
  stage: "experimental"
});

so console.log shows None first and undefined at second. Please, help me find mistakes.

You didn't mention which version you're using, but one thing that stands out to me is that stageEditorParams has changed to setValue in Kibana 7.4: https://www.elastic.co/blog/kibana-plugin-api-changes-in-7.4

I haven't tested the latest sample plugins, but Kibana 7.8 was released last week: https://github.com/elastic/kibana/tree/7.8/test/plugin_functional/plugins/kbn_tp_custom_visualizations

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.