Dashboards & Visualizations

Edit the default dashboard template

zscgeek
Path Finder

Is there a way to edit the default dashboard template that is used for the simple xml?

I am embedding the splunk UI inside my web application and need to use a custom set of chrome modules (replacements for appbar/accountbar etc). I have been able to edit all the standard views (dashboard,charting,flashtimeline) but if the user creates their own dashboard it is using the simple xml format and all the default splunk UI bits come back when they navigate to their new dashboard.

What I would like to do is modify the template to always use my alt chrome instead of the splunk defaults.

1 Solution

zscgeek
Path Finder

Ok, did some digging and it looks like the rendering / parsing of simple XML modules is done in $SPLUNK_HOME/lib/python2.6/site-packages/splunk/appserver/mrsparkle/lib/view/*

Specifically form.py and dashboard.py have a toObject() method that builds the object tree of the final resulting module. For example here is the start of the module for form searches:

    def toObject(self):

    # build the standard dashboard view preamble
    output = {
        'isVisible': self.isVisible,
        'label': self.label,
        'onunloadCancelJobs': self.onunloadCancelJobs,
        'autoCancelInterval': self.autoCancelInterval,
        'stylesheet': self.stylesheet,
        'template': self.template,
        'objectMode': self.objectMode,

        'modules': [
            {
                'className': 'AccountBar',
                'layoutPanel': 'appHeader'
            },
            {
                'className': 'AppBar',
                'layoutPanel': 'navigationHeader'
            },

This then is rendered into the internal XML later on. Sadly I don't see any supported way to edit this from inside an application so any edits here should be done at your own risk (or really not done at all).

alt text

View solution in original post

zscgeek
Path Finder

Ok, did some digging and it looks like the rendering / parsing of simple XML modules is done in $SPLUNK_HOME/lib/python2.6/site-packages/splunk/appserver/mrsparkle/lib/view/*

Specifically form.py and dashboard.py have a toObject() method that builds the object tree of the final resulting module. For example here is the start of the module for form searches:

    def toObject(self):

    # build the standard dashboard view preamble
    output = {
        'isVisible': self.isVisible,
        'label': self.label,
        'onunloadCancelJobs': self.onunloadCancelJobs,
        'autoCancelInterval': self.autoCancelInterval,
        'stylesheet': self.stylesheet,
        'template': self.template,
        'objectMode': self.objectMode,

        'modules': [
            {
                'className': 'AccountBar',
                'layoutPanel': 'appHeader'
            },
            {
                'className': 'AppBar',
                'layoutPanel': 'navigationHeader'
            },

This then is rendered into the internal XML later on. Sadly I don't see any supported way to edit this from inside an application so any edits here should be done at your own risk (or really not done at all).

alt text

ftk
Motivator

I'm not 100% sure, but I think this should send you down the right path. Have a look at $SPLUNK_HOME/share/splunk/search_mrsparkle/templates/view/ and possibly $SPLUNK_HOME/share/splunk/search_mrsparkle/templates/viewmaster/.

Especially $SPLUNK_HOME/share/splunk/search_mrsparkle/templates/view/dashboard.html looks promising. It references $SPLUNK_HOME/share/splunk/search_mrsparkle/templates/layout/view.html which appears to be where you need to do some customization to change the template.

Hope this works for ya.

Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...