diff --git a/.gitignore b/.gitignore index 51f4ce0a9..aca57cfd0 100644 --- a/.gitignore +++ b/.gitignore @@ -57,7 +57,3 @@ gg_13_8-* # sphinx documentation qiita_pet/static/doc/ - -# moi static files -qiita_pet/static/vendor/js/moi.js -qiita_pet/static/vendor/js/moi_list.js diff --git a/INSTALL.md b/INSTALL.md index 3d14233f0..c9be98873 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -140,7 +140,6 @@ Set your `QIITA_CONFIG_FP` environment variable to point to that file (into `.ba ```bash echo "export QIITA_CONFIG_FP=$HOME/.qiita_config_test.cfg" >> ~/.bashrc - echo "export MOI_CONFIG_FP=$HOME/.qiita_config_test.cfg" >> ~/.bashrc source ~/.bashrc # Re-enable conda environment for qiita source activate qiita diff --git a/qiita_pet/static/js/qiita.js b/qiita_pet/static/js/qiita.js index 24b900562..8bef166ac 100644 --- a/qiita_pet/static/js/qiita.js +++ b/qiita_pet/static/js/qiita.js @@ -240,3 +240,100 @@ function change_artifact_name(portal_dir, artifact_id, new_name, on_success_func } }); } + +/** + * Taken from https://goo.gl/KkQ1S4 + * + * Original script information: + * @author Daniel McDonald + * @copyright Copyright 2014, biocore + * @credits Daniel McDonald, Joshua Shorenstein, Jose Navas + * @license BSD + * @version 0.1.0-dev + * @maintainer Daniel McDonald + * @email mcdonadt@colorado.edu + * @status Development + * + * + * @name qiita_websocket + * + * @class manages WebSocket for job information + * + */ + +var qiita_websocket = new function () { + var + /* the server end of the websocket */ + host = null, + /* the websocket */ + ws = null, + + /* registered callbacks */ + callbacks = {}, + + /* the encode and decode methods used for communication */ + encode = JSON.stringify, + decode = JSON.parse; + + /** + * + * Registers a callback method for a given action + * + * @param {action} The associated action verb, str. + * @param {func} The associated function, function. This function must + * accept an object. Any return is ignored. + * + */ + this.add_callback = function(action, func) { callbacks[action] = func; }; + + /** + * + * Packages data into an object, and passes an encoded version of the + * object to the websocket. + * + * @param {action} The associated action to send, str. + * @param {data} The data to send, str or Array of str. + */ + this.send = function(action, data) { + to_send = {}; + to_send[action] = data; + ws.send(encode(to_send)); + }; + + /** + * + * Verify the browser supports websockets, and if so, initialize the + * websocket. On construction, this method will send a message over the + * socket to get all known job information associated with this client. + * + * @param {host} The URL for the websocket, minus the ws:// header, or null + * to use the default qiita_websocket-ws. + * @param {on_close} Optional function for action when websocket is closed. + * @param {on_error} Optional function for action when websocket errors. + */ + this.init = function(host, on_close, on_error) { + if (!("WebSocket" in window)) { + alert("Your browser does not appear to support websockets!"); + return; + } + //check if we need regular or secure websocket + socket = window.location.protocol == "https:" ? 'wss://' : 'ws://'; + ws = new WebSocket(socket + host); + + // retrive all messages + var on_open_message = []; + + ws.onopen = function(){}; + ws.onclose = on_close; + ws.onerror = on_error; + + ws.onmessage = function(evt) { + message = decode(evt.data); + for(var action in message) { + if(action in callbacks) { + callbacks[action](message[action]); + } + } + }; + }; +}; diff --git a/qiita_pet/templates/analysis_selected.html b/qiita_pet/templates/analysis_selected.html index b5c04206d..aef3abd4d 100644 --- a/qiita_pet/templates/analysis_selected.html +++ b/qiita_pet/templates/analysis_selected.html @@ -2,7 +2,6 @@ {% block head %} {% from future.utils import viewitems %} {% from itertools import chain %} - -