Small improvements.
This commit is contained in:
parent
6ba881a327
commit
228d6dd001
1 changed files with 25 additions and 18 deletions
|
@ -186,24 +186,30 @@ class Download extends App.Controller
|
||||||
render: ->
|
render: ->
|
||||||
|
|
||||||
reports = []
|
reports = []
|
||||||
|
|
||||||
|
# select first backend, if no backend is selected
|
||||||
$('.js-backendSelector:checked').each( (index, element) ->
|
$('.js-backendSelector:checked').each( (index, element) ->
|
||||||
if $(element).hasClass('download')
|
if $(element).hasClass('download')
|
||||||
value = $(element).val()
|
value = $(element).val()
|
||||||
reports.push value
|
reports.push value
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# get used profiles
|
||||||
profiles = []
|
profiles = []
|
||||||
for key, value of @params.profileSelected
|
for key, value of @params.profileSelected
|
||||||
profiles.push App.ReportProfile.find(key)
|
if value
|
||||||
console.log('reports', reports, 'profiles', profiles, @config.metric, @params.metric, @config.metric[@params.metric])
|
if !@profileSelectedId
|
||||||
|
@profileSelectedId = key
|
||||||
|
profiles.push App.ReportProfile.find(key)
|
||||||
|
|
||||||
@html App.view('report/download_header')(
|
@html App.view('report/download_header')(
|
||||||
reports: reports
|
reports: reports
|
||||||
profiles: profiles
|
profiles: profiles
|
||||||
metric: @config.metric[@params.metric]
|
metric: @config.metric[@params.metric]
|
||||||
)
|
)
|
||||||
|
|
||||||
@profileSelected = ''
|
@backendSelected = ''
|
||||||
@backendSelected = ''
|
|
||||||
active = false
|
active = false
|
||||||
@el.find('.js-dataDownloadBackendSelector').each( (index, element) ->
|
@el.find('.js-dataDownloadBackendSelector').each( (index, element) ->
|
||||||
if $(element).parent().hasClass('active')
|
if $(element).parent().hasClass('active')
|
||||||
|
@ -212,10 +218,11 @@ class Download extends App.Controller
|
||||||
if !active
|
if !active
|
||||||
@el.find('.js-dataDownloadBackendSelector').first().parent().addClass('active')
|
@el.find('.js-dataDownloadBackendSelector').first().parent().addClass('active')
|
||||||
|
|
||||||
|
# rerender view after backend is selected
|
||||||
@el.find('.js-dataDownloadBackendSelector').each( (index, element) =>
|
@el.find('.js-dataDownloadBackendSelector').each( (index, element) =>
|
||||||
if $(element).parent().hasClass('active')
|
if $(element).parent().hasClass('active')
|
||||||
@profileSelected = $(element).data('profile')
|
@profileSelectedId = $(element).data('profile-id')
|
||||||
@backendSelected = $(element).data('report')
|
@backendSelected = $(element).data('backend')
|
||||||
)
|
)
|
||||||
|
|
||||||
@tableUpdate()
|
@tableUpdate()
|
||||||
|
@ -225,8 +232,8 @@ class Download extends App.Controller
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
@el.find('.js-dataDownloadBackendSelector').parent().removeClass('active')
|
@el.find('.js-dataDownloadBackendSelector').parent().removeClass('active')
|
||||||
$(e.target).parent().addClass('active')
|
$(e.target).parent().addClass('active')
|
||||||
@profileSelected = $(e.target).data('profile')
|
@profileSelectedId = $(e.target).data('profile-id')
|
||||||
@backendSelected = $(e.target).data('backend')
|
@backendSelected = $(e.target).data('backend')
|
||||||
|
|
||||||
table = (tickets, count) =>
|
table = (tickets, count) =>
|
||||||
url = '#ticket/zoom/'
|
url = '#ticket/zoom/'
|
||||||
|
@ -248,14 +255,14 @@ class Download extends App.Controller
|
||||||
type: 'POST'
|
type: 'POST'
|
||||||
url: @apiPath + '/reports/sets'
|
url: @apiPath + '/reports/sets'
|
||||||
data: JSON.stringify(
|
data: JSON.stringify(
|
||||||
metric: @params.metric
|
metric: @params.metric
|
||||||
year: @params.year
|
year: @params.year
|
||||||
month: @params.month
|
month: @params.month
|
||||||
week: @params.week
|
week: @params.week
|
||||||
day: @params.day
|
day: @params.day
|
||||||
timeRange: @params.timeRange
|
timeRange: @params.timeRange
|
||||||
profiles: @params.profileSelected
|
profile_id: @profileSelectedId
|
||||||
|
backend: @backendSelected
|
||||||
)
|
)
|
||||||
processData: true
|
processData: true
|
||||||
success: (data) =>
|
success: (data) =>
|
||||||
|
@ -270,7 +277,7 @@ class Download extends App.Controller
|
||||||
ticket = App.TicketReport.fullLocal( record.id )
|
ticket = App.TicketReport.fullLocal( record.id )
|
||||||
ticket_collection.push ticket
|
ticket_collection.push ticket
|
||||||
|
|
||||||
table( ticket_collection, data.count )
|
table(ticket_collection, data.count)
|
||||||
)
|
)
|
||||||
|
|
||||||
class TimeRangePicker extends App.Controller
|
class TimeRangePicker extends App.Controller
|
||||||
|
@ -485,4 +492,4 @@ class Sidebar extends App.Controller
|
||||||
App.Event.trigger( 'ui:report:rerender' )
|
App.Event.trigger( 'ui:report:rerender' )
|
||||||
|
|
||||||
App.Config.set( 'report', Index, 'Routes' )
|
App.Config.set( 'report', Index, 'Routes' )
|
||||||
App.Config.set( 'Reporting', { prio: 8000, parent: '', name: 'Reporing', translate: true, target: '#report', icon: 'report', role: ['Admin'] }, 'NavBarRight' )
|
App.Config.set( 'Reporting', { prio: 8000, parent: '', name: 'Reporing', translate: true, target: '#report', icon: 'report', role: ['Report'] }, 'NavBarRight' )
|
Loading…
Reference in a new issue