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
304aebc2
Commit
304aebc2
authored
Sep 24, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define Gitlab::Geo.primary_node_configured? abstraction
parent
9e19864b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
2 deletions
+20
-2
app/controllers/admin/application_controller.rb
app/controllers/admin/application_controller.rb
+1
-1
app/views/layouts/nav/_dashboard.html.haml
app/views/layouts/nav/_dashboard.html.haml
+1
-1
lib/gitlab/geo.rb
lib/gitlab/geo.rb
+4
-0
spec/lib/gitlab/geo_spec.rb
spec/lib/gitlab/geo_spec.rb
+14
-0
No files found.
app/controllers/admin/application_controller.rb
View file @
304aebc2
...
...
@@ -12,7 +12,7 @@ class Admin::ApplicationController < ApplicationController
def
display_geo_information
return
unless
Gitlab
::
Geo
.
secondary?
return
unless
Gitlab
::
Geo
.
primary_node
.
present
?
return
unless
Gitlab
::
Geo
.
primary_node
_configured
?
primary_node
=
view_context
.
link_to
(
'primary node'
,
Gitlab
::
Geo
.
primary_node
.
url
)
flash
.
now
[
:notice
]
=
"You are on a secondary (read-only) Geo node. If you want to make any changes, you must visit the
#{
primary_node
}
."
.
html_safe
...
...
app/views/layouts/nav/_dashboard.html.haml
View file @
304aebc2
...
...
@@ -60,7 +60,7 @@
=
link_to
sherlock_transactions_path
,
class:
'admin-icon'
,
title:
'Sherlock Transactions'
,
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
icon
(
'tachometer fw'
)
-
if
Gitlab
::
Geo
.
secondary?
&&
Gitlab
::
Geo
.
primary_node
.
present
?
-
if
Gitlab
::
Geo
.
secondary?
&&
Gitlab
::
Geo
.
primary_node
_configured
?
%li
=
link_to
Gitlab
::
Geo
.
primary_node
.
url
,
title:
'Go to primary node'
,
data:
{
toggle:
'tooltip'
,
placement:
'bottom'
,
container:
'body'
}
do
=
icon
(
'globe fw'
)
lib/gitlab/geo.rb
View file @
304aebc2
...
...
@@ -50,6 +50,10 @@ module Gitlab
Rails
.
configuration
.
respond_to?
(
:geo_database
)
end
def
self
.
primary_node_configured?
Gitlab
::
Geo
.
primary_node
.
present?
end
def
self
.
license_allows?
::
License
.
feature_available?
(
:geo
)
end
...
...
spec/lib/gitlab/geo_spec.rb
View file @
304aebc2
...
...
@@ -43,6 +43,20 @@ describe Gitlab::Geo do
end
end
describe
'primary_node_configured?'
do
context
'when current node is a primary node'
do
it
'returns true'
do
primary_node
expect
(
described_class
.
primary_node_configured?
).
to
be_truthy
end
it
'returns false when primary does not exist'
do
expect
(
described_class
.
primary_node_configured?
).
to
be_falsey
end
end
end
describe
'secondary?'
do
context
'when current node is a secondary node'
do
before
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