Dashboards & Visualizations

i want to use canlander to select time without presets and relative and other optation

yaozelin
Observer
i just want to use a canlander to select time,but when i add a "time" panel ,there are presets\relative\real-time\... showed on the  web page ,i want to remove these panel and only show a canlander to select time.
Labels (1)
Tags (2)
0 Karma
1 Solution

vnravikumar
Champion

Hi

Check the below CSS and add/remove options accordingly.

<form>
  <label>time</label>
  <fieldset submitButton="false">
    <input type="time" token="field1">
      <label></label>
      <default>
        <earliest>1587859200</earliest>
        <latest>now</latest>
      </default>
    </input>
  </fieldset>
  <row depends="$hide$">
    <panel>
      <html>
      <style>
       div[data-test-panel-id="presets"],div[data-test-panel-id="relative"],div[data-test-panel-id="realTime"],div[data-test-panel-id="dateTime"],div[data-test-panel-id="advanced"]{

        display:none !important;
        }
      </style>
    </html>
    </panel>
  </row>
</form>

View solution in original post

0 Karma

niketn
Legend

@yaozelin refer to one of my older answers to add HTML Date input in the Dashboard which required Simple XML JS Extension to handle HTML Date input selection and change: https://answers.splunk.com/answers/627432/jquery-datepicker-in-splunk.html

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

yaozelin
Observer

Thank you very much, but I would like to use the native style of splunk. I have offered this kind of scheme as an alternative. Thanks again.

0 Karma

vnravikumar
Champion

Hi

Check the below CSS and add/remove options accordingly.

<form>
  <label>time</label>
  <fieldset submitButton="false">
    <input type="time" token="field1">
      <label></label>
      <default>
        <earliest>1587859200</earliest>
        <latest>now</latest>
      </default>
    </input>
  </fieldset>
  <row depends="$hide$">
    <panel>
      <html>
      <style>
       div[data-test-panel-id="presets"],div[data-test-panel-id="relative"],div[data-test-panel-id="realTime"],div[data-test-panel-id="dateTime"],div[data-test-panel-id="advanced"]{

        display:none !important;
        }
      </style>
    </html>
    </panel>
  </row>
</form>
0 Karma

yaozelin
Observer

hello,vnravikumar,Thank you first.Your plan is just what I want,but I also want to change the style of “Date-Range”.First,after i clicking the time input,It's not going to show you “Date-Range” .It should jump directly to the calendar.t doesn't take two clicks to get to calendar.The second,once the calendar display,I just want one calendar to show up and none of the other options to show up. it's maybe a little difficult,thank you ,vnravikumar.

0 Karma

vnravikumar
Champion

Hi

Check this

<form script="date.js">
  <label>time</label>
  <fieldset submitButton="false">
    <input type="time" token="field1" id="rk">
      <label></label>
      <default>
        <earliest>1587945600</earliest>
        <latest>1588204800</latest>
      </default>
    </input>
  </fieldset>
  <row depends="$hide$">
    <panel>
      <html>
      <style>
       div[data-test-panel-id="presets"],div[data-test-panel-id="relative"],div[data-test-panel-id="realTime"],div[data-test-panel-id="dateTime"],
           div[data-test-panel-id="advanced"]{
              display:none !important;
        }

       div[data-test="time-range-dialog"]{
        min-width: 440px!important; width: 440px!important;
        }
      </style>
    </html>
    </panel>
  </row>
</form>

javascript:

require(["jquery", "splunkjs/mvc", "splunkjs/mvc/simplexml/ready!"], function($, mvc) {
    $( "[data-test='toggle']" ).click(function() {
         setTimeout(function(){
            $("[data-test='textbox']").filter(':visible:first').focus();
        }, 500);
        });
});
0 Karma

vnravikumar
Champion

The second option I guess it's not feasible. May be someone can help you.

0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...