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