Added support for canceling running and pending processes.

git-svn-id: http://google-refine.googlecode.com/svn/trunk@183 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
David Huynh 2010-03-04 01:14:48 +00:00
parent eaef7b2394
commit 72d06fe65c
4 changed files with 53 additions and 26 deletions

View File

@ -12,7 +12,7 @@ import com.metaweb.gridworks.model.Project;
public class CancelProcessesCommand extends Command {
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
try {

View File

@ -214,6 +214,7 @@ public class ReconOperation extends EngineDependentOperation {
}
}
if (!_canceled) {
Change reconChange = new ReconChange(
cellChanges,
_columnName,
@ -233,3 +234,4 @@ public class ReconOperation extends EngineDependentOperation {
}
}
}
}

View File

@ -33,6 +33,15 @@ ProcessWidget.prototype.update = function(updateOptions, onDone) {
);
};
ProcessWidget.prototype._cancelAll = function() {
$.post(
"/command/cancel-processes?" + $.param({ project: theProject.id }),
null,
function(o) {},
"json"
);
};
ProcessWidget.prototype._render = function() {
var self = this;
@ -43,14 +52,23 @@ ProcessWidget.prototype._render = function() {
} else {
this._div.show();
var bodyDiv = $('<div></div>').addClass("process-panel-inner").appendTo(this._div);
$('<img src="images/small-spinner.gif" />')
.css("float", "right")
.css("margin-left", "10px")
.css("margin-bottom", "10px")
.css("opacity", "0.3")
.appendTo(bodyDiv);
var innerDiv = $('<div></div>').addClass("process-panel-inner").appendTo(this._div);
var headDiv = $('<div></div>').addClass("process-panel-head").appendTo(innerDiv);
$('<img src="images/small-spinner.gif" />')
.css("margin-right", "3px")
.css("opacity", "0.3")
.appendTo(headDiv);
$('<a href="javascript:{}"></a>')
.addClass("action")
.text("cancel all")
.click(function() {
self._cancelAll();
$(this).text("canceling all processes...").unbind();
})
.appendTo(headDiv);
var bodyDiv = $('<div></div>').addClass("process-panel-body").appendTo(innerDiv);
var renderProcess = function(process) {
var div = $('<div></div>').addClass("process-panel-entry").appendTo(bodyDiv);

View File

@ -9,10 +9,17 @@
border: 1px solid #ccc;
width: 500px;
max-height: 70px;
overflow: auto;
padding: 10px;
margin: 0 auto;
text-align: left;
background: #fffee0;
}
.process-panel-head {
padding: 2px 10px;
border-bottom: 1px solid #ccc;
}
.process-panel-body {
overflow: auto;
padding: 10px;
}