Kibana plugin to add a text box in the discover page


(Arjuncec) #1

Kibana version: 5.6.4

I need to add a button near to the "Add New Filter" link in the kibana discover page, and once we click the button, a modal window should open with some data in it. Please look into the screenshot attached.

For that, I will create an HTML button object and append this to a div which is having the class "filter-link" associated with it.
Below is hacks component

import $ from 'jquery'

$(document).ready(function(){
	function changeInputValue(){
		var html = '<div class="filter-description small" ><a id="aref" kbn-accessible-click="" tabindex="0" role="button">Saved searches<span class="fa fa-plus"></span></a>';		
		$(".filter-link").append(html);
	}
	function addFilterNew(){
		alert("test")
	}
	function startTimeout(){
		setTimeout(function(){
			var elem = $(".kuiLocalMenuItem").length;
			if(elem <= 0){
				startTimeout();
			} else{
				changeInputValue();
			}
		}, 100);
	}
	$(document).on("click", "#aref", addFilterNew);
	startTimeout();

});

Am I doing right thing? or Is there any better way to it? Also how can I create a modal window on click of this button?


(Nathan Reese) #2

Am I doing right thing? or Is there any better way to it?

That is a very vague question. Maybe a code example with an explicit question would be easier to answer. Your description does not really define the problem you are trying to solve, or the problems you are encountering with your plugin