Dashboards & Visualizations

Navigation href attribute with default attribute

shrirangphadke
Path Finder

Hi,

I am trying to create a navigation menu with HTML href attribute as follows:

<nav color="3075AB">
    <collection label="My Label">
        <a href="/app/myappname/firewall__overview" default='true'>Overview</a>
          ...

But when I click on 'myappname' I am redirected to alerts page instead of myapp default page which is firewall__overview.

When I specify same page with View XML tag my default page becomes firewall__overview which is expected behavior.

  <nav color="3075AB">
        <collection label="My Label">
            <view name="firewall__overview" default="true"/>
              ...

So I am wondering whether default tag does not work with href attribute.
If I want to make it work with href attribute is there any workaround?

If that is not possible then is there any way to override View name in Navigation menu?
Please help.

0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

Unlike the view tag, the a tag does not have a default attribute. See the RelaxNG schema for nav.xml:

...
View = element view {
    (
        attribute name { text }
        | (
            attribute source { "all" | "unclassified" }
            & attribute match { text }?
        )
    )
    & attribute default { text }?
}

A = element a {
    attribute href { text }
    & text
}
...

Conversely, the view tag doesn't have a label attribute or plain xml text to override the displayed label 😞

View solution in original post

martin_mueller
SplunkTrust
SplunkTrust

Unlike the view tag, the a tag does not have a default attribute. See the RelaxNG schema for nav.xml:

...
View = element view {
    (
        attribute name { text }
        | (
            attribute source { "all" | "unclassified" }
            & attribute match { text }?
        )
    )
    & attribute default { text }?
}

A = element a {
    attribute href { text }
    & text
}
...

Conversely, the view tag doesn't have a label attribute or plain xml text to override the displayed label 😞

shrirangphadke
Path Finder

Hi @martin_mueller,

Thanks! okey, I will have to figure out some other workaround to it 😞
Anyways thanks for your help!

0 Karma

bmacias84
Champion

The name attribute is not used in the nav bar. The nav bar use the label tag within the dashboard xml to display within the Navigation.

<dashboard showsource="false" script="contents.js" stylesheet="contents.css">
    <label>Examples FooBar</label>
</dashboard>

Example FooBar will be the text with the nav bar.

shrirangphadke
Path Finder

Hi @bmacias,

Thanks for your answer,

Actually the problem I am trying to solve is as follows:

My page label is

<label>Firewall-Alerts</label>

On some other page I have:

<label>Firewall-Overview</label>

But on navigation menu I want to represent navigation as:

Firewall
   Alerts
   Overview

Thus I want to override label in Navigation to make it:

Firewall-Alerts --- Alerts
Firewall-Overview -- Overview

Is there any way to achieve this?

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, ...