Dashboards & Visualizations

What should I add to require in my HTML dashboard in order to import my custom JS script?

Escher
Engager

I have a custom JS script located under appserver/static/components within my Splunk app. What should I add to require in my HTML dashboard in order to make this custom script callable from within my dashboard?

stoutrw
Path Finder

So it should look something like this:

Javascript: my_script.js

require([
   'underscore',
   'jquery',
   'backbone',
   '../app/my_app/components/myComponent',
   'splunkjs/mvc',
   'splunkjs/mvc/simplexml/ready!'
], function (_,$,Backbone, myComponent, mvc) {

#Use your component
var my_comp = new myComponent();
my_comp.doStuff();

});

XML:

<form script="my_script.js">
...
</form>
0 Karma

stoutrw
Path Finder

@Escher Is this what you were looking for?

0 Karma

niketn
Legend

What kind of Javascript? Splunk JS Extension or Completely custom Javascript like jQuery?

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma

Escher
Engager

My script is a SplunkJS extension built off Backbone.View

0 Karma

niketn
Legend

Have you referred to following example of adding a Sankey diagram to HTML dashboard?
http://dev.splunk.com/view/webframework-tutorials/SP-CAAAEN6

____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
Get Updates on the Splunk Community!

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...

Combine Multiline Logs into a Single Event with SOCK: a Step-by-Step Guide for ...

Combine multiline logs into a single event with SOCK - a step-by-step guide for newbies Olga Malita The ...

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 ...