Commit 769b85a9 authored by Stan Hu's avatar Stan Hu

Show loading icon when retrieving Geo node status

Closes #1977
parent 530166fc
...@@ -3,13 +3,16 @@ import './smart_interval'; ...@@ -3,13 +3,16 @@ import './smart_interval';
const healthyClass = 'geo-node-healthy'; const healthyClass = 'geo-node-healthy';
const unhealthyClass = 'geo-node-unhealthy'; const unhealthyClass = 'geo-node-unhealthy';
const unknownClass = 'geo-node-unknown';
const healthyIcon = 'fa-check'; const healthyIcon = 'fa-check';
const unhealthyIcon = 'fa-close'; const unhealthyIcon = 'fa-times';
const unknownIcon = 'fa-times';
class GeoNodeStatus { class GeoNodeStatus {
constructor(el) { constructor(el) {
this.$el = $(el); this.$el = $(el);
this.$icon = $('.js-geo-node-icon', this.$el); this.$icon = $('.js-geo-node-icon', this.$el);
this.$loadingIcon = $('.js-geo-node-loading', this.$el);
this.$healthStatus = $('.js-health-status', this.$el); this.$healthStatus = $('.js-health-status', this.$el);
this.$status = $('.js-geo-node-status', this.$el); this.$status = $('.js-geo-node-status', this.$el);
this.$repositoriesSynced = $('.js-repositories-synced', this.$status); this.$repositoriesSynced = $('.js-repositories-synced', this.$status);
...@@ -48,6 +51,9 @@ class GeoNodeStatus { ...@@ -48,6 +51,9 @@ class GeoNodeStatus {
} }
setStatusIcon(healthy) { setStatusIcon(healthy) {
this.$loadingIcon.hide();
this.$icon.removeClass(`${unknownClass} ${unknownIcon}`);
if (healthy) { if (healthy) {
this.$icon.removeClass(`${unhealthyClass} ${unhealthyIcon}`) this.$icon.removeClass(`${unhealthyClass} ${unhealthyIcon}`)
.addClass(`${healthyClass} ${healthyIcon}`) .addClass(`${healthyClass} ${healthyIcon}`)
......
...@@ -10,6 +10,10 @@ ...@@ -10,6 +10,10 @@
color: $gray-darkest; color: $gray-darkest;
} }
.geo-node-unknown {
color: $gray-darkest;
}
.well-list.geo-nodes { .well-list.geo-nodes {
li { li {
position: relative; position: relative;
......
...@@ -2,7 +2,7 @@ module EE ...@@ -2,7 +2,7 @@ module EE
module GeoHelper module GeoHelper
def node_status_icon(node) def node_status_icon(node)
unless node.primary? unless node.primary?
status = node.enabled? ? 'healthy' : 'disabled' status = node.enabled? ? 'unknown' : 'disabled'
icon = status == 'healthy' ? 'check' : 'times' icon = status == 'healthy' ? 'check' : 'times'
icon "#{icon} fw", icon "#{icon} fw",
...@@ -11,6 +11,10 @@ module EE ...@@ -11,6 +11,10 @@ module EE
end end
end end
def status_loading_icon
icon "spinner spin fw", class: 'js-geo-node-loading'
end
def node_class(node) def node_class(node)
klass = [] klass = []
klass << 'js-geo-secondary-node' if node.secondary? klass << 'js-geo-secondary-node' if node.secondary?
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
.node-badge.primary-node Primary .node-badge.primary-node Primary
%span.help-block Primary node %span.help-block Primary node
- else - else
= status_loading_icon
.js-geo-node-status{ style: 'display: none' } .js-geo-node-status{ style: 'display: none' }
- if node.enabled? - if node.enabled?
%p %p
......
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