<%!
from splunk.appserver.mrsparkle.lib import times
%>

<%

timeRanges = times.getTimeRanges(namespace=APP['id'])
customTimes = []

for t in timeRanges:
    item = {}
    if "is_sub_menu" in t:
        continue
    for k in ("earliest_time", "latest_time", "label", "header_label"):
        if k in t:
            if k in ('label', 'header_label'):
                item[k] = _(t[k])
            else:
                item[k] = t[k]
    customTimes.append(item)
    
jsonOutput = jsonify(customTimes)
%>

<%page args="module"/>
<%namespace name="lib" file="//lib.html" import="*"/>



<%call expr="lib.add_script_block()">
    Splunk.Module.loadParams.${module['id']}.customTimeHeaders = ${jsonOutput};
</%call>
<div class="splHeader splHeader-primary">
<h2>
% if "prefix" in module :
    ${module["prefix"]}
% endif
    <span class="numberOfEvents">&nbsp;</span> 
    <span class="entityLabelStr">&nbsp;</span> 
    <span class="timeRangeStr">&nbsp;</span>
</h2>
<div class="splClearfix"></div>
</div>

