I have a fair idea that `depends="$token$"` can be used to display or hide the panel. My requirement is that I get the list of roles for a user, via a Javascript file, and load it onto tokens present on the dashboard.
Now, these tokens will be set to "null" when the dashboard initially loads, and from the script, set to the role value.
The dashboard itself is filled with panels which I need to conditionally display based on the roles returned from the search.
Here is some code I have put together:
trying to render based on token setting from JS |
I also have CSS attached to the dashboard
And, here is the JS code:
require([
"jquery",
"splunkjs/mvc",
"splunkjs/mvc/simplexml/ready!"
], function(
$,
mvc
) {
var tokens = mvc.Components.get("default");
var permissionGrant = "power";
tokens.set("role1", permissionGrant);
});
So, summarizing, the JS will set the token "role1" with a value from a search(In the example I have hardcoded the value).
The panel will then make a request and get the relevant HTML page and render it.
Thanks in advance.
Splunk for Life :)
↧