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:
parent
eaef7b2394
commit
72d06fe65c
@ -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 {
|
||||
|
@ -214,22 +214,24 @@ public class ReconOperation extends EngineDependentOperation {
|
||||
}
|
||||
}
|
||||
|
||||
Change reconChange = new ReconChange(
|
||||
cellChanges,
|
||||
_columnName,
|
||||
_reconConfig,
|
||||
null
|
||||
);
|
||||
|
||||
HistoryEntry historyEntry = new HistoryEntry(
|
||||
_project,
|
||||
_description,
|
||||
ReconOperation.this,
|
||||
reconChange
|
||||
);
|
||||
|
||||
_project.history.addEntry(historyEntry);
|
||||
_project.processManager.onDoneProcess(this);
|
||||
if (!_canceled) {
|
||||
Change reconChange = new ReconChange(
|
||||
cellChanges,
|
||||
_columnName,
|
||||
_reconConfig,
|
||||
null
|
||||
);
|
||||
|
||||
HistoryEntry historyEntry = new HistoryEntry(
|
||||
_project,
|
||||
_description,
|
||||
ReconOperation.this,
|
||||
reconChange
|
||||
);
|
||||
|
||||
_project.history.addEntry(historyEntry);
|
||||
_project.processManager.onDoneProcess(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user