Module: ActiveEndpoint::ApplicationHelper

Defined in:
app/helpers/active_endpoint/application_helper.rb

Constant Summary collapse

SETTINGS =
[
  :cache_store_client,
  :cache_prefix,
  :constraint_limit,
  :constraint_period,
  :logger,
  :log_probe_info,
  :log_debug_info,
  :storage_limit,
  :storage_period,
  :storage_keep_periods
].freeze
TAGS_COLORS =
[
  'label-info',
  'label-success',
  'label-warning',
  'label-danger',
  'label-default'
].freeze

Instance Method Summary collapse

Instance Method Details

#actionsObject



53
54
55
# File 'app/helpers/active_endpoint/application_helper.rb', line 53

def actions
  ActiveEndpoint.blacklist.actions
end

#actions_constraintsObject



73
74
75
76
77
# File 'app/helpers/active_endpoint/application_helper.rb', line 73

def actions_constraints
  ActiveEndpoint.constraints.actions.map do |endpoint, constraints|
    constraints_for_html(endpoint, constraints)
  end
end

#endpointsObject



45
46
47
# File 'app/helpers/active_endpoint/application_helper.rb', line 45

def endpoints
  ActiveEndpoint.blacklist.endpoints
end

#endpoints_constraintsObject



61
62
63
64
65
# File 'app/helpers/active_endpoint/application_helper.rb', line 61

def endpoints_constraints
  ActiveEndpoint.constraints.endpoints.map do |endpoint, constraints|
    constraints_for_html(endpoint, constraints)
  end
end

#label_for(tag) ⇒ Object



41
42
43
# File 'app/helpers/active_endpoint/application_helper.rb', line 41

def label_for(tag)
  TAGS_COLORS[ActiveEndpoint.tags.definition.keys.index(tag.to_sym)]
end

#resourcesObject



49
50
51
# File 'app/helpers/active_endpoint/application_helper.rb', line 49

def resources
  ActiveEndpoint.blacklist.resources
end

#resources_constraintsObject



67
68
69
70
71
# File 'app/helpers/active_endpoint/application_helper.rb', line 67

def resources_constraints
  ActiveEndpoint.constraints.resources.map do |endpoint, constraints|
    constraints_for_html(endpoint, constraints)
  end
end

#scopesObject



57
58
59
# File 'app/helpers/active_endpoint/application_helper.rb', line 57

def scopes
  ActiveEndpoint.blacklist.scopes
end

#scopes_constraintsObject



79
80
81
82
83
# File 'app/helpers/active_endpoint/application_helper.rb', line 79

def scopes_constraints
  ActiveEndpoint.constraints.scopes.map do |endpoint, constraints|
    constraints_for_html(endpoint, constraints)
  end
end

#settingsObject



24
25
26
# File 'app/helpers/active_endpoint/application_helper.rb', line 24

def settings
  SETTINGS
end

#tagsObject



28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/helpers/active_endpoint/application_helper.rb', line 28

def tags
  tags = []
  ActiveEndpoint.tags.definition.to_a.each_with_index do |definition, index|
    tags << [
      definition.first,
      tag_label_by(index),
      definition.last,
      "ActiveEndpoint::Probe.tagged_as(:#{definition.first})"
    ]
  end
  tags
end