I would like to put the current username in the app navigation menu. New on Splunk and I don't understand everything.
I guess one way is to use a parameter in the default.xml file. For example:
<param name="search">search | rest /services/authentication/current-context | table username</param>
Found on this post:
But I don't know how to set a view name dynamically.
If someone can help me, it will be pretty cool (even with a JS solution if there's great explications ^^)
I work for a customer that want this in the nav menu =s (For me it's useless...)
I believe The requirement is to display it in a custom dashboard and fetch similar data related to the username
For use this, the command must be like this only:
| rest /services/authentication/current-context | table username
Then, you put this inside your XML.
Finally, dealing with JS I find a solution:
I get the last 'a' tag, get the parent (li), duplicate and change children attribute I want. Then I append it to the last
var $str = $( ".nav-item.shared-appbar-navitem.nav-item-" ).find($('a[title="DECONNEXION"]')); var $li=$str.parent(); $topList=$li.clone() $topList.children().attr('href',""); $topList.children().attr('title',"USERNAME"); $topList.children().text(nameShow); $ul=$li.parent(); $topList.appendTo($ul); </li>
I Could not paste this script in the dashboard and it gives an error, can someone give me steps on how to include this in the dashboard