Kibana plugins "chrome" api changed in 7.2.0

Hi, in 7.2.0 this code from a "hack" javascript file in my plugin stopped working:

import chrome from "ui/chrome"
chrome.getNavLinkById("xyz").hide
...

So I found that this breaking change might be due to the introduction "new platform" API:

In the issue they show a table with equivalent API calls, where I see I could do this:

import core from '???' // <-- what should I import?
core.navLinks.hide(id)

But I have no idea what to import instead of ui/chrome.

What do I have to import now?

Hey @Simone_Scarduzio,

You can hide links using the following:

import { npStart } from 'ui/new_platform';

const linkId = 'foo';
const navLinks = npStart.core.chrome.navLinks;
navLinks.update(linkId, { hidden: true });

Thank you Larry!
It did not work in the exact form you explained, but the only way I got it working is the following:

const navLinks = require('ui/new_platform').getNewPlatform().start.core.chrome.navLinks;
navLinks.update('foo', { hidden: true });
1 Like

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