FieldFormat plugin for Kibana 7.6

According to the migration notes, it appears FieldFormats (ui/registry/field_formats) has been migrated to data.fieldFormats. However, it does not look like the FieldFormatsRegistryProvider has been migrated. Is it possible to still create a custom FieldFormat with a configuration editor? I successfully created a custom FieldFormat with data.fieldFormats. However, when I try to register an editor with FieldFormatsRegistryProvider in that same plugin, it does not appear.

Hi @jdd1, the registry for field format editors is not migrated yet. You should be able to use RegistryFieldFormatEditorsProvider (src/legacy/ui/public/registry/field_format_editors.js ) to register your custom editor component.

You can see how it's used e.g. in src/legacy/ui/public/field_editor/components/field_format_editor/register.js

@flash1293, I believe I have tried this. When I add the following code to public/index.js:

export class MyFormatEditor extends DefaultFormatEditor {
  static formatId = 'my_field_format';
  constructor(props) { super(props); }
  render() {
    return (<Fragment><div>Test!</div></Fragment);
  }
}

RegistryFieldFormatEditorsProvider.register(()=>MyFormatEditor);

It still does not appear. I added some code to _registry.js to verify that it is actually being called, which it is. I also added some code to print the contents of the current registry, and it appears when I import RegistryFieldFormatEditorsProvider, it is either creating an additional instance or it is being overwritten by the built-in FieldTypes editors.

Sounds like it is not ending up in the same bundle as the main Kibana app. If you can share your complete plugin code (e.g. in a Github repo), it would be much easier to help you, even though I understand that's not possible in all cases.

There is no specific uiExport for field formatters, but using the visTypes one should also do the trick. In your custom plugins Plugin class, list the file with the format editor under uiExports.visTypes:

      new Plugin({
        id: 'test',
        uiExports: {
          visTypes: ['plugin/test/path/to/format_editor'],
 // ...

@flash1293, I'm not sure entirely where I'm supposed to put this? I'm trying to use the new plugin construct (/public/index.ts, /public/plugin.ts), so I don't know where this belongs.

Hi @jdd1,

That explains the problem - as the field format editors are still in the legacy platform, you can’t call them from the new platform (using plugin.ts and kibana.json).

You either have to wait till they are migrated to the new platform or use a separate plugin in the legacy plugin format to register the editor till then.