Commit 5604f0d9 authored by Bas Lijnse's avatar Bas Lijnse

Added feedback on whether a task is done or deleted in the GUI. The...

Added feedback on whether a task is done or deleted in the GUI. The calculation of this value does appear somewhat funny though. Sometimes task are given the deleted status when they are only just done.

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/branches/fancyTasks@312 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent cc57c5aa
......@@ -88,7 +88,10 @@ itasks.ApplicationPanel = Ext.extend(Ext.Panel, {
var newtab = worktabs.openWorkTab(grid.getTaskId(row), grid.getTaskInfo(row));
newtab.setDebugPanel(debugpanel);
newtab.setApplicationPanel(apppanel);
newtab.on('taskdone',function(taskid) {
newtab.on('taskfinished',function(taskid) {
worklist.refresh();
},this);
newtab.on('taskdeleted',function(taskid) {
worklist.refresh();
},this);
newtab.refresh();
......
......@@ -102,7 +102,10 @@ itasks.WorkTabPanel = Ext.extend(Ext.Panel, {
+ "</table></div><div class=\"worktab-header-indicator\"></div>";
},
makeFinishedMessage: function() {
return "This task has finished. You can close this tab now.";
return "This task is completed. Thank you.";
},
makeDeletedMessage: function() {
return "The completion of this task is no longer required.<br />It has been removed. Thank you for your effort.";
},
makeErrorMessage: function(msg) {
return "<span class=\"error\">" + msg + "</span>";
......@@ -181,9 +184,12 @@ itasks.WorkTabPanel = Ext.extend(Ext.Panel, {
if (data.error != null) {
this.autoClose(this.makeErrorMessage(data.error), 5);
} else if(data.done) { //Check if the task is done
this.fireEvent('taskdone', this.id);
this.autoClose(this.makeFinishedMessage(), 5);
} else if(data.status == 'TaskFinished') { //Check if the task is done
this.fireEvent('taskfinished', this.id);
this.autoClose(this.makeFinishedMessage(), 5);
} else if(data.status == 'TaskDeleted') {
this.fireEvent('taskdeleted', this.id);
this.autoClose(this.makeDeletedMessage(), 5);
} else {
//Update the tab content
this.contentPanel.body.dom.innerHTML = data.html;
......@@ -301,7 +307,9 @@ itasks.WorkTabPanel = Ext.extend(Ext.Panel, {
autoClose: function (msg, numSeconds) {
if(numSeconds == 0) {
this.ownerCt.remove(this);
if(this.ownerCt != undefined) {
this.ownerCt.remove(this);
}
} else {
if(this.ownerCt != undefined) { //Only continue if we were not already closed manually
this.contentPanel.body.dom.innerHTML = msg + '<br /><br />This tab will automatically close in ' + numSeconds + ' seconds...';
......
......@@ -7,9 +7,9 @@ import TaskTree, TaskTreeFilters
import JSON
import iDataForms, iDataState
derive JSONEncode TabContent, InputId, UpdateEvent, HtmlState, StorageFormat, Lifespan
derive JSONEncode TabContent, TaskStatus, InputId, UpdateEvent, HtmlState, StorageFormat, Lifespan
:: TabContent = { done :: Bool //Is the requested work finished
:: TabContent = { status :: TaskStatus //Is the requested work active, finished, or deleted
, error :: Maybe String //Optional error if something went wrong on the server
, html :: String //The HTML content of the tab
, inputs :: [InputId] //The interactive inputs in the tab
......@@ -50,7 +50,7 @@ handleWorkTabRequest mainTask request session hst
# content =
{TabContent
| done = taskStatus == TaskFinished || taskStatus == TaskDeleted
| status = taskStatus
, error = maybeError
, html = toString (DivTag [IdAttr ("itasks-tab-" +++ taskId)] html)
, inputs = inputs
......
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