Commit d76a4a2a authored by Zack Cuddy's avatar Zack Cuddy Committed by Douglas Barbosa Alexandre

Geo - Provide replicable types list to Frontend

This changes allows the frontend to no longer need to manage hard coded
list of replicables.

Instead the backend will manage the list which currenlty combines
of hard-coded legacy items along with the new generic SSF approach.

Eventually this list will be completly machine generated and will
no longer require additional code to add/remove types.
parent 34084e31
......@@ -31,7 +31,8 @@ module EE
primary_revision: revision.to_s,
node_actions_allowed: ::Gitlab::Database.db_read_write?.to_s,
node_edit_allowed: ::Gitlab::Geo.license_allows?.to_s,
geo_troubleshooting_help_path: help_page_path('administration/geo/replication/troubleshooting.md')
geo_troubleshooting_help_path: help_page_path('administration/geo/replication/troubleshooting.md'),
replicable_types: replicable_types.to_json
}
end
......@@ -163,5 +164,75 @@ module EE
def reverify_all_button
button_to(s_("Geo|Reverify all"), { controller: controller_name, action: :reverify_all }, class: "btn btn-default btn-md")
end
def replicable_types
# Hard Coded Legacy Types, we will want to remove these when they are added to SSF
replicable_types = [
{
title: _('Repository'),
title_plural: _('Repositories'),
name: 'repository',
name_plural: 'repositories',
secondary_view: true
},
{
title: _('Wiki'),
title_plural: _('Wikis'),
name: 'wiki',
name_plural: 'wikis'
},
{
title: _('LFS object'),
title_plural: _('LFS objects'),
name: 'lfs',
name_plural: 'lfs'
},
{
title: _('Attachment'),
title_plural: _('Attachments'),
name: 'attachment',
name_plural: 'attachments',
secondary_view: true
},
{
title: _('Job artifact'),
title_plural: _('Job artifacts'),
name: 'job_artifact',
name_plural: 'job_artifacts'
},
{
title: _('Container repository'),
title_plural: _('Container repositories'),
name: 'container_repository',
name_plural: 'container_repositories'
},
{
title: _('Design repository'),
title_plural: _('Design repositories'),
name: 'design_repository',
name_plural: 'design_repositories',
secondary_view: true
}
]
# Adds all the SSF Data Types automatically
replicator_classes.each do |replicator_class|
replicable_types.push(
{
title: replicator_class.replicable_title,
title_plural: replicator_class.replicable_title_plural,
name: replicator_class.replicable_name,
name_plural: replicator_class.replicable_name_plural,
secondary_view: true
}
)
end
replicable_types
end
def replicator_classes
::Gitlab::Geo.replicator_classes
end
end
end
......@@ -20,4 +20,28 @@ RSpec.describe EE::GeoHelper do
end
end
end
describe 'replicable_types' do
subject(:names) { helper.replicable_types.map { |t| t[:name_plural] } }
it 'includes legacy types' do
expected_names = %w(
repositories
wikis
lfs
attachments
job_artifacts
container_repositories
design_repositories
)
expect(names).to include(*expected_names)
end
it 'includes replicator types' do
expected_names = helper.replicator_classes.map { |c| c.replicable_name_plural }
expect(names).to include(*expected_names)
end
end
end
......@@ -3333,6 +3333,12 @@ msgstr[1] ""
msgid "Attaching the file failed."
msgstr ""
msgid "Attachment"
msgstr ""
msgid "Attachments"
msgstr ""
msgid "Audit Events"
msgstr ""
......@@ -6353,9 +6359,15 @@ msgstr ""
msgid "Container registry is not enabled on this GitLab instance. Ask an administrator to enable it in order for Auto DevOps to work."
msgstr ""
msgid "Container repositories"
msgstr ""
msgid "Container repositories sync capacity"
msgstr ""
msgid "Container repository"
msgstr ""
msgid "ContainerRegistry| Please visit the %{linkStart}administration settings%{linkEnd} to enable this feature."
msgstr ""
......@@ -8096,6 +8108,12 @@ msgstr ""
msgid "Design Management files and data"
msgstr ""
msgid "Design repositories"
msgstr ""
msgid "Design repository"
msgstr ""
msgid "DesignManagement|%{current_design} of %{designs_count}"
msgstr ""
......@@ -13372,6 +13390,12 @@ msgstr ""
msgid "Job ID"
msgstr ""
msgid "Job artifact"
msgstr ""
msgid "Job artifacts"
msgstr ""
msgid "Job has been erased"
msgstr ""
......@@ -13564,6 +13588,9 @@ msgstr ""
msgid "LFS"
msgstr ""
msgid "LFS object"
msgstr ""
msgid "LFS objects"
msgstr ""
......@@ -20008,6 +20035,9 @@ msgstr ""
msgid "Reports|no changed test results"
msgstr ""
msgid "Repositories"
msgstr ""
msgid "Repository"
msgstr ""
......@@ -26898,6 +26928,9 @@ msgstr ""
msgid "WikiPage|Write your content or drag files here…"
msgstr ""
msgid "Wikis"
msgstr ""
msgid "Wiki|Create New Page"
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