Skip to content

Commit

Permalink
allow loading mini.html and shiny.html versions by tag name
Browse files Browse the repository at this point in the history
fixes att#1002 yet some more

also, mini.js was not properly chaining the init & call promises
meaning that it was possible call_notebook could have been called
before the session was fully initialized
  • Loading branch information
gordonwoodhull committed Oct 31, 2014
1 parent b7e9433 commit eb90aec
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions htdocs/mini.js
Expand Up @@ -23,20 +23,31 @@ function main() {
} else {
promise = rcloud.anonymous_session_init();
}
promise.then(function(hello) {
promise = promise.then(function(hello) {
rclient.post_response(hello);
});

// resolve(rcloud.init_client_side_data()); // what was this for?!?

var notebook = getURLParameter("notebook"),
version = getURLParameter("version");
rcloud.call_notebook(notebook, version).then(function(x) {
// FIXME: I'm not sure what's the best way to make this available
// in a convenient manner so that notebooks can leverage it ...
window.notebook_result = x;
if (!_.isUndefined(x.body)) $("body").append(x.body);
if (_.isFunction(x.run)) x.run(getQueryArgs(), function() {});
version = getURLParameter("version");
var tag = getURLParameter("tag");
if(!version && tag) {
promise = promise.then(function() {
return rcloud.get_version_by_tag(notebook, tag)
.then(function(v) {
version = v;
});
});
};
promise = promise.then(function() {
return rcloud.call_notebook(notebook, version).then(function(x) {
// FIXME: I'm not sure what's the best way to make this available
// in a convenient manner so that notebooks can leverage it ...
window.notebook_result = x;
if (!_.isUndefined(x.body)) $("body").append(x.body);
if (_.isFunction(x.run)) x.run(getQueryArgs(), function() {});
});
});
return true;
}, on_error: function(msg, status_code) {
Expand Down

0 comments on commit eb90aec

Please sign in to comment.