Splunk Search

Further customize setup.xml

klee310
Communicator

Are there any way to further customize the setup.xml file for my app?

I'm trying to include some radio-buttons, or drop-down list - populated with search results.

I can see similar content-layout styles in

Splunk > Manager > Access controls > Roles > Add New

... but i can't seem to figure this out in my setup.xml file. Similar tags from authentication_roles.xml doesn't seem to work in my setup.xml

Thanks

0 Karma
1 Solution

LukeMurphey
Champion

Setup is fairly limited in what you can do using the provided API. However, you can embed your own style sheets and JavaScript which you can use to customize the UI. A great way to customize the UI is to use jQuery plugins.

Below is an example snippet from a setup.xml file that loads custom JavaScript and stylesheet (using two helper functions). Note that the application in the example is hardcoded as "SomeSplunkApp" and the resources are stored in the appserver/static within the application (in this case: $SPLUNK_HOME/etc/apps/SomeSplunkApp/appserver/static).

// Load JavaScript
function addJavascript( filename ){
   var script = $("<script>");
   script.attr({type: 'text/javascript', src: filename});
   $("head").append( script );
}

// Load a stylesheet
function addStylesheet( filename ){
   // For Internet Explorer, use createStyleSheet
   if( document.createStyleSheet ){
      document.createStyleSheet(filename);
   }
   // For everyone else
   else{
       var link = $("<link>");
       link.attr({type: 'text/css',rel: 'stylesheet', href: filename});
       $("head").append( link );
    }
}

$(document).ready(function(){
   // Load some custom stylesheet and JavaScript...
   addStylesheet('/static/app/SomeSplunkApp/my_custom_stylsheet.css');
   addJavascript('/static/app/SomeSplunkApp/jquery.some_plugin.js');
});

</script>

View solution in original post

LukeMurphey
Champion

Setup is fairly limited in what you can do using the provided API. However, you can embed your own style sheets and JavaScript which you can use to customize the UI. A great way to customize the UI is to use jQuery plugins.

Below is an example snippet from a setup.xml file that loads custom JavaScript and stylesheet (using two helper functions). Note that the application in the example is hardcoded as "SomeSplunkApp" and the resources are stored in the appserver/static within the application (in this case: $SPLUNK_HOME/etc/apps/SomeSplunkApp/appserver/static).

// Load JavaScript
function addJavascript( filename ){
   var script = $("<script>");
   script.attr({type: 'text/javascript', src: filename});
   $("head").append( script );
}

// Load a stylesheet
function addStylesheet( filename ){
   // For Internet Explorer, use createStyleSheet
   if( document.createStyleSheet ){
      document.createStyleSheet(filename);
   }
   // For everyone else
   else{
       var link = $("<link>");
       link.attr({type: 'text/css',rel: 'stylesheet', href: filename});
       $("head").append( link );
    }
}

$(document).ready(function(){
   // Load some custom stylesheet and JavaScript...
   addStylesheet('/static/app/SomeSplunkApp/my_custom_stylsheet.css');
   addJavascript('/static/app/SomeSplunkApp/jquery.some_plugin.js');
});

</script>

klee310
Communicator

wow, thanks for the reply. this looks more complicated than it has to be. i guess i'll just leave this feature alone for now...

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...