Skip to content

Instantly share code, notes, and snippets.

@hobbes3
Last active August 29, 2015 14:05
Show Gist options
  • Save hobbes3/2ba61e055113ab160c8a to your computer and use it in GitHub Desktop.
Save hobbes3/2ba61e055113ab160c8a to your computer and use it in GitHub Desktop.
inpage drilldown pre 61 tokens example
require([
'jquery',
'underscore',
'splunkjs/mvc',
'splunkjs/mvc/simplexml/ready!'
], function(
$,
_,
mvc
) {
function submit_and_update_url() {
submitted_tokens.set(unsubmitted_tokens.toJSON());
mvc.Components.get('url').saveOnlyWithPrefix('form\\.', unsubmitted_tokens.toJSON(), {
replaceState: false
});
}
var master_view = mvc.Components.get('master');
var detail_view = mvc.Components.get('detail');
var unsubmitted_tokens = mvc.Components.get('default');
var submitted_tokens = mvc.Components.get('submitted');
if(!submitted_tokens.has('sourcetype')) {
detail_view.$el.parents('.dashboard-panel').hide();
}
submitted_tokens.on('change:sourcetype', function() {
if(!submitted_tokens.get('sourcetype')) {
detail_view.$el.parents('.dashboard-panel').hide();
} else {
detail_view.$el.parents('.dashboard-panel').show();
}
});
master_view.on('click', function(e) {
e.preventDefault();
var value = e.data['row.sourcetype'];
unsubmitted_tokens.set('form.sourcetype', value);
submit_and_update_url();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment