Class: ElasticStats

Inherits:
Arbre::Component
  • Object
show all
Defined in:
lib/elastic_stats.rb

Constant Summary collapse

CONTAINER_STYLE =
'display: flex; justify-content: center; align-items: center'
VALUE_STYLE =
'display: flex; flex:1; justify-content: center; align-items: center; flex-direction: column'

Instance Method Summary collapse

Instance Method Details

#build(model, attributes = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/elastic_stats.rb', line 7

def build(model, attributes = {})
  super(attributes)

  index_name = model.index_name
  panel("Elastic #{index_name.titleize} Stats") do
    div(style: CONTAINER_STYLE) do
      if Elasticsearch::Model.client.indices.exists(index: index_name)
        build_fields(index_name)
      else
        show_error(index_name)
      end
    end
  end
end