Show information for each secondary node on Geo Nodes page

[ci skip]
parent 8419ebfb
.geo-node-icon-enabled {
.geo-node-icon-healthy {
color: $gl-success;
}
.geo-node-icon-disabled {
.geo-node-icon-unhealthy {
color: $gl-danger;
}
.geo-node-icon-disabled {
color: $gray-darkest;
}
......@@ -3,7 +3,7 @@ class Admin::GeoNodesController < Admin::ApplicationController
before_action :load_node, only: [:destroy, :repair, :toggle]
def index
@nodes = GeoNode.all
@nodes = GeoNode.all.map(&:present)
@node = GeoNode.new
unless Gitlab::Geo.license_allows?
......
......@@ -2,9 +2,14 @@ module EE
module GeoHelper
def node_status_icon(node)
if node.primary?
icon 'star fw'
icon 'star fw', class: 'has-tooltip', title: 'Primary node'
else
status = node.enabled? ? 'enabled' : 'disabled'
status =
if node.enabled?
node.healthy? ? 'healthy' : 'unhealthy'
else
'disabled'
end
icon 'globe fw',
class: "geo-node-icon-#{status} has-tooltip",
......
class GeoNode < ActiveRecord::Base
include Presentable
Status = Struct.new(:health, :repositories, :repositories_synced, :repositories_failed)
belongs_to :geo_node_key, dependent: :destroy
......
class GeoNodePresenter < Gitlab::View::Presenter::Delegated
presents :geo_node
def healthy?
health.blank?
end
def health
status.health
end
def repositories_synced
(status.repositories_synced.to_f / status.repositories.to_f) * 100.0
end
def repositories_failed
status.repositories_failed
end
private
def status
@status ||= begin
_, status = Geo::NodeStatusService.new.call(status_url)
status
end
end
end
......@@ -21,8 +21,15 @@
%span
= node_status_icon(node)
%strong= node.url
%p
%span.help-block= node.primary ? 'Primary node' : 'Secondary node'
- if node.primary?
%span.help-block Primary node
- else
%p
%span.help-block= "Repositorie synced: #{number_to_percentage(node.repositories_synced, precision: 0)}"
%p
%span.help-block= "Repositorie failed: #{node.repositories_failed}"
%p
%span.help-block= node.healthy? ? 'No Health Problems Detected' : node.health
.pull-right
- if Gitlab::Geo.license_allows?
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment