How to add a link in Side Navbar of Kibana 6.2


(Dheeraj Singh) #1

Hi There,

I want to add a link in side-navigation of Kibana 6.2. The URL of the link needs to be taken from kibana.yml (dashboard.defaultAppId).

Thanks in advance for the help!

Regards,
Dhiraj


(Bill McConaghy) #2

You would need to develop a custom plugin to accomplish this. This guide is a good starting point for that: https://www.elastic.co/guide/en/kibana/current/plugin-development.html


(Dheeraj Singh) #3

Thanks for your reply Bill.

I've already developed a plugin. I am able to add a button in side-nav:

uiExports: {
			links: [
					{
					id: 'kibana:home_dashboard',
					title: 'Home',
					order: -1004,
					url: `${kbnBaseUrl}#${appId}`,
					description: 'Home button',
					}
				]
			]
		}
...........
...........
}

But the problem is I am not able to get the value from kibana.yml and set in the url.


(Bill McConaghy) #4

Sorry, misunderstood your question. An example of how to read the configuration can be found here:



(Dheeraj Singh) #5
var appId; // This needs to be configurable. 

export default function (kibana) {	

	var kibanaPluginObj = {
		name: 'test',
		require: ['elasticsearch'],
		config: function (Joi) {
			var obj = Joi.object({
				enabled: Joi.boolean().default(true),
				keycloak: Joi.boolean().default(false),
				proxydomain: Joi.string(),
				password: Joi.string().default('x?23^zH2sdfdfsCZpS%deEf=784^NgJ')
			}).default();
			return obj;
		},
		uiExports: {
			links: [
					{
					id: 'kibana:home_dashboard',
					title: 'Home',
					order: -1004,
					url: `${kbnBaseUrl}#${appId}`, // appId is undefined here. I think UI Exports getting executed before the init() method perhaps. 
					description: 'Home button',
					}
				]
		},
		init(server, options) {
			try {
			const serverConfig = server.config();
			**appId = serverConfig.get('kibana.defaultAppId'),**
			}
			catch (err) {
				this.status.red('Exception while checking config');
			}
		}
	}

	return new kibana.Plugin(kibanaPluginObj);
		
}

In init() method I am able to get the value from kibana.yml (kibana.defaultAppId) but I am still not able to set it to the url in the link object up above.


(system) #6

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