Dashboards & Visualizations

Back button (or something like it) on a dashboard

dbcase
Motivator

Hi,

What would be the best/easiest way to add a button (or something) on a given dashboard that would go back to the Dashboard Menu (just a HTML dashboard that I've created)?

0 Karma
1 Solution

rjthibod
Champion

Do you mean the page that list all of the dashboards in the app?

If so, the easiest solution without adding custom HTML is to include the dashboard link in the navigation menu. If you include the following in your navigation menu (default.xml), you will "Dashboards" listed on the navigation bar,

<nav>
 ...
  <view name="dashboards" />
 ...
</nav>

But, if you need HTML on the dashboard, you can fashion based on this in SimpleXML. Note the token $your_app_name$ is a stand-in for your applications name/id in splunk. The path for "dashboards" is relative to it.

<html>
    <p>
      <a class="backbutton" id="backbutton" href="/static/app/$your_app_name$/dashboards">
        <img alt="Dashboads link" src="/static/app/$your_app_name$/backbutton.png"/>
      </a>
    </p>
</html> 

View solution in original post

0 Karma

rjthibod
Champion

Do you mean the page that list all of the dashboards in the app?

If so, the easiest solution without adding custom HTML is to include the dashboard link in the navigation menu. If you include the following in your navigation menu (default.xml), you will "Dashboards" listed on the navigation bar,

<nav>
 ...
  <view name="dashboards" />
 ...
</nav>

But, if you need HTML on the dashboard, you can fashion based on this in SimpleXML. Note the token $your_app_name$ is a stand-in for your applications name/id in splunk. The path for "dashboards" is relative to it.

<html>
    <p>
      <a class="backbutton" id="backbutton" href="/static/app/$your_app_name$/dashboards">
        <img alt="Dashboads link" src="/static/app/$your_app_name$/backbutton.png"/>
      </a>
    </p>
</html> 
0 Karma

dbcase
Motivator

Hmmmm maybe... Not quite sure I understand.....

Lemme add some additional detail....

I have a HTML dashboard that is a Dashboard Menu where a number of dashboards are listed (a href="dashboard name" type of format), when you click on one it will take you to that dashboard. When the user is done with that dashboard and wants to go back to the Dashboard Menu there isn't an easy way to do that. Does that help?

0 Karma

rjthibod
Champion

OK, assuming you are not doing anything to alter the history, you should be able to go back in the history with something like this.

<button type="button" onclick="javascript:history.back()">Back</button>

0 Karma

dbcase
Motivator

Hi Rjthibod,

Thanks! This sounds like what I'm looking for, but, I'm not quite sure how to go about using it?

Would you mind providing a sample? Sorry for the newbie question 🙂

0 Karma

rjthibod
Champion

You should be able to insert this element in an existing container or <div> element unless you are doing something very odd. IYou will need to share some of your html if you need more help.

<div> 
  ... 
  <button id="backBtn" name="backBtn" class="btn btn-primary" onclick="javascript:history.back()"><span>Back to Dashboards</span></button>
  ...
</div>
0 Karma

dbcase
Motivator

well the Dashboard menu (where you start) is HTML, the dashboard that the menu calls is XML which is where the button needs to go

0 Karma

dbcase
Motivator

I ended up taking your solution and modifying it a bit, it looks like this now

<html>
      <h1>
     <p>
       <a href="https://icontrol.splunkcloud.com/en-US/app/search/dashboard_of_dashboards"><div align="right">Return to the Dashboard Menu</div></a>&lt;br/&gt;</br>

     </p>
      </h1>
 </html> 
0 Karma

rjthibod
Champion

Great. Glad it was successful.

0 Karma

rjthibod
Champion

Where on the Simple XML do you want the button?

Without using JavaScript, you can only insert a raw HTML element inside a <panel> element.

0 Karma

dbcase
Motivator

I ended up putting it here

<form refresh="0">



  <label>Beta Reports - Summary</label>



  <fieldset submitButton="false" autoRun="true">

   <html>
      <h1>
     <p>
       <a href="https://icontrol.splunkcloud.com/en-US/app/search/dashboard_of_dashboards"><div align="right">Return to the Dashboard Menu</div></a>&lt;br/&gt;</br>

     </p>
      </h1>
 </html> 

    <input type="time" token="field1" searchWhenChanged="true">
      <label>Select a Time Period</label>
      <default>
        <earliest>-6h</earliest>
        <latest>now</latest>
      </default>
    </input>
0 Karma

dbcase
Motivator

The header is ignored but thats ok, I'll just change the font size

0 Karma

rjthibod
Champion

No problem. Give me a few secs.

P.S. Am I correct to think your avatar suggest you are a student/alum/employee of Clemson?

0 Karma

dbcase
Motivator

🙂 . 86 Grad (now I'm old too 🙂 )

0 Karma

rjthibod
Champion

Go tigers. I'm an adopted fan. Soon to be wife and family are alums/fans.

0 Karma

dbcase
Motivator

Congrats! Adopted fans are great!

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...