@niketnilay, sorry for lat answer.
I'm attaching simpleXML code and Javascript code.
When I change the dropdown, it runs a search which collects data into an index.
Unfortunately it collects twice the same event.
As you can see there no complex elaboration
On Splunk 6.6.1 running it on a SH which is in cluster.
Let me know if need more information
Thanks for your help
This is simpleXML:
<dashboard script="js/test.js">
<init>
<set token="fake">1</set>
</init>
<label>foo</label>
<row>
<panel>
<html>
<div id="popup_mail_tipologia"/>
</html>
</panel>
</row>
<row>
<panel>
<table>
<search>
<query>index=test sourcetype="testsource"</query>
<earliest>-24h@h</earliest>
<latest>now</latest>
</search>
<option name="drilldown">none</option>
</table>
</panel>
</row>
</dashboard>
Javscript code:
require([
'underscore',
'jquery',
'splunkjs/mvc',
'splunkjs/mvc/tableview',
'splunkjs/mvc/searchmanager',
"splunkjs/mvc/timerangeview",
'splunkjs/mvc/simplexml/ready!'
], function (_, $, mvc, TableView, SearchManager, TimeRangeView) {
var SearchManager = require("splunkjs/mvc/searchmanager");
var ricerca = '| makeresults ';
var idsearchManagerEvent = "ack_events";
var searchManagerEvent = new SearchManager({
id: "ack_events",
autostart: "false",
search: "*",
cache: "true",
timeout: 60,
enable_lookups: "true"
});
var epoch = (new Date).getTime();
var DropdownType = require("splunkjs/mvc/dropdownview");
var dropdownTypeEvent = new DropdownType({
id: "DropdownType" + epoch,
default:
"",
el: $("#popup_mail_tipologia")
}, {
tokens: true
}).render();
var choices = [{label: "1", value: "1"}, {label: "2", value: "2"}
];
splunkjs.mvc.Components.getInstance("DropdownType" + epoch).settings.set("choices", choices);
dropdownTypeEvent.on('change', function (properties) {
save_search = _.template(
'| makeresults ' +
'| eval myfield="x" ' +
'| eval myFiledFromEvent="<%- ev %>" ' +
'| collect index=test sourcetype="testsource"', {
ev: "yy"
});
console.log(save_search);
searchManagerEvent.settings.unset("search");
searchManagerEvent.settings.set("search", save_search);
searchManagerEvent.startSearch();
});
});
screenshot:
... View more