Reduced dom operations at loading time.
This commit is contained in:
parent
c4a74d0e3d
commit
6b3d1612a8
7 changed files with 41 additions and 46 deletions
|
@ -544,7 +544,7 @@ class App.Controller extends Spine.Controller
|
||||||
metaTaskUpdate: ->
|
metaTaskUpdate: ->
|
||||||
App.Delay.set(
|
App.Delay.set(
|
||||||
-> App.Event.trigger 'task:render'
|
-> App.Event.trigger 'task:render'
|
||||||
450
|
App.TaskManager.renderDelay()
|
||||||
'meta-task-update'
|
'meta-task-update'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -382,6 +382,7 @@ class App.Navigation extends App.ControllerWidgetPermanent
|
||||||
|
|
||||||
update: (url) =>
|
update: (url) =>
|
||||||
@$('.is-active').removeClass('is-active')
|
@$('.is-active').removeClass('is-active')
|
||||||
|
return if !url || url is '#'
|
||||||
@$("[href=\"#{url}\"]").addClass('is-active')
|
@$("[href=\"#{url}\"]").addClass('is-active')
|
||||||
|
|
||||||
recentViewNavbarItemsRebuild: =>
|
recentViewNavbarItemsRebuild: =>
|
||||||
|
|
|
@ -26,30 +26,31 @@ class App.TaskbarWidget extends App.Controller
|
||||||
for task in tasks
|
for task in tasks
|
||||||
|
|
||||||
# collect meta data of task for task bar item
|
# collect meta data of task for task bar item
|
||||||
data =
|
meta =
|
||||||
url: '#'
|
url: '#'
|
||||||
id: false
|
id: false
|
||||||
iconClass: 'loading'
|
iconClass: 'loading'
|
||||||
title: App.i18n.translateInline('Loading...')
|
title: App.i18n.translateInline('Loading...')
|
||||||
head: App.i18n.translateInline('Loading...')
|
head: App.i18n.translateInline('Loading...')
|
||||||
|
active: false
|
||||||
worker = App.TaskManager.worker(task.key)
|
worker = App.TaskManager.worker(task.key)
|
||||||
if worker
|
if worker
|
||||||
meta = worker.meta()
|
data = worker.meta()
|
||||||
|
|
||||||
# apply meta data of controller
|
# apply meta data of controller
|
||||||
if meta
|
if data
|
||||||
for key, value of meta
|
for key, value of data
|
||||||
data[key] = value
|
meta[key] = value
|
||||||
|
|
||||||
# collect new task bar items
|
# collect new task bar items
|
||||||
item = {}
|
item = {}
|
||||||
item.task = task
|
item.task = task
|
||||||
item.data = data
|
item.meta = meta
|
||||||
taskItems.push item
|
taskItems.push item
|
||||||
|
|
||||||
# set title
|
# set title
|
||||||
if task.active
|
if task.active
|
||||||
@title data.title
|
@title meta.title
|
||||||
|
|
||||||
@html App.view('task_widget_tasks')(
|
@html App.view('task_widget_tasks')(
|
||||||
taskItems: taskItems
|
taskItems: taskItems
|
||||||
|
|
|
@ -365,7 +365,7 @@ class App.TicketZoom extends App.Controller
|
||||||
formMeta: @formMeta
|
formMeta: @formMeta
|
||||||
)
|
)
|
||||||
|
|
||||||
# render init page
|
# render init content
|
||||||
if elLocal
|
if elLocal
|
||||||
@html elLocal
|
@html elLocal
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,9 @@ class App.Run extends App.Controller
|
||||||
# create web socket connection
|
# create web socket connection
|
||||||
App.WebSocket.connect()
|
App.WebSocket.connect()
|
||||||
|
|
||||||
|
# init tasks
|
||||||
|
App.TaskManager.init()
|
||||||
|
|
||||||
# start frontend time update
|
# start frontend time update
|
||||||
@frontendTimeUpdate()
|
@frontendTimeUpdate()
|
||||||
|
|
||||||
|
|
|
@ -5,65 +5,44 @@ class App.TaskManager
|
||||||
_instance ?= new _taskManagerSingleton( params )
|
_instance ?= new _taskManagerSingleton( params )
|
||||||
|
|
||||||
@all: ->
|
@all: ->
|
||||||
if _instance == undefined
|
|
||||||
_instance ?= new _taskManagerSingleton
|
|
||||||
_instance.all()
|
_instance.all()
|
||||||
|
|
||||||
@execute: ( params ) ->
|
@execute: ( params ) ->
|
||||||
if _instance == undefined
|
|
||||||
_instance ?= new _taskManagerSingleton
|
|
||||||
_instance.execute( params )
|
_instance.execute( params )
|
||||||
|
|
||||||
@get: ( key ) ->
|
@get: ( key ) ->
|
||||||
if _instance == undefined
|
|
||||||
_instance ?= new _taskManagerSingleton
|
|
||||||
_instance.get( key )
|
_instance.get( key )
|
||||||
|
|
||||||
@update: ( key, params ) ->
|
@update: ( key, params ) ->
|
||||||
if _instance == undefined
|
|
||||||
_instance ?= new _taskManagerSingleton
|
|
||||||
_instance.update( key, params )
|
_instance.update( key, params )
|
||||||
|
|
||||||
@remove: (key, rerender = true) ->
|
@remove: (key, rerender = true) ->
|
||||||
if _instance == undefined
|
|
||||||
_instance ?= new _taskManagerSingleton
|
|
||||||
_instance.remove(key, rerender)
|
_instance.remove(key, rerender)
|
||||||
|
|
||||||
@notify: ( key ) ->
|
@notify: ( key ) ->
|
||||||
if _instance == undefined
|
|
||||||
_instance ?= new _taskManagerSingleton
|
|
||||||
_instance.notify( key )
|
_instance.notify( key )
|
||||||
|
|
||||||
@mute: ( key ) ->
|
@mute: ( key ) ->
|
||||||
if _instance == undefined
|
|
||||||
_instance ?= new _taskManagerSingleton
|
|
||||||
_instance.mute( key )
|
_instance.mute( key )
|
||||||
|
|
||||||
@reorder: ( order ) ->
|
@reorder: ( order ) ->
|
||||||
if _instance == undefined
|
|
||||||
_instance ?= new _taskManagerSingleton
|
|
||||||
_instance.reorder( order )
|
_instance.reorder( order )
|
||||||
|
|
||||||
@reset: ->
|
@reset: ->
|
||||||
if _instance == undefined
|
|
||||||
_instance ?= new _taskManagerSingleton
|
|
||||||
_instance.reset()
|
_instance.reset()
|
||||||
|
|
||||||
@worker: ( key ) ->
|
@worker: ( key ) ->
|
||||||
if _instance == undefined
|
|
||||||
_instance ?= new _taskManagerSingleton
|
|
||||||
_instance.worker( key )
|
_instance.worker( key )
|
||||||
|
|
||||||
@nextTaskUrl: ->
|
@nextTaskUrl: ->
|
||||||
if _instance == undefined
|
|
||||||
_instance ?= new _taskManagerSingleton
|
|
||||||
_instance.nextTaskUrl()
|
_instance.nextTaskUrl()
|
||||||
|
|
||||||
@TaskbarId: ->
|
@TaskbarId: ->
|
||||||
if _instance == undefined
|
|
||||||
_instance ?= new _taskManagerSingleton
|
|
||||||
_instance.TaskbarId()
|
_instance.TaskbarId()
|
||||||
|
|
||||||
|
@renderDelay: ->
|
||||||
|
_instance.renderDelay()
|
||||||
|
|
||||||
class _taskManagerSingleton extends App.Controller
|
class _taskManagerSingleton extends App.Controller
|
||||||
@include App.LogInclude
|
@include App.LogInclude
|
||||||
|
|
||||||
|
@ -98,6 +77,7 @@ class _taskManagerSingleton extends App.Controller
|
||||||
@allTasks = []
|
@allTasks = []
|
||||||
@tasksToUpdate = {}
|
@tasksToUpdate = {}
|
||||||
@activeTaskHistory = []
|
@activeTaskHistory = []
|
||||||
|
@renderDelayTime = 600
|
||||||
|
|
||||||
all: ->
|
all: ->
|
||||||
|
|
||||||
|
@ -511,9 +491,19 @@ class _taskManagerSingleton extends App.Controller
|
||||||
persistent: false
|
persistent: false
|
||||||
init: true
|
init: true
|
||||||
)
|
)
|
||||||
task_count * 600
|
task_count * 450
|
||||||
undefined
|
undefined
|
||||||
'task'
|
'task'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# set new renderDelayTime
|
||||||
|
App.Delay.set(
|
||||||
|
=>
|
||||||
|
@renderDelayTime = 20
|
||||||
|
task_count * 450
|
||||||
|
)
|
||||||
|
|
||||||
App.Event.trigger 'taskbar:ready'
|
App.Event.trigger 'taskbar:ready'
|
||||||
|
|
||||||
|
renderDelay: =>
|
||||||
|
@renderDelayTime
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
<% for item in @taskItems: %>
|
<% for item in @taskItems: %>
|
||||||
<a href="<%- item.data.url %>" title="<%= item.data.title %>" class="nav-tab task <%= item.data.class %><% if item.task.active: %> is-active<% end %><% if item.task.notify: %> is-modified<% end %>" data-key="<%- item.task.key %>">
|
<a href="<%- item.meta.url %>" title="<%= item.meta.title %>" class="nav-tab task <%= item.meta.class %><% if item.task.active: %> is-active<% end %><% if item.task.notify: %> is-modified<% end %>" data-key="<%- item.task.key %>">
|
||||||
<div class="nav-tab-icon" title="<%- @Ti(item.data.iconTitle) %>">
|
<div class="nav-tab-icon" title="<%- @Ti(item.meta.iconTitle) %>">
|
||||||
<% if item.data.type is 'task': %>
|
<% if item.meta.type is 'task': %>
|
||||||
<% if item.task.notify: %>
|
<% if item.task.notify: %>
|
||||||
<%- @Icon('status-modified-inner-circle', "icon-task-state #{item.data.iconClass}") %>
|
<%- @Icon('status-modified-inner-circle', "icon-task-state #{item.meta.iconClass}") %>
|
||||||
<%- @Icon('status-modified-outer-circle', "icon-task-state #{item.data.iconClass}") %>
|
<%- @Icon('status-modified-outer-circle', "icon-task-state #{item.meta.iconClass}") %>
|
||||||
<% else: %>
|
<% else: %>
|
||||||
<%- @Icon('task-state', item.data.iconClass) %>
|
<%- @Icon('task-state', item.meta.iconClass) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% else: %>
|
<% else: %>
|
||||||
<%- @Icon(item.data.iconClass) %>
|
<%- @Icon(item.meta.iconClass) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<div class="nav-tab-name u-textTruncate flex"><%= item.data.head %></div>
|
<div class="nav-tab-name u-textTruncate flex"><%= item.meta.head %></div>
|
||||||
<div class="nav-tab-close js-close" title="<%- @Ti('close') %>">
|
<div class="nav-tab-close js-close" title="<%- @Ti('close') %>">
|
||||||
<div class="nav-tab-close-inner">
|
<div class="nav-tab-close-inner">
|
||||||
<%- @Icon('diagonal-cross') %>
|
<%- @Icon('diagonal-cross') %>
|
||||||
|
|
Loading…
Reference in a new issue