Last active
August 29, 2015 14:05
-
-
Save hobbes3/657912d31e23330c0a69 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require([ | |
'jquery', | |
'underscore', | |
'splunkjs/mvc', | |
'splunkjs/mvc/simplexml/ready!' | |
], function( | |
$, | |
_, | |
mvc | |
) { | |
var mainView = mvc.Components.get('main'); | |
var unsubmitted_tokens = mvc.Components.get('default'); | |
var submitted_tokens = mvc.Components.get('submitted'); | |
var url_tokens = mvc.Components.get('url'); | |
mainView.on('click', function(e) { | |
e.preventDefault(); | |
var sourcetype = e.data['row.sourcetype']; | |
unsubmitted_tokens.set('form.sourcetype', sourcetype); | |
//unsubmitted_tokens.set('sourcetype', sourcetype); | |
//submitted_tokens.set('sourcetype', sourcetype); | |
submitted_tokens.set(unsubmitted_tokens.toJSON()); | |
url_tokens.saveOnlyWithPrefix('form\\.', unsubmitted_tokens.toJSON(), { | |
replaceState: false | |
}); | |
//url_tokens.save(submitted_tokens.toJSON(), { | |
// replaceState: false | |
//}); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form script="understand_tokens.js"> | |
<fieldset> | |
<input type="text" token="sourcetype"/> | |
</fieldset> | |
<row> | |
<html> | |
sourcetype: $sourcetype$ | |
</html> | |
<table id="main"> | |
<searchString>index=_internal | top sourcetype</searchString> | |
<earliestTime>-60m@m</earliestTime> | |
<latestTime>now</latestTime> | |
</table> | |
</row> | |
<row> | |
<panel> | |
<event> | |
<searchString>index=_internal sourcetype=$sourcetype$</searchString> | |
<earliestTime>-60m@m</earliestTime> | |
<latestTime>now</latestTime> | |
</event> | |
</panel> | |
</row> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment