Splunk Dev

Access the static images in app path

phil__tanner
Path Finder

Hi all 

I'm creating a custom visualisation for my org, so I'm developing it into an app, following this tutorial:
https://docs.splunk.com/Documentation/Splunk/8.0.5/AdvancedDev/CustomVizTutorial

Everything's great so far and working perfectly on my local machine when I'm referencing a background image in my CSS using:

background-image: url( '/static/app/********/images/hot-water-icon.gif' );

(obviously ******** is the name of my app, on my local machine).

This is great, until I sent an upgrade to test on another machine, where it got installed into an app directory called "******** - Copy" (I assume because that was the name of the file of the folder I copied to zip & send thru, because I didn't want to send some other things in the /static/app/********/bin/ folder I was still working on at the time....)

So... How do I access the URI for the named app install folder? Can it be done? or do I just need to presume it'll always be as I set it?

Thanks in advance,
Phil

0 Karma

aa70627
Communicator

have you tried using a relative URL as either

background-image: url( 'images/hot-water-icon.gif' );

OR 

background-image: url( 'hot-water-icon.gif' );

 

 

0 Karma

phil__tanner
Path Finder

Unfortunately that's not going to work as we plan on using the visualisation in many dashboards, and across multiple embedded reports - which of course have URLs outside of the particular app (and the visualisation is marked as being set to be available globally within the instance).

0 Karma

aa70627
Communicator

try this:

background-image: url( '/en-US/static/app/{yourapp}/images/simple_chart.png' );

no matter which app your using this from, it should still work as long as you replace {yourapp} with the actual app where the image resides. 

 

0 Karma

phil__tanner
Path Finder

Thanks Path Finder.

Unfortunately, that's my question - for my local dev {yourapp} is one value. But when testing on another machine, they have installed it (somehow) into {yourapp - Copy}  - I'm trying to work out if I can programmatically access what value {yourapp} has been set to on the currently running install.

I think the answer is "no", and my edge case is so edge-casey that it wouldn't be worth developing anything for.

Phil.

0 Karma
Get Updates on the Splunk Community!

Splunk Observability Cloud's AI Assistant in Action Series: Auditing Compliance and ...

This is the third post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Splunk Community Badges!

  Hey everyone! Ready to earn some serious bragging rights in the community? Along with our existing badges ...

What You Read The Most: Splunk Lantern’s Most Popular Articles!

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