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.

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Think Like an Architect: Introducing the Splunk Certified Cybersecurity Defense ...

In cybersecurity, defenders respond to threats. Architects design the systems that stop them.    As ...

Best Practices: Splunk auto adjust pipeline queue

When you enable autoAdjustQueue in Splunk, maxSize should be understood as the queue size Splunk starts with ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...