Class: Sentiero::Web::Views::ProblemShowView

Inherits:
BaseView
  • Object
show all
Defined in:
lib/sentiero/web/views/problem_show_view.rb

Constant Summary

Constants inherited from BaseView

BaseView::TEMPLATES_DIR, BaseView::TEMPLATE_CACHE

Constants included from Escaping

Escaping::HTML_UNSAFE_IN_SCRIPT, Escaping::HTML_UNSAFE_IN_SCRIPT_PATTERN

Instance Attribute Summary collapse

Attributes inherited from BaseView

#base_path, #csrf_token

Instance Method Summary collapse

Methods inherited from BaseView

#built_asset, compiled_template, #escape_js, #h, #range_pairs, #render, #render_layout, #render_partial, #render_session_row

Methods included from Formatting

#format_duration, #format_vital, #parse_browser, #parse_device

Methods included from Escaping

#escape_html, #escape_js_string, #escape_json

Constructor Details

#initialize(problem:, occurrences:, session_ids:, session_summaries:, facets:, trend:) ⇒ ProblemShowView

Returns a new instance of ProblemShowView.



9
10
11
12
13
14
15
16
17
# File 'lib/sentiero/web/views/problem_show_view.rb', line 9

def initialize(problem:, occurrences:, session_ids:, session_summaries:, facets:, trend:)
  super()
  @problem = problem
  @occurrences = occurrences
  @session_ids = session_ids
  @session_summaries = session_summaries
  @facets = facets
  @trend = trend
end

Instance Attribute Details

#facetsObject (readonly)

Returns the value of attribute facets.



19
20
21
# File 'lib/sentiero/web/views/problem_show_view.rb', line 19

def facets
  @facets
end

#occurrencesObject (readonly)

Returns the value of attribute occurrences.



19
20
21
# File 'lib/sentiero/web/views/problem_show_view.rb', line 19

def occurrences
  @occurrences
end

#problemObject (readonly)

Returns the value of attribute problem.



19
20
21
# File 'lib/sentiero/web/views/problem_show_view.rb', line 19

def problem
  @problem
end

#session_idsObject (readonly)

Returns the value of attribute session_ids.



19
20
21
# File 'lib/sentiero/web/views/problem_show_view.rb', line 19

def session_ids
  @session_ids
end

#session_summariesObject (readonly)

Returns the value of attribute session_summaries.



19
20
21
# File 'lib/sentiero/web/views/problem_show_view.rb', line 19

def session_summaries
  @session_summaries
end

#trendObject (readonly)

Returns the value of attribute trend.



19
20
21
# File 'lib/sentiero/web/views/problem_show_view.rb', line 19

def trend
  @trend
end

Instance Method Details

#facet_groupsObject



34
35
36
37
38
39
40
# File 'lib/sentiero/web/views/problem_show_view.rb', line 34

def facet_groups
  [
    ["Top Request Paths", facets[:paths]],
    ["Environments", facets[:environments]],
    ["Browsers", facets[:browsers]]
  ]
end

#has_facets?Boolean

Returns:

  • (Boolean)


42
# File 'lib/sentiero/web/views/problem_show_view.rb', line 42

def has_facets? = facets[:releases].any? || facet_groups.any? { |_title, rows| rows.any? }

#replay_href(s) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/sentiero/web/views/problem_show_view.rb', line 23

def replay_href(s)
  sid = s[:session_id]
  if s[:window_id]
    "#{h(base_path)}/sessions/#{h(sid)}/windows/#{h(s[:window_id])}"
  else
    "#{h(base_path)}/sessions/#{h(sid)}"
  end
end

#spark_maxObject



32
# File 'lib/sentiero/web/views/problem_show_view.rb', line 32

def spark_max = trend[:series].map { |day| day[:count] }.max || 0

#templateObject



21
# File 'lib/sentiero/web/views/problem_show_view.rb', line 21

def template = "problem_show.html.erb"