Commit 48c207b4 authored by ThorbenQuast's avatar ThorbenQuast
Browse files

pxl browser: send json objects instead of strings to client

parent aa037f38
......@@ -7,46 +7,20 @@ from vispa.controller import AbstractController
logger = logging.getLogger(__name__)
class PXLBrowserController(AbstractController):
def getrpc(self):
windowId = cherrypy.request.private_params.get("_windowId", None)
viewId = cherrypy.request.private_params.get("_viewId", None)
return self.get("proxy", "PXLBrowserRpc", self.get("combined_id"),
window_id=windowId, view_id=viewId)
@cherrypy.expose
@cherrypy.tools.ajax()
def start_reader(self, filepath):
'''
self.release_session()
rpc = self.getrpc()
self.release_database()
'''
def start_reader(self, filepath):
rpc = self.extension.get_workspace_instance("PXLBrowserRpc")
rpc.start_reader(filepath)
@cherrypy.expose
@cherrypy.tools.ajax(encoded=True)
def getCache(self):
'''
self.release_session()
rpc = self.getrpc()
self.release_database()
'''
rpc = self.extension.get_workspace_instance("PXLBrowserRpc")
return {
'data': rpc.getCache()
}
return rpc.getCache()
@cherrypy.expose
@cherrypy.tools.ajax(encoded=True)
def getObjectProperties(self, oid):
'''
self.release_session()
rpc = self.getrpc()
self.release_database()
'''
rpc = self.extension.get_workspace_instance("PXLBrowserRpc")
return {
'data': rpc.getObjectProperties(oid)
}
\ No newline at end of file
return rpc.getObjectProperties(oid)
\ No newline at end of file
......@@ -105,14 +105,13 @@ var PXLBrowserView = vispa.ExtensionView.Center.extend({
$.when(dfd).then(function() {
self.POST("start_reader", {
filepath: self.path
}).done(function(res) {
self.POST("getCache").done(function(res) {
console.log(res);
}).done(function() {
self.POST("getCache").done(function(data) {
console.log(data);
self.POST("getObjectProperties", {
oid: '773e039e-772f-4748-ba4e-4e440a981831' //just an exemplary ID from the very first event
}).done(function(res) {
console.log(res);
}).done(function(data) {
console.log(data);
});
});
});
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment