Added loading screen in admin interface. After all features are implemented, a more generic controller call will do the job.
This commit is contained in:
parent
adca7db4fe
commit
03cd05478e
13 changed files with 59 additions and 26 deletions
|
@ -531,6 +531,21 @@ class App.Controller extends Spine.Controller
|
|||
stopPropagation: (e) ->
|
||||
e.stopPropagation()
|
||||
|
||||
startLoading: (el) =>
|
||||
return if @initLoadingDone && !el
|
||||
@initLoadingDone = true
|
||||
@stopLoading()
|
||||
later = =>
|
||||
if el
|
||||
el.html App.view('generic/page_loading')()
|
||||
else
|
||||
@html App.view('generic/page_loading')()
|
||||
@initLoadingDoneDelay = @delay(later, 2800)
|
||||
|
||||
stopLoading: =>
|
||||
return if !@initLoadingDoneDelay
|
||||
@clearDelay(@initLoadingDoneDelay)
|
||||
|
||||
class App.ControllerPermanent extends App.Controller
|
||||
constructor: ->
|
||||
super
|
||||
|
|
|
@ -244,6 +244,9 @@ class App.ChannelEmailAccountOverview extends App.Controller
|
|||
#@load()
|
||||
|
||||
load: =>
|
||||
|
||||
@startLoading()
|
||||
|
||||
@ajax(
|
||||
id: 'email_index'
|
||||
type: 'GET'
|
||||
|
@ -251,6 +254,8 @@ class App.ChannelEmailAccountOverview extends App.Controller
|
|||
processData: true
|
||||
success: (data, status, xhr) =>
|
||||
|
||||
@stopLoading()
|
||||
|
||||
# load assets
|
||||
App.Collection.loadAssets(data.assets)
|
||||
|
||||
|
|
|
@ -8,12 +8,14 @@ class App.SettingsArea extends App.Controller
|
|||
@load()
|
||||
|
||||
load: ->
|
||||
@startLoading()
|
||||
@ajax(
|
||||
id: "setting_area_#{@area}"
|
||||
type: 'GET'
|
||||
url: "#{@apiPath}/settings/area/#{@area}"
|
||||
processData: true
|
||||
success: (data, status, xhr) =>
|
||||
@stopLoading()
|
||||
App.Collection.load( localStorage: false, type: 'Setting', data: data )
|
||||
@render()
|
||||
)
|
||||
|
|
|
@ -16,6 +16,7 @@ class Index extends App.ControllerContent
|
|||
#@load()
|
||||
|
||||
load: =>
|
||||
@startLoading()
|
||||
@ajax(
|
||||
id: 'calendar_index'
|
||||
type: 'GET'
|
||||
|
@ -29,6 +30,7 @@ class Index extends App.ControllerContent
|
|||
# load assets
|
||||
App.Collection.loadAssets(data.assets)
|
||||
|
||||
@stopLoading()
|
||||
@render(data)
|
||||
)
|
||||
|
||||
|
|
|
@ -10,12 +10,14 @@ class Index extends App.ControllerTabs
|
|||
@title 'Objects', true
|
||||
|
||||
# get data
|
||||
@startLoading()
|
||||
@ajax(
|
||||
id: 'object_manager_attributes_list'
|
||||
type: 'GET'
|
||||
url: @apiPath + '/object_manager_attributes_list'
|
||||
processData: true
|
||||
success: (data, status, xhr) =>
|
||||
@stopLoading()
|
||||
@build(data.objects)
|
||||
)
|
||||
|
||||
|
|
|
@ -20,11 +20,13 @@ class Index extends App.ControllerContent
|
|||
|
||||
# fetch data, render view
|
||||
load: ->
|
||||
@startLoading()
|
||||
@ajax(
|
||||
id: 'sessions'
|
||||
type: 'GET'
|
||||
url: @apiPath + '/sessions'
|
||||
success: (data) =>
|
||||
@stopLoading()
|
||||
@render(data)
|
||||
)
|
||||
|
||||
|
|
|
@ -15,16 +15,15 @@ class Index extends App.ControllerContent
|
|||
#@load()
|
||||
|
||||
load: =>
|
||||
@startLoading()
|
||||
@ajax(
|
||||
id: 'sla_index'
|
||||
type: 'GET'
|
||||
url: @apiPath + '/slas'
|
||||
processData: true
|
||||
success: (data, status, xhr) =>
|
||||
|
||||
# load assets
|
||||
App.Collection.loadAssets(data.assets)
|
||||
|
||||
@stopLoading()
|
||||
@render(data)
|
||||
)
|
||||
|
||||
|
|
|
@ -255,12 +255,14 @@ class TranslationList extends App.Controller
|
|||
)
|
||||
|
||||
load: =>
|
||||
@startLoading()
|
||||
@ajax(
|
||||
id: 'translations_admin'
|
||||
type: 'GET'
|
||||
url: @apiPath + "/translations/admin/lang/#{@locale}"
|
||||
processData: true
|
||||
success: (data, status, xhr) =>
|
||||
@stopLoading()
|
||||
@render(data)
|
||||
)
|
||||
|
||||
|
|
|
@ -47,16 +47,15 @@ class App.TriggerTime extends App.Controller
|
|||
#@load()
|
||||
|
||||
load: =>
|
||||
@startLoading()
|
||||
@ajax(
|
||||
id: 'trigger_time_index'
|
||||
type: 'GET'
|
||||
url: @apiPath + '/jobs'
|
||||
processData: true
|
||||
success: (data, status, xhr) =>
|
||||
|
||||
# load assets
|
||||
#App.Collection.loadAssets(data.assets)
|
||||
|
||||
@stopLoading()
|
||||
@render(data)
|
||||
)
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ class Index extends App.Controller
|
|||
@recent()
|
||||
|
||||
renderResult: (user_ids = []) ->
|
||||
@stopLoading()
|
||||
|
||||
callbackHeader = (header) ->
|
||||
attribute =
|
||||
|
@ -126,6 +127,7 @@ class Index extends App.Controller
|
|||
@$('.tab.active').each( (i,d) ->
|
||||
role_ids.push $(d).data('id')
|
||||
)
|
||||
@startLoading(@$('.table-overview'))
|
||||
App.Ajax.request(
|
||||
id: 'search'
|
||||
type: 'GET'
|
||||
|
@ -137,11 +139,10 @@ class Index extends App.Controller
|
|||
full: 1
|
||||
processData: true,
|
||||
success: (data, status, xhr) =>
|
||||
|
||||
# load assets
|
||||
App.Collection.loadAssets(data.assets)
|
||||
|
||||
@renderResult(data.user_ids)
|
||||
done: =>
|
||||
@stopLoading()
|
||||
)
|
||||
|
||||
recent: =>
|
||||
|
@ -149,6 +150,7 @@ class Index extends App.Controller
|
|||
@$('.tab.active').each( (i,d) ->
|
||||
role_ids.push $(d).data('id')
|
||||
)
|
||||
@startLoading(@$('.table-overview'))
|
||||
App.Ajax.request(
|
||||
id: 'search'
|
||||
type: 'GET'
|
||||
|
@ -159,11 +161,10 @@ class Index extends App.Controller
|
|||
full: 1
|
||||
processData: true,
|
||||
success: (data, status, xhr) =>
|
||||
|
||||
# load assets
|
||||
App.Collection.loadAssets(data.assets)
|
||||
|
||||
@renderResult(data.user_ids)
|
||||
complete: =>
|
||||
@stopLoading()
|
||||
)
|
||||
|
||||
new: (e) ->
|
||||
|
|
|
@ -32,7 +32,7 @@ class _delaySingleton extends Spine.Module
|
|||
constructor: ->
|
||||
@levelStack = {}
|
||||
|
||||
set: ( callback, timeout, key, level ) ->
|
||||
set: ( callback, timeout, key, level ) =>
|
||||
|
||||
if !level
|
||||
level = '_all'
|
||||
|
@ -59,9 +59,9 @@ class _delaySingleton extends Spine.Module
|
|||
level: level
|
||||
}
|
||||
|
||||
return delay_id
|
||||
key.toString()
|
||||
|
||||
clear: ( key, level ) ->
|
||||
clear: ( key, level ) =>
|
||||
|
||||
if !level
|
||||
level = '_all'
|
||||
|
@ -80,19 +80,19 @@ class _delaySingleton extends Spine.Module
|
|||
if _.isEmpty( @levelStack[ level ] )
|
||||
delete @levelStack[ level ]
|
||||
|
||||
clearLevel: (level) ->
|
||||
clearLevel: (level) =>
|
||||
return if !@levelStack[ level ]
|
||||
for key, data of @levelStack[ level ]
|
||||
@clear( key, level )
|
||||
delete @levelStack[level]
|
||||
|
||||
reset: ->
|
||||
reset: =>
|
||||
for level, items of @levelStack
|
||||
for key, data of items
|
||||
@clear( key, level )
|
||||
@levelStack[level] = {}
|
||||
true
|
||||
|
||||
_all: ->
|
||||
_all: =>
|
||||
@levelStack
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ class _intervalSingleton extends Spine.Module
|
|||
constructor: ->
|
||||
@levelStack = {}
|
||||
|
||||
set: ( callback, timeout, key, level ) ->
|
||||
set: ( callback, timeout, key, level ) =>
|
||||
|
||||
if !level
|
||||
level = '_all'
|
||||
|
@ -57,9 +57,9 @@ class _intervalSingleton extends Spine.Module
|
|||
level: level
|
||||
}
|
||||
|
||||
return interval_id
|
||||
key.toString()
|
||||
|
||||
clear: ( key, level ) ->
|
||||
clear: ( key, level ) =>
|
||||
|
||||
if !level
|
||||
level = '_all'
|
||||
|
@ -78,18 +78,18 @@ class _intervalSingleton extends Spine.Module
|
|||
if _.isEmpty( @levelStack[ level ] )
|
||||
delete @levelStack[ level ]
|
||||
|
||||
clearLevel: (level) ->
|
||||
clearLevel: (level) =>
|
||||
return if !@levelStack[ level ]
|
||||
for key, data of @levelStack[ level ]
|
||||
@clear( key, level )
|
||||
delete @levelStack[level]
|
||||
|
||||
reset: ->
|
||||
reset: =>
|
||||
for level, items of @levelStack
|
||||
for key, data of items
|
||||
@clear( key, level )
|
||||
@levelStack[level] = {}
|
||||
true
|
||||
|
||||
_all: ->
|
||||
_all: =>
|
||||
@levelStack
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
<div class="page-loading">
|
||||
<div class="small loading icon"></div>
|
||||
<div class="page-loading-label"><%- @T('Loading...') %></div>
|
||||
</div>
|
Loading…
Reference in a new issue