Skip to content

Instantly share code, notes, and snippets.

@davidfstr
Created February 3, 2014 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidfstr/eb7fdf952d4648b4957c to your computer and use it in GitHub Desktop.
Save davidfstr/eb7fdf952d4648b4957c to your computer and use it in GitHub Desktop.
<!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