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
8a7bd1bf
Commit
8a7bd1bf
authored
Mar 07, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add count suffix to GeoNodeStatus attributes
parent
8bf2bcdf
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
22 deletions
+22
-22
app/models/geo_node_status.rb
app/models/geo_node_status.rb
+14
-14
app/presenters/geo_node_presenter.rb
app/presenters/geo_node_presenter.rb
+2
-2
app/services/geo/node_status_service.rb
app/services/geo/node_status_service.rb
+1
-1
app/views/admin/geo_nodes/index.html.haml
app/views/admin/geo_nodes/index.html.haml
+2
-2
lib/api/entities.rb
lib/api/entities.rb
+3
-3
No files found.
app/models/geo_node_status.rb
View file @
8a7bd1bf
...
...
@@ -11,33 +11,33 @@ class GeoNodeStatus
health
.
blank?
end
def
repositories
@repositories
||=
Project
.
count
def
repositories
_count
@repositories
_count
||=
Project
.
count
end
def
repositories
=
(
value
)
@repositories
=
value
.
to_i
def
repositories
_count
=
(
value
)
@repositories
_count
=
value
.
to_i
end
def
repositories_synced
@repositories_synced
||=
Geo
::
ProjectRegistry
.
synced
.
count
def
repositories_synced
_count
@repositories_synced
_count
||=
Geo
::
ProjectRegistry
.
synced
.
count
end
def
repositories_synced
=
(
value
)
@repositories_synced
=
value
.
to_i
def
repositories_synced
_count
=
(
value
)
@repositories_synced
_count
=
value
.
to_i
end
def
repositories_synced_in_percentage
return
0
if
repositories
.
zero?
return
0
if
repositories
_count
.
zero?
(
repositories_synced
.
to_f
/
repositories
.
to_f
)
*
100.0
(
repositories_synced
_count
.
to_f
/
repositories_count
.
to_f
)
*
100.0
end
def
repositories_failed
@repositories_failed
||=
Geo
::
ProjectRegistry
.
failed
.
count
def
repositories_failed
_count
@repositories_failed
_count
||=
Geo
::
ProjectRegistry
.
failed
.
count
end
def
repositories_failed
=
(
value
)
@repositories_failed
=
value
.
to_i
def
repositories_failed
_count
=
(
value
)
@repositories_failed
_count
=
value
.
to_i
end
end
app/presenters/geo_node_presenter.rb
View file @
8a7bd1bf
class
GeoNodePresenter
<
Gitlab
::
View
::
Presenter
::
Delegated
presents
:geo_node
delegate
:healthy?
,
:health
,
:repositories
,
:repositories_synced
,
:repositories_synced_in_percentage
,
:repositories_failed
,
delegate
:healthy?
,
:health
,
:repositories
_count
,
:repositories_synced_count
,
:repositories_synced_in_percentage
,
:repositories_failed
_count
,
to: :status
private
...
...
app/services/geo/node_status_service.rb
View file @
8a7bd1bf
...
...
@@ -2,7 +2,7 @@ module Geo
class
NodeStatusService
include
HTTParty
KEYS
=
%w(health repositories
repositories_synced repositories_failed
)
.
freeze
KEYS
=
%w(health repositories
_count repositories_synced_count repositories_failed_count
)
.
freeze
# HTTParty timeout
default_timeout
Gitlab
.
config
.
gitlab
.
geo_status_timeout
...
...
app/views/admin/geo_nodes/index.html.haml
View file @
8a7bd1bf
...
...
@@ -26,10 +26,10 @@
-
else
%p
%span
.help-block
Repositories synced:
#{
node
.
repositories_synced
}
/
#{
node
.
repositories
}
(
#{
number_to_percentage
(
node
.
repositories_synced_in_percentage
,
precision:
2
)
}
)
Repositories synced:
#{
node
.
repositories_synced
_count
}
/
#{
node
.
repositories_count
}
(
#{
number_to_percentage
(
node
.
repositories_synced_in_percentage
,
precision:
2
)
}
)
%p
%span
.help-block
Repositories failed:
#{
node
.
repositories_failed
}
Repositories failed:
#{
node
.
repositories_failed
_count
}
%p
%span
.help-block
=
node
.
healthy?
?
'No Health Problems Detected'
:
node
.
health
...
...
lib/api/entities.rb
View file @
8a7bd1bf
...
...
@@ -771,9 +771,9 @@ module API
class
GeoNodeStatus
<
Grape
::
Entity
expose
:health
expose
:repositories
expose
:repositories_synced
expose
:repositories_failed
expose
:repositories
_count
expose
:repositories_synced
_count
expose
:repositories_failed
_count
end
end
end
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