-
-
Save davidfstr/eb7fdf952d4648b4957c to your computer and use it in GitHub Desktop.
This file contains 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
<!DOCTYPE html> | |
{% load splunkmvc %} | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Time Range View Setup</title> | |
{% block css %} | |
<link rel="stylesheet" type="text/css" href="{{STATIC_URL}}splunkjs/css/bootstrap.css" /> | |
{% endblock css %} | |
</head> | |
</head> | |
<body> | |
{% component_loader %} | |
{% block content %} | |
<div id="content" class="container"> | |
<h2>Time Range View Setup</h2> | |
{% timerange id="myTimeRange" %} | |
</div> | |
{% endblock content %} | |
</body> | |
{% block js %} | |
<script> | |
require([ | |
'splunkjs/ready!' | |
], function(mvc) { | |
var myTimeRange = mvc.Components.get('myTimeRange'); | |
// Visit this page with ?preset=1 to get a preset. | |
// Visit this page without ?preset=1 to set a custom time value. | |
if (window.location.href.indexOf('?preset=1') !== -1) { | |
myTimeRange.settings.set('preset', 'All time'); | |
} else { | |
myTimeRange.settings.set('value', { | |
earliest_time: '-15m', | |
latest_time: 'now' | |
}); | |
} | |
}); | |
</script> | |
{% endblock js %} | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment