Commit b30feee4 authored by Stan Hu's avatar Stan Hu

Merge branch 'mk/tangential-tweaks-around-geo-hashed-storage-warnings' into 'master'

Tangential tweaks around Geo hashed storage warnings

See merge request gitlab-org/gitlab-ee!8999
parents 385795d4 1f46646c
......@@ -12,7 +12,11 @@ class Admin::Geo::NodesController < Admin::ApplicationController
@node = GeoNode.new
unless Gitlab::Geo.license_allows?
flash_now(:alert, 'You need a different license to enable Geo replication')
flash.now[:alert] = _('You need a different license to enable Geo replication.')
end
unless Gitlab::Database.pg_stat_wal_receiver_supported?
flash.now[:warning] = _('Please upgrade PostgreSQL to version 9.6 or greater. The status of the replication cannot be determined reliably with the current version.')
end
end
# rubocop: enable CodeReuse/ActiveRecord
......@@ -67,8 +71,4 @@ class Admin::Geo::NodesController < Admin::ApplicationController
def load_node
@node = GeoNode.find(params[:id])
end
def flash_now(type, message)
flash.now[type] = flash.now[type].blank? ? message : "#{flash.now[type]}<BR>#{message}".html_safe
end
end
......@@ -12,10 +12,6 @@
%p.page-subtitle.light
= s_('GeoNodes|With %{geo} you can install a special read-only and replicated instance anywhere. Before you add nodes, follow the %{instructions} in the exact order they appear.').html_safe % { geo: link_to('GitLab Geo', help_page_path('administration/geo/replication/index.md'), target: '_blank'), instructions: link_to('setup instructions', help_page_path('administration/geo/replication/index.md', anchor: 'setup-instructions'), target: '_blank') }
- unless Gitlab::Database.pg_stat_wal_receiver_supported?
= content_for :flash_message do
.alert.alert-warning WARNING: Please upgrade PostgreSQL to version 9.6 or greater. The status of the replication cannot be determined reliably with the current version.
- if @nodes.any?
#js-geo-nodes{ data: node_vue_list_properties }
- else
......
......@@ -22,6 +22,22 @@ describe Admin::Geo::NodesController, :postgresql do
describe '#index' do
render_views
shared_examples 'no flash message' do |flash_type|
it 'does not display a flash message' do
go
expect(flash).not_to include(flash_type)
end
end
shared_examples 'with flash message' do |flash_type, message|
it 'displays a flash message' do
go
expect(flash[flash_type]).to match(message)
end
end
def go
get :index
end
......@@ -31,11 +47,7 @@ describe Admin::Geo::NodesController, :postgresql do
allow(Gitlab::Geo).to receive(:license_allows?).and_return(true)
end
it 'does not display a flash message' do
go
expect(flash).not_to include(:alert)
end
it_behaves_like 'no flash message', :alert
end
context 'without add-on license available' do
......@@ -43,17 +55,29 @@ describe Admin::Geo::NodesController, :postgresql do
allow(Gitlab::Geo).to receive(:license_allows?).and_return(false)
end
it 'displays a flash message' do
go
expect(flash[:alert]).to include('You need a different license to enable Geo replication')
end
it_behaves_like 'with flash message', :alert, 'You need a different license to enable Geo replication'
it 'does not redirects to the license page' do
go
expect(response).not_to redirect_to(admin_license_path)
end
end
context 'with Postgres 9.6 or greater' do
before do
allow(Gitlab::Database).to receive(:pg_stat_wal_receiver_supported?).and_return(true)
end
it_behaves_like 'no flash message', :warning
end
context 'without Postgres 9.6 or greater' do
before do
allow(Gitlab::Database).to receive(:pg_stat_wal_receiver_supported?).and_return(false)
end
it_behaves_like 'with flash message', :warning, 'Please upgrade PostgreSQL to version 9.6 or greater.'
end
end
describe '#create' do
......
......@@ -6596,6 +6596,9 @@ msgstr ""
msgid "Please try again"
msgstr ""
msgid "Please upgrade PostgreSQL to version 9.6 or greater. The status of the replication cannot be determined reliably with the current version."
msgstr ""
msgid "Please use this form to report users to GitLab who create spam issues, comments or behave inappropriately."
msgstr ""
......@@ -10194,6 +10197,9 @@ msgstr ""
msgid "You need a different license to enable FileLocks feature"
msgstr ""
msgid "You need a different license to enable Geo replication."
msgstr ""
msgid "You need git-lfs version %{min_git_lfs_version} (or greater) to continue. Please visit https://git-lfs.github.com"
msgstr ""
......
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