uiExport options

Hi,

I am developing an app type plugin, and I've been lookint into Kibana code.

I've noticed this in the index.js of the Kibana core plugin itself:

 app: {
        id: 'kibana',
        title: 'Kibana',
        listed: false,
        description: 'the kibana you know and love',
        main: 'plugins/kibana/kibana',
        uses: [
          'visTypes',
          'visResponseHandlers',
          'visRequestHandlers',
          'visEditorTypes',
          'savedObjectTypes',
          'spyModes',
          'fieldFormats',
          'fieldFormatEditors',
          'navbarExtensions',
          'managementSections',
          'devTools',
          'docViews'
        ],
        injectVars,
      },

What is the 'uses' part? and the injectVars part?

Thanks!

The injectVars part of the description, must point to a function, which returns an object (see e.g. the timelion sources).

This values are mostly used for to read out configuration options and make them available in the sources. The variables you return here, can either be injected in Angular by their name, or you have access to them via:

import chrome from 'ui/chrome';
chrome.getInjected('name-here', 'default-value-if-not-present');

The uses key is used to declare "dependencies" and used to build bundles later on. Orientate yourself at the existing plugins (mostly the list above) to see possible values, and only inject what you need in your application.

Thank you Tim.

But what are they exactly? I mean, what is a spyMode, for example?

Regards.

spyModes are the different modes you have when inspecting a visualization via the panel, that shows the request, response:

So "requests", "response", "table", "statistics" and "debug" are existing spy modes. If you don't want to add anything new to this debug panel, you won't need it.

In general I would recommend, that you try start building what you need, and only look into these if you have the feeling something isn't working for you.

ok, thank you @timroes

Hi again @timroes,

I've been looking into the navbarExtensions one, is it related to using kbn-top-nav directives in your app?

How would you go about doing that?

And also, if the uses part declares dependencies, then what's the diference from the require part?

For example, Timelion has 'kibana' and 'elasticsearch' in the require part, what's the diference from 'spyMode' in the uses part?

Regards.

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