<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Get current app name with Javascript (Splunk.util.getCurrentApp() fails) in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Get-current-app-name-with-Javascript-Splunk-util-getCurrentApp/m-p/128292#M7590</link>
    <description>&lt;P&gt;Remember to require the right objects. If I'm not mistaken, it should be &lt;CODE&gt;"splunkjs/mvc/utils"&lt;/CODE&gt; in the array and &lt;CODE&gt;utils&lt;/CODE&gt; in the function, so a bit like this in your js:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
'splunkjs/mvc/simplexml/ready!',
"splunkjs/mvc/utils",
"jquery"
],
function(
    $,
    utils
    ) {
        var $ = require("jquery");
        ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 27 May 2015 10:12:10 GMT</pubDate>
    <dc:creator>jeffland</dc:creator>
    <dc:date>2015-05-27T10:12:10Z</dc:date>
    <item>
      <title>Get current app name with Javascript (Splunk.util.getCurrentApp() fails)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Get-current-app-name-with-Javascript-Splunk-util-getCurrentApp/m-p/128291#M7589</link>
      <description>&lt;P&gt;Is there a way to get the current app name with Javascript? &lt;/P&gt;

&lt;P&gt;I tried to use Splunk.util.getCurrentApp() from the console, but it fails. Reading the source code, it should return an attribute of the document body that does not exists. This happens also with the Search app. Furthermore, if I try to use it in my js code, JS gives me error because Splunk var is undefined.&lt;/P&gt;</description>
      <pubDate>Wed, 27 May 2015 09:51:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Get-current-app-name-with-Javascript-Splunk-util-getCurrentApp/m-p/128291#M7589</guid>
      <dc:creator>marco_sulla</dc:creator>
      <dc:date>2015-05-27T09:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Get current app name with Javascript (Splunk.util.getCurrentApp() fails)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Get-current-app-name-with-Javascript-Splunk-util-getCurrentApp/m-p/128292#M7590</link>
      <description>&lt;P&gt;Remember to require the right objects. If I'm not mistaken, it should be &lt;CODE&gt;"splunkjs/mvc/utils"&lt;/CODE&gt; in the array and &lt;CODE&gt;utils&lt;/CODE&gt; in the function, so a bit like this in your js:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require([
'splunkjs/mvc/simplexml/ready!',
"splunkjs/mvc/utils",
"jquery"
],
function(
    $,
    utils
    ) {
        var $ = require("jquery");
        ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 27 May 2015 10:12:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Get-current-app-name-with-Javascript-Splunk-util-getCurrentApp/m-p/128292#M7590</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2015-05-27T10:12:10Z</dc:date>
    </item>
    <item>
      <title>Re: Get current app name with Javascript (Splunk.util.getCurrentApp() fails)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Get-current-app-name-with-Javascript-Splunk-util-getCurrentApp/m-p/128293#M7591</link>
      <description>&lt;P&gt;Thank you, I used that to make the code independent from app name (if I want to create a production and a development app, or an xml and a django app):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;var app_name;

require(["splunkjs/mvc/utils"], function (SplunkUtil) {
    "use strict";

    app_name = SplunkUtil.getCurrentApp();

    var libs = [
        "../app/" + app_name + "somelibrary", 
        // other dependences
    ];

    require(libs, function (SomeLibrary, /* other objects */) {
        // code block
    });
});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 28 May 2015 15:59:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Get-current-app-name-with-Javascript-Splunk-util-getCurrentApp/m-p/128293#M7591</guid>
      <dc:creator>marco_sulla</dc:creator>
      <dc:date>2015-05-28T15:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Get current app name with Javascript (Splunk.util.getCurrentApp() fails)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Get-current-app-name-with-Javascript-Splunk-util-getCurrentApp/m-p/128294#M7592</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am having a similar kind of issue with my lookup editor app customization. I have the following js code which gets the current app name using the Splunk Utils packages and I use the result to replace the hardcoded app name "luep" in the rest of the code. However in places where the path name with the app folder comes like in the require.config and define sections of the below code when I replace the app_name variable which contains the app name it doesn't replace as expected and gives an error saying undefined. Would you be able to help with this?&lt;/P&gt;

&lt;P&gt;var app_name;&lt;/P&gt;

&lt;P&gt;require(["splunkjs/mvc/utils"], &lt;BR /&gt;
function (SplunkUtil) &lt;BR /&gt;
   {&lt;BR /&gt;
    app_name = SplunkUtil.getCurrentApp();      &lt;/P&gt;

&lt;P&gt;});&lt;BR /&gt;
require.config({&lt;BR /&gt;&lt;BR /&gt;
    paths:&lt;BR /&gt;
     {&lt;BR /&gt;
         datatables:"../app/"+app_name"/js/lib/DataTables/js/jquery.dataTables",  //when replaced here it says undefined.&lt;BR /&gt;
         bootstrapDataTables:"../app/luep/js/lib/DataTables/js/dataTables.bootstrap",&lt;BR /&gt;
         text:"../app/luep/js/lib/text",&lt;BR /&gt;
         console:"../app/luep/js/lib/console"&lt;BR /&gt;
     },&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;shim:
 {
     bootstrapDataTables:
      {
          deps:
           ["datatables"]
      }
 }
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;define(["underscore","backbone","models/SplunkDBase","collections/SplunkDsBase","splunkjs/mvc","jquery","splunkjs/mvc/simplesplunkview","text!../app/luep/js/templates/LookupList.html",&lt;BR /&gt;
        "bootstrapDataTables","util/splunkd_utils","bootstrap.dropdown","css!../app/luep/css/LookupList.css","css!../app/luep/css/SplunkDataTables.css"],&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    function(n,m,i,a,g,j,l,k,d,f)
    {
        var h=a.extend(
        {
            url:"apps/local?count=-1&amp;amp;search="+app_name,
            initialize:
            function()
            {
                a.prototype.initialize.apply(this,arguments)
            }
        });

        var o=a.extend(
        {
            url:"data/transforms/lookups?count=-1&amp;amp;search="+app_name,
            initialize:
            function()
            {
                a.prototype.initialize.apply(this,arguments)
            }
        });

        var b=a.extend(
        {
            url:"/servicesNS/"+Splunk.util.getConfigValue("USERNAME")+"/-/data/lookup-table-files?count=-1&amp;amp;search="+app_name,
            initialize:
            function()
            {
                a.prototype.initialize.apply(this,arguments)
            }
        });

        var c=a.extend(
        {
            url:"/servicesNS/nobody/-/storage/collections/config?count=-1&amp;amp;search="+app_name,
            initialize:function()
            {
                a.prototype.initialize.apply(this,arguments)
            }
        });
        var e=l.extend(
        {
            className:"LookupListView",
            defaults:
            {
                change_dropdown_titles:true
            },
            initialize:function()
            {
                this.options=n.extend({},this.defaults,this.options);
                this.change_dropdown_titles=this.options.change_dropdown_titles;
                this.filter_app=null;
                this.filter_type=null;
                this.filter_scope=null;
                this.filter_text=null;
                this.applied_filter=null;
                this.apps=null;
                this.data_table=null;
                this.retain_state=false;
                this.csv_lookups=new b();
                this.csv_lookups.on("reset",this.gotCSVLookups.bind(this),this);
                this.csv_lookups.fetch(
                {
                    success:function()
                    {
                        console.info("Successfully retrieved the CSV lookup files")
                    },
                    error:function()
                    {
                        console.error("Unable to fetch the CSV lookup files")
                    }
                });
                this.kv_lookups_supported=true;
                this.getKVLookups();
                this.apps=new h();
                this.apps.on("reset",this.gotApps.bind(this),this);
                this.apps.fetch(
                {
                    success:function()
                    {
                        console.info("Successfully retrieved the list of applications")
                    },
                    error:function()
                    {
                        console.error("Unable to fetch the apps")
                    }
                });
                this.lookup_transforms=new o();
                this.lookup_transforms.on("reset",this.gotLookupTransforms.bind(this),this);
                this.lookup_transforms.fetch(
                {
                    success:function()
                    {
                        console.info("Successfully retrieved the list of lookup transforms")
                    },
                    error:function()
                    {
                        console.error("Unable to fetch the lookup transforms")
                    }
                })
            },
            events:
            {
                "click .type-filter &amp;gt; .dropdown-menu &amp;gt; li &amp;gt; a":"onClickTypeFilter",
                "click .app-filter &amp;gt; .dropdown-menu &amp;gt; li &amp;gt; a":"onClickAppFilter",
                "click .scope-filter &amp;gt; .btn":"onClickScopeFilter",
                "change #free-text-filter":"applyFilter",
                "keyup #free-text-filter":"goFilter",
                "keypress #free-text-filter":"goFilter",
                "click .disable-kv-lookup":"openDisableKVLookupDialog",
                "click #disable-this-lookup":"disableLookup",
                "click .enable-kv-lookup":"enableLookup"
            },
            getKVLookups:function()
            {
                this.kv_lookups=new c();
                this.kv_lookups.on("reset",this.gotKVLookups.bind(this),this);
                this.kv_lookups.fetch(
                {
                    success:function()
                    {
                        console.info("Successfully retrieved the KV store lookup files")
                    },
                    error:function()
                    {
                        console.error("Unable to fetch the KV store lookup files")
                    },
                    complete:function(p,q)
                    {
                        if(p.status==404)
                        {
                            this.hideKVStoreOptions();
                            this.kv_lookups_supported=false
                        }
                    }
                    .bind(this)
                }
                )
            },
            hideKVStoreOptions:function()
            {
                j(".show-kv-supported-only",this.$el).hide();
                j(".show-kv-unsupported-only",this.$el).show()
            },
            setFilterText:function(r,q,p){if(typeof p==="undefined"){p="All"}if(this.change_dropdown_titles){if(p){j("."+r+" &amp;gt; .dropdown-toggle").html(q+": "+p+'&amp;lt;span class="caret"&amp;gt;&amp;lt;/span&amp;gt;')}else{j("."+r+" &amp;gt; .dropdown-toggle").html(q+'&amp;lt;span class="caret"&amp;gt;&amp;lt;/span&amp;gt;')}}},doFilter:function(t,s,r,q){if(typeof q=="undefined"){q=true}var p=r;if(r===null){p="All"}this.setFilterText(t,s,p);j("."+t+" &amp;gt; .dropdown-menu &amp;gt; li &amp;gt; a").each(function(){if(j(this).text()===p){j("i",this).removeClass("hide")}else{j("i",this).addClass("hide")}});if(q){this.applyFilter()}},onClickTypeFilter:function(q){var p=j(q.target).text();this.setTypeFilter(p)},setTypeFilter:function(p){if(p==="All"){this.filter_type=null}else{this.filter_type=p}this.doFilter("type-filter","Type",p)},onClickScopeFilter:function(q){var p=j(q.target).text();this.setScopeFilter(p)},setScopeFilter:function(p){var q="All";if(p==="All"||p===null){this.filter_scope=null}else{if(p.indexOf("Global")&amp;gt;=0){this.filter_scope="nobody";q="Global"}else{this.filter_scope=Splunk.util.getConfigValue("USERNAME");q="Mine"}}j(".scope-filter &amp;gt; .btn").each(function(){if(j(this).text()===q){j(this).addClass("active")}else{j(this).removeClass("active")}});this.applyFilter()},onClickAppFilter:function(q){var p=j(q.target).text();this.setAppFilter(p)},setAppFilter:function(p){if(p==="All"){this.filter_app=null}else{this.filter_app=p}this.doFilter("app-filter","App",p)},enableLookup:function(r){var s=j(r.target).data("name");var q=j(r.target).data("namespace");var p=j(r.target).data("owner");j.ajax({url:f.fullpath(["/servicesNS","nobody",q,"storage/collections/config",s,"enable"].join("/")),type:"POST",success:function(){console.info("KV store lookup enabled")}.bind(this),complete:function(t,u){if(t.status==403){console.info("Inadequate permissions to enable collection")}else{this.retain_state=true;this.getKVLookups()}}.bind(this),error:function(t,v,u){if(t.status!=403){console.info("KV store collection enablement failed")}}.bind(this)});return false},disableLookup:function(r){var s=j(r.target).data("name");var q=j(r.target).data("namespace");var p=j(r.target).data("owner");j.ajax({url:f.fullpath(["/servicesNS","nobody",q,"storage/collections/config",s,"disable"].join("/")),type:"POST",success:function(){console.info("KV store lookup disabled")}.bind(this),complete:function(t,u){if(t.status==403){console.info("Inadequate permissions to disable collection")}else{j("#disable-lookup-modal",this.$el).modal("hide");this.retain_state=true;this.getKVLookups()}}.bind(this),error:function(t,v,u){if(t.status!=403){console.info("KV store collection disablement failed")}}.bind(this)})},openDisableKVLookupDialog:function(r){var s=j(r.target).data("name");var q=j(r.target).data("namespace");var p=j(r.target).data("owner");j("#disable-this-lookup",this.$el).data("name",s);j("#disable-this-lookup",this.$el).data("namespace",q);j("#disable-this-lookup",this.$el).data("owner",p);j(".disable-lookup-name",this.$el).text(s);j(".disable-lookup-namespace",this.$el).text(q);j(".disable-lookup-owner",this.$el).text(p);j("#disable-lookup-modal",this.$el).modal();return false},goFilter:function(q){var p=q.keyCode||q.which;if(p==13){q.preventDefault()}this.applyFilter()},applyFilter:function(){var p=""+this.filter_type+":"+this.filter_app+":"+this.filter_scope+":"+j("#free-text-filter").val();if(p===this.applied_filter){return}this.applied_filter=p;if(this.filter_type!==null){this.data_table.columns(1).search("^"+this.filter_type+"$",true)}else{this.data_table.columns(1).search("")}if(this.filter_app!==null){this.data_table.columns(2).search("^"+this.filter_app+"$",true)}else{this.data_table.columns(2).search("")}if(this.filter_scope!==null){this.data_table.columns(3).search("^"+this.filter_scope+"$",true)}else{this.data_table.columns(3).search("")}this.filter_text=j("#free-text-filter").val();this.data_table.columns(0).search(j("#free-text-filter").val()).draw()},getAppDescriptionFromName:function(p){for(var q=0;q&amp;lt;this.apps.models.length;q++){if(this.apps.models[q].entry.attributes.name===p){return this.apps.models[q].entry.associated.content.attributes.label}}return p},gotCSVLookups:function(){this.renderLookupsList()},gotKVLookups:function(){this.renderLookupsList()},gotApps:function(){this.renderLookupsList()},gotLookupTransforms:function(){this.renderLookupsList()},endsWith:function(q,p){return q.indexOf(p,q.length-p.length)!==-1},isSupportedLookup:function(p){if(this.endsWith(p.name,".default")){return false}else{if(p.name===".DS_Store"){return false}else{return true}}},getLookupsCount:function(){var p=this.getLookupsJSON();if(p){return p.length}else{return 0}},getLookupsJSON:function(){var q=[];var p=null;var r=null;for(var s=0;s&amp;lt;this.csv_lookups.models.length;s++){if(this.csv_lookups.models[s].entry.acl.attributes.sharing==="global"||this.csv_lookups.models[s].entry.acl.attributes.sharing==="app"){r="nobody"}else{r=this.csv_lookups.models[s].entry.acl.attributes.owner}p={name:this.csv_lookups.models[s].entry.attributes.name,author:this.csv_lookups.models[s].entry.attributes.author,updated:this.csv_lookups.models[s].entry.attributes.updated,namespace:this.csv_lookups.models[s].entry.acl.attributes.app,owner:this.csv_lookups.models[s].entry.acl.attributes.owner,type:"csv",sharing:this.csv_lookups.models[s].entry.acl.attributes.sharing,endpoint_owner:r};if(!this.endsWith(this.csv_lookups.models[s].entry.attributes.name,".kmz")){q.push(p)}}for(var s=0;s&amp;lt;this.kv_lookups.models.length;s++){p={name:this.kv_lookups.models[s].entry.attributes.name,author:this.kv_lookups.models[s].entry.attributes.author,updated:this.kv_lookups.models[s].entry.attributes.updated,namespace:this.kv_lookups.models[s].entry.acl.attributes.app,owner:this.kv_lookups.models[s].entry.acl.attributes.owner,type:"kv",endpoint_owner:this.kv_lookups.models[s].entry.acl.attributes.owner,disabled:this.kv_lookups.models[s].entry.associated.content.attributes.disabled};q.push(p)}return q.filter(this.isSupportedLookup.bind(this))},getAppsJSON:function(t){if(typeof t==="undefined"){t=true}if(!this.apps){return[]}var s=[];var p=null;for(var r=0;r&amp;lt;this.apps.models.length;r++){p={name:this.apps.models[r].entry.attributes.name,label:this.apps.models[r].entry.associated.content.attributes.label};if(t){for(var q=0;q&amp;lt;this.csv_lookups.models.length;q++){if(this.csv_lookups.models[q].entry.acl.attributes.app===this.apps.models[r].entry.attributes.name){s.push(p);break}}for(var q=0;q&amp;lt;this.kv_lookups.models.length;q++){if(this.kv_lookups.models[q].entry.acl.attributes.app===this.apps.models[r].entry.attributes.name){s.push(p);break}}}else{s.push(p)}}var s=n.uniq(s,function(w,v,u){return w.name});return s},getLookupTransformsJSON:function(){if(!this.lookup_transforms){return[]}var p=[];for(var q=0;q&amp;lt;this.lookup_transforms.models.length;q++){if(this.lookup_transforms.models[q].entry.associated.content.attributes.type=="kvstore"){p.push({transform:this.lookup_transforms.models[q].entry.attributes.name,collection:this.lookup_transforms.models[q].entry.associated.content.attributes.collection})}else{if(this.lookup_transforms.models[q].entry.associated.content.attributes.type=="file"){p.push({transform:this.lookup_transforms.models[q].entry.attributes.name,filename:this.lookup_transforms.models[q].entry.associated.content.attributes.filename})}}}return p},getLookupTransform:function(q){var p=this.getLookupTransformsJSON();for(var r=0;r&amp;lt;p.length;r++){if(p[r].collection===q){return p[r].transform}if(p[r].filename===q){return p[r].transform}}},renderLookupsList:function(q){if(typeof q=="undefined"){q=this.retain_state}var p=j("#lookup-list-template",this.$el).text();j("#content",this.$el).html(n.template(p,{lookups:this.getLookupsJSON(),apps:this.getAppsJSON(),transforms:this.getLookupTransformsJSON(),kv_lookups_supported:this.kv_lookups_supported,getAppDescriptionFromName:this.getAppDescriptionFromName.bind(this),getLookupTransform:this.getLookupTransform.bind(this),filter_app:this.filter_app,filter_type:this.filter_type,filter_scope:this.filter_scope,filter_text:this.filter_text,lookups_count:this.getLookupsCount()}));this.data_table=j("#table",this.$el).DataTable({iDisplayLength:25,bLengthChange:false,searching:true,aLengthMenu:[[25,50,100,-1],[25,50,100,"All"]],bStateSave:true,fnStateLoadParams:function(r,s){return q},aaSorting:[[1,"asc"]],aoColumns:[null,null,null,null,{bSortable:false}]});this.setTypeFilter(this.filter_type);this.setAppFilter(this.filter_app);this.setScopeFilter(this.filter_scope)},render:function(){this.$el.html(k)}});return e});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Apr 2017 00:45:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Get-current-app-name-with-Javascript-Splunk-util-getCurrentApp/m-p/128294#M7592</guid>
      <dc:creator>rijutha</dc:creator>
      <dc:date>2017-04-24T00:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Get current app name with Javascript (Splunk.util.getCurrentApp() fails)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Get-current-app-name-with-Javascript-Splunk-util-getCurrentApp/m-p/128295#M7593</link>
      <description>&lt;P&gt;var app_name;&lt;/P&gt;

&lt;P&gt;require(["splunkjs/mvc/utils"], &lt;BR /&gt;
function (SplunkUtil) &lt;BR /&gt;
   {&lt;BR /&gt;
    app_name = SplunkUtil.getCurrentApp();      &lt;/P&gt;

&lt;P&gt;});&lt;BR /&gt;
require.config({&lt;BR /&gt;&lt;BR /&gt;
    paths:&lt;BR /&gt;
     {&lt;BR /&gt;
         datatables:"../app/"+app_name+"/js/lib/DataTables/js/jquery.dataTables",&lt;BR /&gt;
         bootstrapDataTables:"../app/luep/js/lib/DataTables/js/dataTables.bootstrap",&lt;BR /&gt;
         text:"../app/luep/js/lib/text",&lt;BR /&gt;
         console:"../app/luep/js/lib/console"&lt;BR /&gt;
     },&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;shim:
 {
     bootstrapDataTables:
      {
          deps:
           ["datatables"]
      }
 }
});
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;define(["underscore","backbone","models/SplunkDBase","collections/SplunkDsBase","splunkjs/mvc","jquery","splunkjs/mvc/simplesplunkview","text!../app/luep/js/templates/LookupList.html",&lt;BR /&gt;
        "bootstrapDataTables","util/splunkd_utils","bootstrap.dropdown","css!../app/luep/css/LookupList.css","css!../app/luep/css/SplunkDataTables.css"],&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    function(n,m,i,a,g,j,l,k,d,f)
    {
        var h=a.extend(
        {
            url:"apps/local?count=-1&amp;amp;search="+app_name,
            initialize:
            function()
            {
                a.prototype.initialize.apply(this,arguments)
            }
        });

        var o=a.extend(
        {
            url:"data/transforms/lookups?count=-1&amp;amp;search="+app_name,
            initialize:
            function()
            {
                a.prototype.initialize.apply(this,arguments)
            }
        });

        var b=a.extend(
        {
            url:"/servicesNS/"+Splunk.util.getConfigValue("USERNAME")+"/-/data/lookup-table-files?count=-1&amp;amp;search="+app_name,
            initialize:
            function()
            {
                a.prototype.initialize.apply(this,arguments)
            }
        });

        var c=a.extend(
        {
            url:"/servicesNS/nobody/-/storage/collections/config?count=-1&amp;amp;search="+app_name,
            initialize:function()
            {
                a.prototype.initialize.apply(this,arguments)
            }
        });
        var e=l.extend(
        {
            className:"LookupListView",
            defaults:
            {
                change_dropdown_titles:true
            },
            initialize:function()
            {
                this.options=n.extend({},this.defaults,this.options);
                this.change_dropdown_titles=this.options.change_dropdown_titles;
                this.filter_app=null;
                this.filter_type=null;
                this.filter_scope=null;
                this.filter_text=null;
                this.applied_filter=null;
                this.apps=null;
                this.data_table=null;
                this.retain_state=false;
                this.csv_lookups=new b();
                this.csv_lookups.on("reset",this.gotCSVLookups.bind(this),this);
                this.csv_lookups.fetch(
                {
                    success:function()
                    {
                        console.info("Successfully retrieved the CSV lookup files")
                    },
                    error:function()
                    {
                        console.error("Unable to fetch the CSV lookup files")
                    }
                });
                this.kv_lookups_supported=true;
                this.getKVLookups();
                this.apps=new h();
                this.apps.on("reset",this.gotApps.bind(this),this);
                this.apps.fetch(
                {
                    success:function()
                    {
                        console.info("Successfully retrieved the list of applications")
                    },
                    error:function()
                    {
                        console.error("Unable to fetch the apps")
                    }
                });
                this.lookup_transforms=new o();
                this.lookup_transforms.on("reset",this.gotLookupTransforms.bind(this),this);
                this.lookup_transforms.fetch(
                {
                    success:function()
                    {
                        console.info("Successfully retrieved the list of lookup transforms")
                    },
                    error:function()
                    {
                        console.error("Unable to fetch the lookup transforms")
                    }
                })
            },
            events:
            {
                "click .type-filter &amp;gt; .dropdown-menu &amp;gt; li &amp;gt; a":"onClickTypeFilter",
                "click .app-filter &amp;gt; .dropdown-menu &amp;gt; li &amp;gt; a":"onClickAppFilter",
                "click .scope-filter &amp;gt; .btn":"onClickScopeFilter",
                "change #free-text-filter":"applyFilter",
                "keyup #free-text-filter":"goFilter",
                "keypress #free-text-filter":"goFilter",
                "click .disable-kv-lookup":"openDisableKVLookupDialog",
                "click #disable-this-lookup":"disableLookup",
                "click .enable-kv-lookup":"enableLookup"
            },
            getKVLookups:function()
            {
                this.kv_lookups=new c();
                this.kv_lookups.on("reset",this.gotKVLookups.bind(this),this);
                this.kv_lookups.fetch(
                {
                    success:function()
                    {
                        console.info("Successfully retrieved the KV store lookup files")
                    },
                    error:function()
                    {
                        console.error("Unable to fetch the KV store lookup files")
                    },
                    complete:function(p,q)
                    {
                        if(p.status==404)
                        {
                            this.hideKVStoreOptions();
                            this.kv_lookups_supported=false
                        }
                    }
                    .bind(this)
                }
                )
            },
            hideKVStoreOptions:function()
            {
                j(".show-kv-supported-only",this.$el).hide();
                j(".show-kv-unsupported-only",this.$el).show()
            },
            setFilterText:function(r,q,p){if(typeof p==="undefined"){p="All"}if(this.change_dropdown_titles){if(p){j("."+r+" &amp;gt; .dropdown-toggle").html(q+": "+p+'&amp;lt;span class="caret"&amp;gt;&amp;lt;/span&amp;gt;')}else{j("."+r+" &amp;gt; .dropdown-toggle").html(q+'&amp;lt;span class="caret"&amp;gt;&amp;lt;/span&amp;gt;')}}},doFilter:function(t,s,r,q){if(typeof q=="undefined"){q=true}var p=r;if(r===null){p="All"}this.setFilterText(t,s,p);j("."+t+" &amp;gt; .dropdown-menu &amp;gt; li &amp;gt; a").each(function(){if(j(this).text()===p){j("i",this).removeClass("hide")}else{j("i",this).addClass("hide")}});if(q){this.applyFilter()}},onClickTypeFilter:function(q){var p=j(q.target).text();this.setTypeFilter(p)},setTypeFilter:function(p){if(p==="All"){this.filter_type=null}else{this.filter_type=p}this.doFilter("type-filter","Type",p)},onClickScopeFilter:function(q){var p=j(q.target).text();this.setScopeFilter(p)},setScopeFilter:function(p){var q="All";if(p==="All"||p===null){this.filter_scope=null}else{if(p.indexOf("Global")&amp;gt;=0){this.filter_scope="nobody";q="Global"}else{this.filter_scope=Splunk.util.getConfigValue("USERNAME");q="Mine"}}j(".scope-filter &amp;gt; .btn").each(function(){if(j(this).text()===q){j(this).addClass("active")}else{j(this).removeClass("active")}});this.applyFilter()},onClickAppFilter:function(q){var p=j(q.target).text();this.setAppFilter(p)},setAppFilter:function(p){if(p==="All"){this.filter_app=null}else{this.filter_app=p}this.doFilter("app-filter","App",p)},enableLookup:function(r){var s=j(r.target).data("name");var q=j(r.target).data("namespace");var p=j(r.target).data("owner");j.ajax({url:f.fullpath(["/servicesNS","nobody",q,"storage/collections/config",s,"enable"].join("/")),type:"POST",success:function(){console.info("KV store lookup enabled")}.bind(this),complete:function(t,u){if(t.status==403){console.info("Inadequate permissions to enable collection")}else{this.retain_state=true;this.getKVLookups()}}.bind(this),error:function(t,v,u){if(t.status!=403){console.info("KV store collection enablement failed")}}.bind(this)});return false},disableLookup:function(r){var s=j(r.target).data("name");var q=j(r.target).data("namespace");var p=j(r.target).data("owner");j.ajax({url:f.fullpath(["/servicesNS","nobody",q,"storage/collections/config",s,"disable"].join("/")),type:"POST",success:function(){console.info("KV store lookup disabled")}.bind(this),complete:function(t,u){if(t.status==403){console.info("Inadequate permissions to disable collection")}else{j("#disable-lookup-modal",this.$el).modal("hide");this.retain_state=true;this.getKVLookups()}}.bind(this),error:function(t,v,u){if(t.status!=403){console.info("KV store collection disablement failed")}}.bind(this)})},openDisableKVLookupDialog:function(r){var s=j(r.target).data("name");var q=j(r.target).data("namespace");var p=j(r.target).data("owner");j("#disable-this-lookup",this.$el).data("name",s);j("#disable-this-lookup",this.$el).data("namespace",q);j("#disable-this-lookup",this.$el).data("owner",p);j(".disable-lookup-name",this.$el).text(s);j(".disable-lookup-namespace",this.$el).text(q);j(".disable-lookup-owner",this.$el).text(p);j("#disable-lookup-modal",this.$el).modal();return false},goFilter:function(q){var p=q.keyCode||q.which;if(p==13){q.preventDefault()}this.applyFilter()},applyFilter:function(){var p=""+this.filter_type+":"+this.filter_app+":"+this.filter_scope+":"+j("#free-text-filter").val();if(p===this.applied_filter){return}this.applied_filter=p;if(this.filter_type!==null){this.data_table.columns(1).search("^"+this.filter_type+"$",true)}else{this.data_table.columns(1).search("")}if(this.filter_app!==null){this.data_table.columns(2).search("^"+this.filter_app+"$",true)}else{this.data_table.columns(2).search("")}if(this.filter_scope!==null){this.data_table.columns(3).search("^"+this.filter_scope+"$",true)}else{this.data_table.columns(3).search("")}this.filter_text=j("#free-text-filter").val();this.data_table.columns(0).search(j("#free-text-filter").val()).draw()},getAppDescriptionFromName:function(p){for(var q=0;q&amp;lt;this.apps.models.length;q++){if(this.apps.models[q].entry.attributes.name===p){return this.apps.models[q].entry.associated.content.attributes.label}}return p},gotCSVLookups:function(){this.renderLookupsList()},gotKVLookups:function(){this.renderLookupsList()},gotApps:function(){this.renderLookupsList()},gotLookupTransforms:function(){this.renderLookupsList()},endsWith:function(q,p){return q.indexOf(p,q.length-p.length)!==-1},isSupportedLookup:function(p){if(this.endsWith(p.name,".default")){return false}else{if(p.name===".DS_Store"){return false}else{return true}}},getLookupsCount:function(){var p=this.getLookupsJSON();if(p){return p.length}else{return 0}},getLookupsJSON:function(){var q=[];var p=null;var r=null;for(var s=0;s&amp;lt;this.csv_lookups.models.length;s++){if(this.csv_lookups.models[s].entry.acl.attributes.sharing==="global"||this.csv_lookups.models[s].entry.acl.attributes.sharing==="app"){r="nobody"}else{r=this.csv_lookups.models[s].entry.acl.attributes.owner}p={name:this.csv_lookups.models[s].entry.attributes.name,author:this.csv_lookups.models[s].entry.attributes.author,updated:this.csv_lookups.models[s].entry.attributes.updated,namespace:this.csv_lookups.models[s].entry.acl.attributes.app,owner:this.csv_lookups.models[s].entry.acl.attributes.owner,type:"csv",sharing:this.csv_lookups.models[s].entry.acl.attributes.sharing,endpoint_owner:r};if(!this.endsWith(this.csv_lookups.models[s].entry.attributes.name,".kmz")){q.push(p)}}for(var s=0;s&amp;lt;this.kv_lookups.models.length;s++){p={name:this.kv_lookups.models[s].entry.attributes.name,author:this.kv_lookups.models[s].entry.attributes.author,updated:this.kv_lookups.models[s].entry.attributes.updated,namespace:this.kv_lookups.models[s].entry.acl.attributes.app,owner:this.kv_lookups.models[s].entry.acl.attributes.owner,type:"kv",endpoint_owner:this.kv_lookups.models[s].entry.acl.attributes.owner,disabled:this.kv_lookups.models[s].entry.associated.content.attributes.disabled};q.push(p)}return q.filter(this.isSupportedLookup.bind(this))},getAppsJSON:function(t){if(typeof t==="undefined"){t=true}if(!this.apps){return[]}var s=[];var p=null;for(var r=0;r&amp;lt;this.apps.models.length;r++){p={name:this.apps.models[r].entry.attributes.name,label:this.apps.models[r].entry.associated.content.attributes.label};if(t){for(var q=0;q&amp;lt;this.csv_lookups.models.length;q++){if(this.csv_lookups.models[q].entry.acl.attributes.app===this.apps.models[r].entry.attributes.name){s.push(p);break}}for(var q=0;q&amp;lt;this.kv_lookups.models.length;q++){if(this.kv_lookups.models[q].entry.acl.attributes.app===this.apps.models[r].entry.attributes.name){s.push(p);break}}}else{s.push(p)}}var s=n.uniq(s,function(w,v,u){return w.name});return s},getLookupTransformsJSON:function(){if(!this.lookup_transforms){return[]}var p=[];for(var q=0;q&amp;lt;this.lookup_transforms.models.length;q++){if(this.lookup_transforms.models[q].entry.associated.content.attributes.type=="kvstore"){p.push({transform:this.lookup_transforms.models[q].entry.attributes.name,collection:this.lookup_transforms.models[q].entry.associated.content.attributes.collection})}else{if(this.lookup_transforms.models[q].entry.associated.content.attributes.type=="file"){p.push({transform:this.lookup_transforms.models[q].entry.attributes.name,filename:this.lookup_transforms.models[q].entry.associated.content.attributes.filename})}}}return p},getLookupTransform:function(q){var p=this.getLookupTransformsJSON();for(var r=0;r&amp;lt;p.length;r++){if(p[r].collection===q){return p[r].transform}if(p[r].filename===q){return p[r].transform}}},renderLookupsList:function(q){if(typeof q=="undefined"){q=this.retain_state}var p=j("#lookup-list-template",this.$el).text();j("#content",this.$el).html(n.template(p,{lookups:this.getLookupsJSON(),apps:this.getAppsJSON(),transforms:this.getLookupTransformsJSON(),kv_lookups_supported:this.kv_lookups_supported,getAppDescriptionFromName:this.getAppDescriptionFromName.bind(this),getLookupTransform:this.getLookupTransform.bind(this),filter_app:this.filter_app,filter_type:this.filter_type,filter_scope:this.filter_scope,filter_text:this.filter_text,lookups_count:this.getLookupsCount()}));this.data_table=j("#table",this.$el).DataTable({iDisplayLength:25,bLengthChange:false,searching:true,aLengthMenu:[[25,50,100,-1],[25,50,100,"All"]],bStateSave:true,fnStateLoadParams:function(r,s){return q},aaSorting:[[1,"asc"]],aoColumns:[null,null,null,null,{bSortable:false}]});this.setTypeFilter(this.filter_type);this.setAppFilter(this.filter_app);this.setScopeFilter(this.filter_scope)},render:function(){this.$el.html(k)}});return e});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 24 Apr 2017 00:46:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Get-current-app-name-with-Javascript-Splunk-util-getCurrentApp/m-p/128295#M7593</guid>
      <dc:creator>rijutha</dc:creator>
      <dc:date>2017-04-24T00:46:53Z</dc:date>
    </item>
    <item>
      <title>Re: Get current app name with Javascript (Splunk.util.getCurrentApp() fails)</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Get-current-app-name-with-Javascript-Splunk-util-getCurrentApp/m-p/128296#M7594</link>
      <description>&lt;P&gt;You should ask a new question about this, @rijutha&lt;/P&gt;</description>
      <pubDate>Mon, 24 Apr 2017 12:50:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Get-current-app-name-with-Javascript-Splunk-util-getCurrentApp/m-p/128296#M7594</guid>
      <dc:creator>jeffland</dc:creator>
      <dc:date>2017-04-24T12:50:13Z</dc:date>
    </item>
  </channel>
</rss>

