Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Access to config within JS in panel #387

Closed
edasque opened this issue May 5, 2014 · 4 comments
Closed

Access to config within JS in panel #387

edasque opened this issue May 5, 2014 · 4 comments

Comments

@edasque
Copy link

edasque commented May 5, 2014

This is more a question than an issue. How would I access the config object from a bit of JS in an HTML panel, specifically the elasticsearch URL.

@torkelo
Copy link
Member

torkelo commented May 5, 2014

HTML panel? You mean the text panel? The configuration object is only accessable through a requirejs component.

@edasque
Copy link
Author

edasque commented May 5, 2014

Yes, the text panel in HTML mode. I stuck a bit of JS in there. Do you have an example of how I could access the config.js from a random bit of JS on the page (one that's not part of the angular app).

@torkelo
Copy link
Member

torkelo commented May 5, 2014

Hm...

try this.

require(['config'], function(config) {
// do something
});

No guarantee that this will work :)

@edasque
Copy link
Author

edasque commented May 5, 2014

That very much did work. Wrote a small snippet of ugly code to generate an ugly list of dashboards to place on the home dashboard. My users found it useful.

https://gist.github.com/edasque/1c8a8b653014ee158202

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants