rasmusbergpalm / jslate

Write your dashboards in pure html/js
jslate.com
244 stars 54 forks source link

Enhancement: A proxify js api #28

Closed brianhks closed 11 years ago

brianhks commented 11 years ago

The purpose of this is to correctly modify a url so that is is passed through proxy.php. This should be able to solve the problem of whether jslate is running on the root or not.

rasmusbergpalm commented 11 years ago

Here's a better idea: Data sources: You set them up in the 'backend' and get a url to them. a HttpDataSource would be an obvious start, it would take a post request will some parameter structure mimicking http headers, etc. and would return the results of the executed query. Another obvious example is a MySqlDataSource, PostgresDatasource, KairosDatasource, etc.

brianhks commented 11 years ago

Oh your going way beyond what I had envisioned. I'm not sure I was clear on what I was proposing - the changes would only be a new js file on the front end. The new js files provides a method called jslate.proxify(). The purpose of my enhancement is two fold. 1: simplify the widget development by making it more portable. If I export a dashboard from an environment that has jslate setup under /jslate and I import it into another environment where jslate is running at the root the widgets will be broken. The proxify js method will figure that out on the fly.

Second reason is I would like to be able to create widgets offline. The idea here is I could use a static html page to develop my widget with an IDE (such as intellij). In this case the html would have a proxify method but it wouldn't do anything - in the case of communicating with Kairos we handle CORS so ajax will work without going through a backend. Once the widget was done it could be pasted into jslate.

rasmusbergpalm commented 11 years ago

The datasource is a seperate idea i agree. A special $.proxy() method that figures out the url and delegates to $.post() is a good idea.

rasmusbergpalm commented 11 years ago

fixed in b2c37cce030e74f36d1130871f169cb914380a7c