Commit 2568fa6d authored by Stan Hu's avatar Stan Hu

Add support for taggling advanced status in Geo

parent 642fc9cb
...@@ -25,6 +25,8 @@ class GeoNodeStatus { ...@@ -25,6 +25,8 @@ class GeoNodeStatus {
this.$lastCursorEvent = $('.js-last-cursor-event', this.$status); this.$lastCursorEvent = $('.js-last-cursor-event', this.$status);
this.$health = $('.js-health', this.$status); this.$health = $('.js-health', this.$status);
this.endpoint = this.$el.data('status-url'); this.endpoint = this.$el.data('status-url');
this.$advancedStatus = $('.js-advanced-geo-node-status-toggler', this.$status)
this.$advancedStatus.on('click', this.toggleShowAdvancedStatus);
this.statusInterval = new gl.SmartInterval({ this.statusInterval = new gl.SmartInterval({
callback: this.getStatus.bind(this), callback: this.getStatus.bind(this),
...@@ -36,6 +38,13 @@ class GeoNodeStatus { ...@@ -36,6 +38,13 @@ class GeoNodeStatus {
}); });
} }
toggleShowAdvancedStatus(e) {
const element = $(e.currentTarget);
const closestStatus = element.siblings().next('.advanced-status')
element.find('.fa').toggleClass('fa-angle-down').toggleClass('fa-angle-up');
closestStatus.toggleClass('hide-status');
}
getStatus() { getStatus() {
$.getJSON(this.endpoint, (status) => { $.getJSON(this.endpoint, (status) => {
this.setStatusIcon(status.healthy); this.setStatusIcon(status.healthy);
......
...@@ -29,6 +29,24 @@ ...@@ -29,6 +29,24 @@
} }
} }
.js-advanced-geo-node-status-toggler {
color: $gl-link-color;
padding: 10px 0 0;
cursor: pointer;
position: relative;
z-index: 2;
&:hover span {
color: $gl-link-color;
text-decoration: underline;
}
}
.hide-status {
display: none;
background: transparent;
}
.node-info { .node-info {
color: $gl-text-color; color: $gl-text-color;
} }
......
...@@ -21,7 +21,7 @@ class GeoNodeStatus ...@@ -21,7 +21,7 @@ class GeoNodeStatus
def db_replication_lag=(value) def db_replication_lag=(value)
@db_replication_lag = value @db_replication_lag = value
end end
def last_event_id def last_event_id
@last_event_id ||= latest_event&.id @last_event_id ||= latest_event&.id
end end
...@@ -58,6 +58,14 @@ class GeoNodeStatus ...@@ -58,6 +58,14 @@ class GeoNodeStatus
@cursor_last_event_date = value @cursor_last_event_date = value
end end
def db_replication_lag
@db_replication_lag ||= Gitlab::Geo::HealthCheck.db_replication_lag
end
def db_replication_lag=(value)
@db_replication_lag = value
end
def repositories_count def repositories_count
@repositories_count ||= repositories.count @repositories_count ||= repositories.count
end end
......
...@@ -66,12 +66,18 @@ ...@@ -66,12 +66,18 @@
Attachments synced: Attachments synced:
%strong.node-info.js-attachments-synced %strong.node-info.js-attachments-synced
%p %p
%span.help-block .js-advanced-geo-node-status-toggler
Last event ID seen from primary: %i.fa.fa-angle-down
%strong.node-info.js-last-event-seen %span
%span.help-block Advanced
Last event ID processed by cursor: %p
%strong.node-info.js-last-cursor-event .advanced-status.hide-status
%span.help-block
Last event ID seen from primary:
%strong.node-info.js-last-event-seen
%span.help-block
Last event ID processed by cursor:
%strong.node-info.js-last-cursor-event
%p %p
.js-health .js-health
......
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