in query, 'method' is now called 'subject'
[myslice.git] / plugins / querycode / querycode.js
index e8719c3..3574b30 100644 (file)
 
        var lang=$plugindiv.find(".querycode-lang").val();
        var dom=$plugindiv.find(".querycode-viz");
-       var query = $plugindiv.data().QueryCode.options.query;
+       var query_uuid = $plugindiv.data().QueryCode.options.query_uuid;
+       var query=manifold.find_query(query_uuid);
        funname="translate_query_as_" + lang;
        fun=eval(funname);
-       if ( ! fun) {
+       if (! fun) {
            console.log("Cannot find translator function for lang " + lang);
            return;
        }
        });
        ofs = '[' + ofs + ']';
 
-       output += 'pp srv.call("' + mixed_case(query.action) +'", auth, "' + query.method + '", "' + query.timestamp + '", ' + ifs + ', ' + ofs + ')';
+       output += 'pp srv.call("' + mixed_case(query.action) +'", auth, "' + query.subject + '", "' + query.timestamp + '", ' + ifs + ', ' + ofs + ')';
 
        var output = '<pre class="brush: ruby; toolbar: false;">' + output + "</pre>";
        return output;
        });
        ofs = '[' + ofs + ']';
 
-       output += 'srv.' + mixed_case(query.action) + '(auth, "' + query.method + '", ' + ifs + ', {}, ' + ofs + ')';
+       output += 'srv.' + mixed_case(query.action) + '(auth, "' + query.subject + '", ' + ifs + ', {}, ' + ofs + ')';
        var output = '<pre class="brush: python; toolbar: false;">' + output + "</pre>";
        return output;
     }