Commit c7b8b282 authored by ecrombag's avatar ecrombag

Update of RPC and StubGenerator

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@699 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 470bf527
......@@ -7,7 +7,7 @@ itasks.util.formatDate = function(ts) {
if (ts == null)
return "";
else
return Date.parseDate(ts, "U").format("d M Y H:i");
return Date.parseDate(ts, "U").format("d M Y H:i:s");
}
itasks.util.formatStartDate = function (ts) {
if (ts == null)
......@@ -617,6 +617,7 @@ itasks.WorkListPanel = Ext.extend(Ext.grid.GridPanel, {
{name: 'progress'},
{name: 'delegatorName'},
{name: 'timestamp'},
{name: 'latestExtEvent'},
{name: 'deadline'},
{name: 'tree_path'},
{name: 'tree_last'},
......@@ -643,7 +644,8 @@ itasks.WorkListPanel = Ext.extend(Ext.grid.GridPanel, {
{id: 'priority', header: 'Priority', dataindex: 'priority', renderer: itasks.util.formatPriority, width: 100},
{id: 'progress', header: 'Progress', dataindex: 'progress', renderer: itasks.util.formatProgress, width: 100},
{id: 'delegatorName', header: 'Managed by', dataIndex: 'delegatorName', width: 100},
{id: 'timestamp', header: 'Date', dataIndex: 'timestamp', renderer: itasks.util.formatDate, width: 100},
{id: 'timestamp', header: 'Date', dataIndex: 'timestamp', renderer: itasks.util.formatDate, width: 120},
{id: 'latestExtEvent', header: 'Latest Ext Event', dataIndex: 'latestExtEvent', renderer: itasks.util.formatDate, width: 120},
{id: 'deadline', header: 'Deadline', dataIndex: 'deadline', renderer: itasks.util.formatDeadline, width: 100}
],
autoExpandColumn: 'subject',
......@@ -678,6 +680,7 @@ itasks.WorkListPanel = Ext.extend(Ext.grid.GridPanel, {
this.startAutoRefresh();
},
/*
* Return the taskid of the selected row
*/
......@@ -688,19 +691,19 @@ itasks.WorkListPanel = Ext.extend(Ext.grid.GridPanel, {
* Refresh the list
*/
refresh: function () {
this.store.load({
params: {_session: itasks.app.session}
});
this.fireEvent("workListRefreshed", this);
if(this.store != null){
this.store.load({
params: {_session: itasks.app.session}
});
this.fireEvent("workListRefreshed", this);
}
},
/*
* Start the timed task for auto-refreshing.
*/
startAutoRefresh: function(){
console.log(itasks.config);
if(itasks.config.autoRefresh){
var parent = this;
......@@ -964,7 +967,6 @@ itasks.WorkPanel = Ext.extend(itasks.RemoteDataPanel, {
this.on("remoteCallEnd",function() {
this.getComponent(0).setBusy(false);
},this);
this.on("workListRefreshed",this.receiveWorkListRefreshEvent,this);
},
update: function(data) {
......@@ -1061,10 +1063,6 @@ itasks.WorkPanel = Ext.extend(itasks.RemoteDataPanel, {
},
scope: this
});
},
receiveWorkListRefreshEvent: function(worklist){
console.log("Refresh!");
console.log(worklist);
}
});
......@@ -1475,7 +1473,7 @@ itasks.TaskWaitingPanel = Ext.extend(Ext.Panel, {
var p = data.properties;
var props = [p.managerProps.worker[1],p.managerProps.priority,p.workerProps.progress,p.systemProps.issuedAt,p.systemProps.firstEvent,p.systemProps.latestEvent];
this.getComponent(0).body.update("Waiting for <i>" + Ext.util.Format.htmlEncode(data.properties.managerProps.subject) + "</i>");
this.getComponent(1).items.each(function(cmt,i){ cmt.setValue(props[i]); });
}
......@@ -1756,6 +1754,22 @@ itasks.ApplicationPanel = Ext.extend(Ext.Panel, {
worklist.on("cellclick",function (grid,row,col,event) {
attachTabHandlers(worktabs.openWorkTab(grid.getTaskId(row)));
});
worklist.on("workListRefreshed",function(worklist) {
worklist.workStore.each(function(){
var tab = worktabs.getComponent("worktab-"+this.data.taskid);
var wlTStamp = this.data.latestExtEvent;
if(tab != null){
var tTStamp = tab.properties.systemProps.latestEvent
if(wlTStamp > tTStamp){
tab.refresh();
}
}
});
});
newpanel.on("processStarted",function(taskid) {
//When new work is started, refresh the worklist
//and immediately open a tab for the work
......
This diff is collapsed.
......@@ -27,8 +27,6 @@ determineTreeRPCItems (TTSequenceTask ti children)
determineTreeRPCItems (TTRpcTask ti rpci) = [rpci]
determineTreeRPCItems _ = []
import StdDebug
handleRPCUpdates :: !HTTPRequest !*TSt -> (!HTTPResponse, !*TSt)
handleRPCUpdates request tst
# (tree, tst) = calculateTaskTree procId tst
......@@ -50,6 +48,6 @@ where
updateTimeStamps :: !ProcessId !*TSt -> *TSt
updateTimeStamps pid tst
# (now,tst) = accWorldTSt time tst
= trace_n("TimeStamp: "+++(toString now)) (snd (updateProcessProperties pid (\p -> {p & systemProps = {p.systemProps & firstEvent = case p.systemProps.firstEvent of Nothing = Just now; x = x
= snd (updateProcessProperties pid (\p -> {p & systemProps = {p.systemProps & firstEvent = case p.systemProps.firstEvent of Nothing = Just now; x = x
, latestExtEvent = Just now
}}) tst))
}}) tst)
definition module RPCStubs
import google_maps_services
import geonames_webservices
implementation module RPCStubs
\ No newline at end of file
definition module geonames_webservices
import iTasks
ocean_names :: Real Real (String -> String) -> Task String
country_code :: Real Real String (String -> String) -> Task String
implementation module geonames_webservices
import JSON
import RPC
import TSt
ocean_names :: Real Real (String -> String) -> Task String
ocean_names lat lng parsefun = mkRpcTask "Ocean Names"
{ RPCExecute
| taskId = ""
, interface = { RPCInterface | protocol = HTTP GET, type = JSONRPC }
, operation = { RPCOperation | name = "Ocean Names", parameters = [{ RPCParam | name = "lat", type = RPCReal }, { RPCParam | name = "lng", type = RPCReal }], location = "http://ws.geonames.org/oceanJSON", callType = RequestResponse, returnType = "String" }
, paramValues = [{ RPCParamValue | name="lat", serializedValue = toString lat},{ RPCParamValue | name="lng", serializedValue = toString lng}]
, status = ""
} parsefun
country_code :: Real Real String (String -> String) -> Task String
country_code lat lng type parsefun = mkRpcTask "Country Code"
{ RPCExecute
| taskId = ""
, interface = { RPCInterface | protocol = HTTP GET, type = JSONRPC }
, operation = { RPCOperation | name = "Country Code", parameters = [{ RPCParam | name = "lat", type = RPCReal }, { RPCParam | name = "lng", type = RPCReal }, { RPCParam | name = "type", type = RPCString }], location = "http://ws.geonames.org/countryCode", callType = RequestResponse, returnType = "String" }
, paramValues = [{ RPCParamValue | name="lat", serializedValue = toString lat},{ RPCParamValue | name="lng", serializedValue = toString lng},{ RPCParamValue | name="type", serializedValue = toString type}]
, status = ""
} parsefun
definition module google_maps_services
import iTasks
reverse_geocoding :: String String Bool String (String -> String) -> Task String
implementation module google_maps_services
import JSON
import RPC
import TSt
reverse_geocoding :: String String Bool String (String -> String) -> Task String
reverse_geocoding q output sensor api_key parsefun = mkRpcTask "Reverse Geocoding"
{ RPCExecute
| taskId = ""
, interface = { RPCInterface | protocol = HTTP GET, type = JSONRPC }
, operation = { RPCOperation | name = "Reverse Geocoding", parameters = [{ RPCParam | name = "q", type = RPCString }, { RPCParam | name = "output", type = RPCString }, { RPCParam | name = "sensor", type = RPCBool }, { RPCParam | name = "api_key", type = RPCString }], location = "http://maps.google.com/maps/geo", callType = RequestResponse, returnType = "String" }
, paramValues = [{ RPCParamValue | name="q", serializedValue = toString q},{ RPCParamValue | name="output", serializedValue = toString output},{ RPCParamValue | name="sensor", serializedValue = toString sensor},{ RPCParamValue | name="api_key", serializedValue = toString api_key}]
, status = ""
} parsefun
This diff was suppressed by a .gitattributes entry.
......@@ -122,7 +122,7 @@ where
instance toString RPCParam
where
toString x = "{ RPCParamValue | name=\""+++x.RPCParam.name+++"\", serializedValue = toJSON "+++x.RPCParam.name+++"}"
toString x = "{ RPCParamValue | name=\""+++x.RPCParam.name+++"\", serializedValue = toString "+++x.RPCParam.name+++"}"
writeDCL :: !RPCDescription !Path !*World -> *World
writeDCL rpcd wpath world
......@@ -173,7 +173,7 @@ writeWrapper rpcds wpath world
= world
where
writeImports [] f = f
writeImports [x:xs] f = writeImports xs ( fwrites ("import "+++(prepName x.service.RPCService.name)) f)
writeImports [x:xs] f = writeImports xs ( fwrites ("import "+++(prepName x.service.RPCService.name)+++"\n") f)
//=== UTILITY =====================================================================
......
Markdown is supported
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