Dashboards & Visualizations

HTML as default view in app - How do I control the label in navigation?

splunkian
Path Finder

My default view in an app was converted to HTML. I want the navigation to show 'Overview' (uppercase O). The default id of my html dashboard is 'overview' so it displays as overview (lowercase) in the navigation when I put the following into my default.xml:

<view name="overview" default='true' />

Also, adding <a href='overview'>Overview</a> works, but then it duplicates whats defined in the default view above as I don't think I can define this as being default when using the <a> tag.

Ultimately, how do I define a default view for my HTML dashboard and tell Splunk that I want it displayed as 'Overview' and not 'overview'?

I'm sure its something obvious that I'm overlooking, so any help is greatly appreciated.

0 Karma
1 Solution

rsennett_splunk
Splunk Employee
Splunk Employee

When you create a Dashboard or View (the two can be considered synonymous in Splunk 6.0) the id of your dashboard is equal to the file name, and has nothing to do with the actual title of the view/dashboard.

You can see this really clearly if you do a science experiment and create a new dashboard, make the title (not the id) unique and then convert it to HTML. You will see that in the new HTML file there are two occurrences of the title (one is an H1 tag and the other an H2 I believe) but your Id is nowhere to be found in the file, because the id is the name of the file.

So when your dashboard was converted to html the file:

$SPLUNK_HOME/etc/apps/yourapp/local/data/ui/views/overview.xml

was converted to
$SPLUNK_HOME/etc/apps/yourapp/local/data/ui/html/overview.html

So, if you have access you could just rename the file with an initial cap and be done with it.

However, this is totally legitimate syntax for the default.xml file and works just fine:

<a href="overview.html" default='true'>Overview</a>

You don't need to add it twice... just with the a tag is fine.

With Splunk... the answer is always "YES!". It just might require more regex than you're prepared for!

View solution in original post

rsennett_splunk
Splunk Employee
Splunk Employee

When you create a Dashboard or View (the two can be considered synonymous in Splunk 6.0) the id of your dashboard is equal to the file name, and has nothing to do with the actual title of the view/dashboard.

You can see this really clearly if you do a science experiment and create a new dashboard, make the title (not the id) unique and then convert it to HTML. You will see that in the new HTML file there are two occurrences of the title (one is an H1 tag and the other an H2 I believe) but your Id is nowhere to be found in the file, because the id is the name of the file.

So when your dashboard was converted to html the file:

$SPLUNK_HOME/etc/apps/yourapp/local/data/ui/views/overview.xml

was converted to
$SPLUNK_HOME/etc/apps/yourapp/local/data/ui/html/overview.html

So, if you have access you could just rename the file with an initial cap and be done with it.

However, this is totally legitimate syntax for the default.xml file and works just fine:

<a href="overview.html" default='true'>Overview</a>

You don't need to add it twice... just with the a tag is fine.

With Splunk... the answer is always "YES!". It just might require more regex than you're prepared for!

splunkian
Path Finder

Yes, I was very careful with the syntax. Although mine was the first entry, so that may very well have something to do with it. I'll probably experiment and see if moving it to the end fixes it. Thanks again.

0 Karma

rsennett_splunk
Splunk Employee
Splunk Employee

Also... I think you might want to check your syntax very carefully, because this is the "default" behavior. If no view is marked as default, then the first one listed in default.xml becomes the default. maybe you had a typo and so it ran back to the "view" rather than your <a> tag.

With Splunk... the answer is always "YES!". It just might require more regex than you're prepared for!
0 Karma

rsennett_splunk
Splunk Employee
Splunk Employee

That's very strange. I tried it and it worked fine for me. One interesting thing to note, is that Mine happened to be the LAST entry in the file... As for the documentation, I believe the example is here: http://docs.splunk.com/Documentation/Splunk/6.0/AdvancedDev/BuildNavigation#Build_the_navigation_XML but it could definitely be more specific.

With Splunk... the answer is always "YES!". It just might require more regex than you're prepared for!
0 Karma

splunkian
Path Finder

The suggestion to use default='true' in the a tag did not work, Splunk still bypassed the view and went to the next view available within default.xml. However, the suggestion to rename the html file did work, so I will accept your answer. It is unfortunate that there does not seem to be some documented way to define the label of an HTML dashboard. Nonetheless, thanks for the suggestions.

0 Karma

sideview
SplunkTrust
SplunkTrust

Well normally the app navigation menu gets the label from the <label> node which is generally sitting at the top level of the view, just under the <view> tag.

If converting your view to HTML means using someting like the Sideview HTML module to embed lots of HTML, there will still be a <label> node to edit. And if there isn't one just add one.

On the other hand if "converting your view to HTML" means something fancier or involving the new Splunk 6 framework, there's probably some other official way of specifying what the view label should be.

0 Karma

splunkian
Path Finder

I should have clarified - it is the Splunk 6 simple XML to HTML conversion. I had assumed it would be defined somewhere in the HTML/Javascript, but couldn't find anything. I'm surprised I could find no official answer in the docs.

0 Karma

Michael_Wilde
Splunk Employee
Splunk Employee

IKR!.. this should be in the docs... Submitting.

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...