Commit efd14c49 authored by Michael Kozono's avatar Michael Kozono

Merge branch 'alexives/239448/rename_replicator_classes' into 'master'

Rename replicator_classes methods as enabled

See merge request gitlab-org/gitlab!40321
parents a64f252e bad7b02c
......@@ -216,7 +216,7 @@ module EE
]
# Adds all the SSF Data Types automatically
replicator_classes.each do |replicator_class|
enabled_replicator_classes.each do |replicator_class|
replicable_types.push(
{
title: replicator_class.replicable_title,
......@@ -231,8 +231,8 @@ module EE
replicable_types
end
def replicator_classes
::Gitlab::Geo.replicator_classes
def enabled_replicator_classes
::Gitlab::Geo.enabled_replicator_classes
end
end
end
......@@ -19,7 +19,7 @@
%span
= _('Designs')
- if Feature.enabled?(:geo_self_service_framework)
- Gitlab::Geo.replicator_classes.each do |replicator_class|
- Gitlab::Geo.enabled_replicator_classes.each do |replicator_class|
= nav_link(page: [{ controller: 'admin/geo/replicables', action: 'index', replicable_name_plural: replicator_class.replicable_name_plural }], html_options: { class: 'gl-pr-2' }) do
= link_to admin_geo_replicables_path(replicable_name_plural: replicator_class.replicable_name_plural), title: replicator_class.replicable_title_plural do
%span
......
......@@ -78,7 +78,7 @@ module Geo
end
def replicator_classes
Gitlab::Geo.replicator_classes
Gitlab::Geo.enabled_replicator_classes
end
end
end
......@@ -166,7 +166,7 @@ module Gitlab
_(template) % { url: url }
end
def self.replicator_classes
def self.enabled_replicator_classes
REPLICATOR_CLASSES.select(&:enabled?)
end
end
......
......@@ -164,7 +164,7 @@ module Gitlab
end
def print_replicators_status
Gitlab::Geo.replicator_classes.each do |replicator_class|
Gitlab::Geo.enabled_replicator_classes.each do |replicator_class|
print "#{replicator_class.replicable_title_plural}: ".rjust(GEO_STATUS_COLUMN_WIDTH)
show_failed_value(replicator_class.failed_count)
......@@ -246,7 +246,7 @@ module Gitlab
end
def print_replicators_checked_status
Gitlab::Geo.replicator_classes.each do |replicator_class|
Gitlab::Geo.enabled_replicator_classes.each do |replicator_class|
print "#{replicator_class.replicable_title_plural} Checked: ".rjust(GEO_STATUS_COLUMN_WIDTH)
show_failed_value(replicator_class.checksum_failed_count)
print "#{replicator_class.checksummed_count}/#{replicator_class.registry_count} "
......@@ -275,7 +275,7 @@ module Gitlab
r.push current_node_status.container_repositories_failed_count
end
Gitlab::Geo.replicator_classes.each do |replicator_class|
Gitlab::Geo.enabled_replicator_classes.each do |replicator_class|
r.push replicator_class.failed_count
end
end
......@@ -294,7 +294,7 @@ module Gitlab
v.push current_node_status.repositories_checked_failed_count
end
Gitlab::Geo.replicator_classes.each do |replicator_class|
Gitlab::Geo.enabled_replicator_classes.each do |replicator_class|
v.push replicator_class.checksum_failed_count
end
end
......
......@@ -45,7 +45,7 @@ RSpec.describe 'admin Geo Replication Nav', :js, :geo do
end
describe 'visit admin/geo/replication/*' do
Gitlab::Geo.replicator_classes.each do |replicator_class|
Gitlab::Geo.enabled_replicator_classes.each do |replicator_class|
it_behaves_like 'active sidebar link', replicator_class.replicable_title_plural do
let(:path) { admin_geo_replicables_path(replicable_name_plural: replicator_class.replicable_name_plural) }
end
......
......@@ -65,7 +65,7 @@ RSpec.describe 'admin Geo Sidebar', :js, :geo do
end
describe 'visiting geo replicables' do
Gitlab::Geo.replicator_classes.each do |replicator_class|
Gitlab::Geo.enabled_replicator_classes.each do |replicator_class|
it_behaves_like 'active sidebar link', 'Replication' do
let(:path) { admin_geo_replicables_path(replicable_name_plural: replicator_class.replicable_name_plural) }
end
......
......@@ -39,7 +39,7 @@ RSpec.describe EE::GeoHelper do
end
it 'includes replicator types' do
expected_names = helper.replicator_classes.map { |c| c.replicable_name_plural }
expected_names = helper.enabled_replicator_classes.map { |c| c.replicable_name_plural }
expect(names).to include(*expected_names)
end
......
......@@ -336,9 +336,9 @@ RSpec.describe Gitlab::Geo, :geo, :request_store do
end
end
describe '.replicator_classes' do
describe '.enabled_replicator_classes' do
it 'returns an Array of replicator classes' do
result = described_class.replicator_classes
result = described_class.enabled_replicator_classes
expect(result).to be_an(Array)
expect(result).to include(Geo::PackageFileReplicator)
......@@ -350,7 +350,7 @@ RSpec.describe Gitlab::Geo, :geo, :request_store do
end
it 'does not return the replicator class' do
expect(described_class.replicator_classes).not_to include(Geo::PackageFileReplicator)
expect(described_class.enabled_replicator_classes).not_to include(Geo::PackageFileReplicator)
end
end
end
......
......@@ -45,7 +45,7 @@ RSpec.describe 'EE-specific admin routing' do
end
describe Admin::Geo::ReplicablesController, 'routing' do
Gitlab::Geo.replicator_classes.map(&:replicable_name_plural).each do |replicable_name_plural|
Gitlab::Geo.enabled_replicator_classes.map(&:replicable_name_plural).each do |replicable_name_plural|
it "routes /admin/geo/replication/#{replicable_name_plural} to replicables#index" do
expect(get("/admin/geo/replication/#{replicable_name_plural}")).to route_to('admin/geo/replicables#index', replicable_name_plural: replicable_name_plural)
end
......
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