Skip to content

Commit

Permalink
Fixes #5138 - Reporting: Worse performance because UI always request …
Browse files Browse the repository at this point in the history
…all aggregation data instead of the selection.

Co-authored-by: Florian Liebe <fl@zammad.com>
  • Loading branch information
rolfschmidt and fliebe92 committed Apr 19, 2024
1 parent f09d27e commit f430093
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
26 changes: 15 additions & 11 deletions app/assets/javascripts/app/controllers/report.coffee
Expand Up @@ -361,21 +361,25 @@ class Download extends App.Controller
@table.update(objects: tickets)

tableUpdate: =>
state = {
metric: @params.metric
year: @params.year
month: @params.month
week: @params.week
day: @params.day
timeRange: @params.timeRange
profiles: @params.profileSelected
backends: @params.backendSelected
downloadBackendSelected: @params.downloadBackendSelected
}
return if _.isEqual(@lastState, state)
@lastState = state

@ajax(
id: 'report_download'
type: 'POST'
url: @apiPath + '/reports/sets'
data: JSON.stringify(
metric: @params.metric
year: @params.year
month: @params.month
week: @params.week
day: @params.day
timeRange: @params.timeRange
profiles: @params.profileSelected
backends: @params.backendSelected
downloadBackendSelected: @params.downloadBackendSelected
)
data: JSON.stringify(state)
processData: true
success: (data) =>
App.Collection.loadAssets(data.assets)
Expand Down
1 change: 1 addition & 0 deletions app/controllers/reports_controller.rb
Expand Up @@ -31,6 +31,7 @@ def generate
backend[:condition] = condition
end
next if !backend[:adapter]
next if params['backends'][backend[:name]].blank?

result[backend[:name]] = backend[:adapter].aggs(
range_start: get_params[:start],
Expand Down

0 comments on commit f430093

Please sign in to comment.