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
7f215dd6
Commit
7f215dd6
authored
May 04, 2017
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move current_node? helper method to the GeoNode model
parent
71e26d3a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
2 deletions
+22
-2
app/models/geo_node.rb
app/models/geo_node.rb
+4
-0
app/views/admin/geo_nodes/index.html.haml
app/views/admin/geo_nodes/index.html.haml
+2
-2
spec/models/geo_node_spec.rb
spec/models/geo_node_spec.rb
+16
-0
No files found.
app/models/geo_node.rb
View file @
7f215dd6
...
...
@@ -35,6 +35,10 @@ class GeoNode < ActiveRecord::Base
mode: :per_attribute_iv
,
encode:
true
def
current?
Gitlab
::
Geo
.
current_node
==
self
end
def
secondary?
!
primary
end
...
...
app/views/admin/geo_nodes/index.html.haml
View file @
7f215dd6
...
...
@@ -20,7 +20,7 @@
.node-block
=
node_status_icon
(
node
)
%strong
=
node
.
url
-
if
current_node?
(
node
)
-
if
node
.
current?
.node-badge.current-node
Current node
-
if
node
.
primary?
.node-badge.primary-node
Primary
...
...
@@ -51,7 +51,7 @@
%p
.js-health
-
if
current_node?
(
node
)
==
node
.
primary?
-
if
node
.
current?
&&
node
.
primary?
.node-actions
-
if
Gitlab
::
Geo
.
license_allows?
-
if
node
.
missing_oauth_application?
...
...
spec/models/geo_node_spec.rb
View file @
7f215dd6
...
...
@@ -111,6 +111,22 @@ describe GeoNode, type: :model do
end
end
describe
'#current?'
do
subject
{
described_class
.
new
}
it
'returns true when node is the current node'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:current_node
)
{
subject
}
expect
(
subject
.
current?
).
to
eq
true
end
it
'returns false when node is not the current node'
do
allow
(
Gitlab
::
Geo
).
to
receive
(
:current_node
)
{
double
}
expect
(
subject
.
current?
).
to
eq
false
end
end
describe
'#uri'
do
context
'when all fields are filled'
do
it
'returns an URI object'
do
...
...
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