Wait on dashboard filters to load for hack plugin in Kibana 6.8

I'm using a hack-type plugin to run some DOM manipulations on a dashboard's filters to add additional functionality. I have it setup the following way:

uiModules
    .get('kibana')
    .run(Private => {
        const filterBar = Private(FilterBarQueryFilterProvider);
        filters = filterBar.getFilters()
    });

The issue I have is that at first filters is empty as it's being ran before the filters are ready. I've tried using jQuery's $(document).ready function but that didn't help.

Is there a way to wait for the filters to be fully loaded on a dashboard before I can run code in run method?

Thanks!

You might try something like this:

filterBar.on('update', () => {
  const filters = filterBar.getFilters();
});

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