Fixed "Loading…" bug in task bar, added more tests.
This commit is contained in:
parent
72dbd0a291
commit
c907a4dd50
2 changed files with 76 additions and 11 deletions
|
@ -66,7 +66,6 @@ class _taskManagerSingleton extends App.Controller
|
||||||
super
|
super
|
||||||
@workers = {}
|
@workers = {}
|
||||||
@workersStarted = {}
|
@workersStarted = {}
|
||||||
@taskUpdateProcess = {}
|
|
||||||
@allTasks = []
|
@allTasks = []
|
||||||
@tasksToUpdate = {}
|
@tasksToUpdate = {}
|
||||||
@initialLoad = true
|
@initialLoad = true
|
||||||
|
@ -77,14 +76,10 @@ class _taskManagerSingleton extends App.Controller
|
||||||
App.Event.bind 'auth:login', =>
|
App.Event.bind 'auth:login', =>
|
||||||
@initialLoad = true
|
@initialLoad = true
|
||||||
@all()
|
@all()
|
||||||
|
@tasksInitial()
|
||||||
|
|
||||||
# render on logout
|
# render on logout
|
||||||
App.Event.bind 'auth:logout', =>
|
App.Event.bind 'auth:logout', =>
|
||||||
for task in @allTasks
|
|
||||||
worker = @worker( task.key )
|
|
||||||
if worker && worker.release
|
|
||||||
worker.release()
|
|
||||||
delete @workersStarted[ task.key ]
|
|
||||||
@reset()
|
@reset()
|
||||||
|
|
||||||
# send updates to server
|
# send updates to server
|
||||||
|
@ -127,7 +122,8 @@ class _taskManagerSingleton extends App.Controller
|
||||||
|
|
||||||
# create new task if not exists
|
# create new task if not exists
|
||||||
task = @get( key )
|
task = @get( key )
|
||||||
# console.log('add', key, callback, params, to_not_show, task)
|
console.log('TASKBAR RESET', @allTasks)
|
||||||
|
console.log('add', key, callback, params, to_not_show, task)
|
||||||
if !task
|
if !task
|
||||||
task = new App.Taskbar
|
task = new App.Taskbar
|
||||||
task.load(
|
task.load(
|
||||||
|
@ -279,8 +275,23 @@ class _taskManagerSingleton extends App.Controller
|
||||||
@taskUpdate( task )
|
@taskUpdate( task )
|
||||||
|
|
||||||
reset: =>
|
reset: =>
|
||||||
|
|
||||||
|
# release tasks
|
||||||
|
for task in @allTasks
|
||||||
|
worker = @worker( task.key )
|
||||||
|
if worker && worker.release
|
||||||
|
worker.release()
|
||||||
|
delete @workersStarted[ task.key ]
|
||||||
|
|
||||||
|
# clear instance vars
|
||||||
|
@tasksToUpdate = {}
|
||||||
@allTasks = []
|
@allTasks = []
|
||||||
|
@activeTask = undefined
|
||||||
|
|
||||||
|
# clear inmem tasks
|
||||||
App.Taskbar.deleteAll()
|
App.Taskbar.deleteAll()
|
||||||
|
|
||||||
|
# rerender task bar
|
||||||
App.Event.trigger 'task:render'
|
App.Event.trigger 'task:render'
|
||||||
|
|
||||||
TaskbarId: =>
|
TaskbarId: =>
|
||||||
|
@ -338,6 +349,7 @@ class _taskManagerSingleton extends App.Controller
|
||||||
return
|
return
|
||||||
|
|
||||||
tasksInitial: =>
|
tasksInitial: =>
|
||||||
|
|
||||||
# reopen tasks
|
# reopen tasks
|
||||||
App.Event.trigger 'taskbar:init'
|
App.Event.trigger 'taskbar:init'
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ class TaskbarTaskTest < TestCase
|
||||||
def test_persistant_task_with_relogin
|
def test_persistant_task_with_relogin
|
||||||
tests = [
|
tests = [
|
||||||
{
|
{
|
||||||
:name => 'persistant task',
|
:name => 'agent1 - create persistant task',
|
||||||
:action => [
|
:action => [
|
||||||
{
|
{
|
||||||
:execute => 'wait',
|
:execute => 'wait',
|
||||||
|
@ -145,9 +145,57 @@ class TaskbarTaskTest < TestCase
|
||||||
:execute => 'click',
|
:execute => 'click',
|
||||||
:css => 'a[href="#logout"]',
|
:css => 'a[href="#logout"]',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
:execute => 'check',
|
||||||
|
:css => '#login',
|
||||||
|
:result => true,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
:execute => 'wait',
|
:execute => 'wait',
|
||||||
:value => 1,
|
:value => 10,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:name => 'relogin with master - task are not viewable',
|
||||||
|
:action => [
|
||||||
|
{
|
||||||
|
:execute => 'set',
|
||||||
|
:css => 'input[name="username"]',
|
||||||
|
:value => 'master@example.com',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:execute => 'set',
|
||||||
|
:css => 'input[name="password"]',
|
||||||
|
:value => 'test'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:execute => 'click',
|
||||||
|
:css => '#login button',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:execute => 'wait',
|
||||||
|
:value => 6,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:execute => 'match',
|
||||||
|
:css => 'body',
|
||||||
|
:value => 'INBOUND TEST#1',
|
||||||
|
:match_result => false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:execute => 'match',
|
||||||
|
:css => 'body',
|
||||||
|
:value => 'OUTBOUND TEST#1',
|
||||||
|
:match_result => false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:execute => 'click',
|
||||||
|
:css => 'a[href="#current_user"]',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:execute => 'click',
|
||||||
|
:css => 'a[href="#logout"]',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
:execute => 'check',
|
:execute => 'check',
|
||||||
|
@ -166,6 +214,11 @@ class TaskbarTaskTest < TestCase
|
||||||
:value => 'OUTBOUND TEST#1',
|
:value => 'OUTBOUND TEST#1',
|
||||||
:match_result => false,
|
:match_result => false,
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
:name => 'relogin with agent - task are viewable',
|
||||||
|
:action => [
|
||||||
{
|
{
|
||||||
:execute => 'set',
|
:execute => 'set',
|
||||||
:css => 'input[name="username"]',
|
:css => 'input[name="username"]',
|
||||||
|
|
Loading…
Reference in a new issue