Hey, so I've tried the following:
require([
'jquery',
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
], function($, _, mvc) {
_(mvc.Components.toJSON()).chain().each(function(el) {
console.log($(el).attr("id"));
});
});
but it's not giving me anything for
<dashboard script="test.js">
<label>test</label>
<row>
<panel>
<title>Test</title>
<chart id="my_chart">
<search>
<query>index=_internal | stats count by sourcetype</query>
<earliest>-1d@d</earliest>
<latest>now</latest>
</search>
<option name="charting.chart">pie</option>
<option name="height">357</option>
</chart>
<html id="my_chart_settings">
<div style="display:none;" data-thisisacustomthingy="true" />
</html>
</panel>
</row>
</dashboard>
I could get close to data-thisisacustomthingy by
_(mvc.Components.toJSON()).chain().filter(function(el){
if(el.id && (el.id.match(/_settings$/) != null)) { return el;}
}).each(function(el){
console.log(el.$(el).prevObject[0].children[0].firstChild);
(...)
but that looks so ugly (and it's not even there yet...).
... View more