Added limit to preview.
This commit is contained in:
parent
e727a548ed
commit
e0293f08e5
4 changed files with 12 additions and 120 deletions
|
@ -90,6 +90,7 @@ class ReportsController < ApplicationController
|
|||
interval: get_params[:range],
|
||||
selector: backend[:condition],
|
||||
params: backend[:params],
|
||||
sheet: params[:sheet],
|
||||
)
|
||||
|
||||
# generate sheet
|
||||
|
|
|
@ -64,18 +64,6 @@ class Report
|
|||
adapter: Report::TicketMoved,
|
||||
params: { type: 'out' },
|
||||
},
|
||||
#{
|
||||
# name: 'sla_in',
|
||||
# display: 'SLA in',
|
||||
# selected: false,
|
||||
# dataDownload: true,
|
||||
#},
|
||||
#{
|
||||
# name: 'sla_out',
|
||||
# display: 'SLA out',
|
||||
# selected: false,
|
||||
# dataDownload: true,
|
||||
#},
|
||||
]
|
||||
config[:metric][:count][:backend] = backend
|
||||
|
||||
|
@ -228,51 +216,6 @@ class Report
|
|||
]
|
||||
config[:metric][:create_channels][:backend] = backend
|
||||
|
||||
config[:metric][:times] = {
|
||||
name: 'times',
|
||||
display: 'Times',
|
||||
prio: 8000,
|
||||
}
|
||||
backend = [
|
||||
{
|
||||
name: 'first_response_average',
|
||||
display: 'First Response average',
|
||||
selected: true,
|
||||
dataDownload: false,
|
||||
},
|
||||
{
|
||||
name: 'first_response_max',
|
||||
display: 'First Response max',
|
||||
selected: false,
|
||||
dataDownload: true,
|
||||
},
|
||||
{
|
||||
name: 'first_response_min',
|
||||
display: 'First Response min',
|
||||
selected: false,
|
||||
dataDownload: true,
|
||||
},
|
||||
{
|
||||
name: 'solution_time_average',
|
||||
display: 'Solution Time average',
|
||||
selected: true,
|
||||
dataDownload: false,
|
||||
},
|
||||
{
|
||||
name: 'solution_time_max',
|
||||
display: 'Solution Time max',
|
||||
selected: false,
|
||||
dataDownload: true,
|
||||
},
|
||||
{
|
||||
name: 'solution_time_min',
|
||||
display: 'Solution Time min',
|
||||
selected: false,
|
||||
dataDownload: true,
|
||||
},
|
||||
]
|
||||
config[:metric][:times][:backend] = backend
|
||||
|
||||
config[:metric][:communication] = {
|
||||
name: 'communication',
|
||||
display: 'Communication',
|
||||
|
@ -358,64 +301,7 @@ class Report
|
|||
},
|
||||
]
|
||||
config[:metric][:communication][:backend] = backend
|
||||
=begin
|
||||
config[:metric][:sla] = {
|
||||
name: 'sla',
|
||||
display: 'SLAs',
|
||||
prio: 6000,
|
||||
}
|
||||
backend = [
|
||||
{
|
||||
name: 'sla_out_1',
|
||||
display: 'SLA (out) - <1h',
|
||||
selected: false,
|
||||
dataDownload: true,
|
||||
},
|
||||
{
|
||||
name: 'sla_out_2',
|
||||
display: 'SLA (out) - <2h',
|
||||
selected: false,
|
||||
dataDownload: true,
|
||||
},
|
||||
{
|
||||
name: 'sla_out_4',
|
||||
display: 'SLA (out) - <4h',
|
||||
selected: false,
|
||||
dataDownload: true,
|
||||
},
|
||||
{
|
||||
name: 'sla_out_8',
|
||||
display: 'SLA (out) - <8h',
|
||||
selected: true,
|
||||
dataDownload: true,
|
||||
},
|
||||
{
|
||||
name: 'sla_in_1',
|
||||
display: 'SLA (in) - <1h',
|
||||
selected: true,
|
||||
dataDownload: true,
|
||||
},
|
||||
{
|
||||
name: 'sla_in_2',
|
||||
display: 'SLA (in) - <2h',
|
||||
selected: false,
|
||||
dataDownload: true,
|
||||
},
|
||||
{
|
||||
name: 'sla_in_4',
|
||||
display: 'SLA (in) - <4h',
|
||||
selected: false,
|
||||
dataDownload: true,
|
||||
},
|
||||
{
|
||||
name: 'sla_in_8',
|
||||
display: 'SLA (in) - <8h',
|
||||
selected: false,
|
||||
dataDownload: true,
|
||||
},
|
||||
]
|
||||
config[:metric][:sla][:backend] = backend
|
||||
=end
|
||||
|
||||
config[:metric].each {|metric_key, metric_value|
|
||||
metric_value[:backend].each {|metric_backend|
|
||||
metric_backend[:name] = "#{metric_key}::#{metric_backend[:name]}"
|
||||
|
|
|
@ -135,12 +135,17 @@ returns
|
|||
field: params[:params][:field],
|
||||
}
|
||||
|
||||
limit = 1000
|
||||
if !params[:sheet]
|
||||
limit = 100
|
||||
end
|
||||
|
||||
selector = params[:selector].clone
|
||||
if params[:params] && params[:params][:selector]
|
||||
selector = selector.merge(params[:params][:selector])
|
||||
end
|
||||
|
||||
result = SearchIndexBackend.selectors(['Ticket'], selector, nil, nil, aggs_interval)
|
||||
result = SearchIndexBackend.selectors(['Ticket'], selector, limit, nil, aggs_interval)
|
||||
assets = {}
|
||||
result[:ticket_ids].each {|ticket_id|
|
||||
ticket_full = Ticket.find(ticket_id)
|
||||
|
|
|
@ -269,7 +269,7 @@ get count of tickets and tickets which match on selector
|
|||
|
||||
=end
|
||||
|
||||
def self.selectors(index = nil, selectors = nil, _limit = 10, current_user = nil, aggs_interval = nil)
|
||||
def self.selectors(index = nil, selectors = nil, limit = 10, current_user = nil, aggs_interval = nil)
|
||||
fail 'no selectors given' if !selectors
|
||||
|
||||
url = build_url()
|
||||
|
@ -284,7 +284,7 @@ get count of tickets and tickets which match on selector
|
|||
url += '/_search'
|
||||
end
|
||||
|
||||
data = selector2query(selectors, current_user, aggs_interval)
|
||||
data = selector2query(selectors, current_user, aggs_interval, limit)
|
||||
|
||||
Rails.logger.info "# curl -X POST \"#{url}\" \\"
|
||||
Rails.logger.debug " -d'#{data.to_json}'"
|
||||
|
@ -320,7 +320,7 @@ get count of tickets and tickets which match on selector
|
|||
response.data
|
||||
end
|
||||
|
||||
def self.selector2query(selector, _current_user, aggs_interval)
|
||||
def self.selector2query(selector, _current_user, aggs_interval, limit)
|
||||
filter_must = []
|
||||
filter_must_not = []
|
||||
query_must = []
|
||||
|
@ -351,7 +351,7 @@ get count of tickets and tickets which match on selector
|
|||
end
|
||||
data = {
|
||||
query: {},
|
||||
size: 1000,
|
||||
size: limit,
|
||||
}
|
||||
|
||||
# add aggs to filter
|
||||
|
|
Loading…
Reference in a new issue