Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a4eff55d
Commit
a4eff55d
authored
May 01, 2017
by
Annabel Dunstone Gray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show health status when enabled; add new icons
parent
82941cf8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
22 deletions
+39
-22
app/assets/javascripts/geo_nodes.js
app/assets/javascripts/geo_nodes.js
+25
-7
app/helpers/ee/geo_helper.rb
app/helpers/ee/geo_helper.rb
+7
-9
app/serializers/geo_node_status_entity.rb
app/serializers/geo_node_status_entity.rb
+1
-1
app/views/admin/geo_nodes/index.html.haml
app/views/admin/geo_nodes/index.html.haml
+6
-5
No files found.
app/assets/javascripts/geo_nodes.js
View file @
a4eff55d
/* eslint-disable no-new*/
import
'
./smart_interval
'
;
const
healthyClass
=
'
geo-node-icon-healthy
'
;
const
unhealthyClass
=
'
geo-node-icon-unhealthy
'
;
const
healthyClass
=
'
geo-node-healthy
'
;
const
unhealthyClass
=
'
geo-node-unhealthy
'
;
const
healthyIcon
=
'
fa-check
'
;
const
unhealthyIcon
=
'
fa-close
'
class
GeoNodeStatus
{
constructor
(
el
)
{
this
.
$el
=
$
(
el
);
this
.
$icon
=
$
(
'
.js-geo-node-icon
'
,
this
.
$el
);
this
.
$healthStatus
=
$
(
'
.js-health-status
'
,
this
.
$el
);
this
.
$status
=
$
(
'
.js-geo-node-status
'
,
this
.
$el
);
this
.
$repositoriesSynced
=
$
(
'
.js-repositories-synced
'
,
this
.
$status
);
this
.
$repositoriesFailed
=
$
(
'
.js-repositories-failed
'
,
this
.
$status
);
...
...
@@ -29,11 +32,14 @@ class GeoNodeStatus {
getStatus
()
{
$
.
getJSON
(
this
.
endpoint
,
(
status
)
=>
{
this
.
setStatusIcon
(
status
.
healthy
);
this
.
setHealthStatus
(
status
.
healthy
);
this
.
$repositoriesSynced
.
html
(
`
${
status
.
repositories_synced_count
}
/
${
status
.
repositories_count
}
(
${
status
.
repositories_synced_in_percentage
}
)`
);
this
.
$repositoriesFailed
.
html
(
status
.
repositories_failed_count
);
this
.
$lfsObjectsSynced
.
html
(
`
${
status
.
lfs_objects_synced_count
}
/
${
status
.
lfs_objects_count
}
(
${
status
.
lfs_objects_synced_in_percentage
}
)`
);
this
.
$attachmentsSynced
.
html
(
`
${
status
.
attachments_synced_count
}
/
${
status
.
attachments_count
}
(
${
status
.
attachments_synced_in_percentage
}
)`
);
this
.
$health
.
html
(
status
.
health
);
if
(
status
.
health
!==
'
Healthy
'
)
{
this
.
$health
.
html
(
'
<code class="geo-health">
'
+
status
.
health
+
'
</code>
'
);
}
this
.
$status
.
show
();
});
...
...
@@ -41,17 +47,29 @@ class GeoNodeStatus {
setStatusIcon
(
healthy
)
{
if
(
healthy
)
{
this
.
$icon
.
removeClass
(
unhealthyClass
)
.
addClass
(
healthyClass
)
this
.
$icon
.
removeClass
(
unhealthyClass
+
'
'
+
unhealthyIcon
)
.
addClass
(
healthyClass
+
'
'
+
healthyIcon
)
.
attr
(
'
title
'
,
'
Healthy
'
);
}
else
{
this
.
$icon
.
removeClass
(
healthyClass
)
.
addClass
(
unhealthyClass
)
this
.
$icon
.
removeClass
(
healthyClass
+
'
'
+
healthyIcon
)
.
addClass
(
unhealthyClass
+
'
'
+
unhealthyIcon
)
.
attr
(
'
title
'
,
'
Unhealthy
'
);
}
this
.
$icon
.
tooltip
(
'
fixTitle
'
);
}
setHealthStatus
(
healthy
)
{
if
(
healthy
)
{
this
.
$healthStatus
.
removeClass
(
unhealthyClass
)
.
addClass
(
healthyClass
)
.
html
(
'
Healthy
'
);
}
else
{
this
.
$healthStatus
.
removeClass
(
healthyClass
)
.
addClass
(
unhealthyClass
)
.
html
(
'
Unhealthy
'
);
}
}
}
class
GeoNodes
{
...
...
app/helpers/ee/geo_helper.rb
View file @
a4eff55d
...
...
@@ -4,20 +4,18 @@ module EE
unless
node
.
primary?
status
=
node
.
enabled?
?
'healthy'
:
'disabled'
icon
'check fw'
,
if
status
==
'healthy'
icon
=
'check'
else
icon
=
'times'
end
icon
"
#{
icon
}
fw"
,
class:
"js-geo-node-icon geo-node-
#{
status
}
has-tooltip"
,
title:
status
.
capitalize
end
end
def
node_status
(
node
)
status
=
node
.
enabled?
?
'healthy'
:
'disabled'
content_tag
:span
,
class:
"geo-node-
#{
status
}
"
do
status
.
capitalize
end
end
def
toggle_node_button
(
node
)
btn_class
,
title
,
data
=
if
node
.
enabled?
...
...
app/serializers/geo_node_status_entity.rb
View file @
a4eff55d
...
...
@@ -5,7 +5,7 @@ class GeoNodeStatusEntity < Grape::Entity
expose
:healthy?
,
as: :healthy
expose
:health
do
|
node
|
node
.
healthy?
?
'
No Health Problems Detected
'
:
node
.
health
node
.
healthy?
?
'
Healthy
'
:
node
.
health
end
expose
:attachments_count
...
...
app/views/admin/geo_nodes/index.html.haml
View file @
a4eff55d
...
...
@@ -25,10 +25,11 @@
%span
.help-block
Primary node
-
else
.js-geo-node-status
{
style:
'display: none'
}
%p
%span
.help-block
Health Status:
%span
=
node_status
(
node
)
-
if
node
.
enabled?
%p
%span
.help-block
Health Status:
%span
.js-health-status
%p
%span
.help-block
Repositories synced:
...
...
@@ -46,7 +47,7 @@
Attachments synced:
%span
.node-info.js-attachments-synced
%p
%code
.geo-health
.js-health
.js-health
.node-actions
-
if
Gitlab
::
Geo
.
license_allows?
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment