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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...