Skip to content
代码片段 群组 项目
未验证 提交 483c206c 编辑于 作者: Ted Tran's avatar Ted Tran 提交者: GitLab
浏览文件

Removes `geo_registry_status` method

Removes `ee/app/helpers/ee/geo_helper.rb`: `geo_registry_status`
because it is not used anywhere. Solves a fraction of
https://gitlab.com/gitlab-org/gitlab/-/issues/420057

EE: true
上级 b0e0d256
No related branches found
No related tags found
无相关合并请求
...@@ -43,49 +43,6 @@ def selective_sync_types_json ...@@ -43,49 +43,6 @@ def selective_sync_types_json
options.to_json options.to_json
end end
def geo_registry_status(registry)
status_type = case registry.synchronization_state
when :synced then 'gl-text-green-500'
when :pending then 'gl-text-orange-500'
when :failed then 'gl-text-red-500'
else 'gl-text-gray-500'
end
content_tag(:div, class: status_type, data: { testid: 'project-status-icon' }) do
icon = geo_registry_status_icon(registry)
text = geo_registry_status_text(registry)
[icon, text].join(' ').html_safe
end
end
def geo_registry_status_icon(registry)
sprite_icon(STATUS_ICON_NAMES_BY_STATE.fetch(registry.synchronization_state, 'status_notfound'))
end
def geo_registry_status_text(registry)
case registry.synchronization_state
when :never
_('Never')
when :failed
_('Failed')
when :pending
if registry.pending_synchronization?
s_('Geo|Pending synchronization')
elsif registry.pending_verification?
s_('Geo|Pending verification')
else
# should never reach this state, unless we introduce new behavior
_('Unknown')
end
when :synced
_('Synced')
else
# should never reach this state, unless we introduce new behavior
_('Unknown')
end
end
def replicable_types def replicable_types
enabled_replicator_classes.map do |replicator_class| enabled_replicator_classes.map do |replicator_class|
{ {
......
...@@ -48,17 +48,4 @@ def file ...@@ -48,17 +48,4 @@ def file
def project def project
return upload.model if upload&.model.is_a?(Project) return upload.model if upload&.model.is_a?(Project)
end end
# Returns a synchronization state based on existing attribute values
#
# It takes into account things like if a successful replication has been done
# if there are pending actions or existing errors
#
# @return [Symbol] :synced, :never, or :failed
def synchronization_state
return :synced if success?
return :never if retry_count.nil?
:failed
end
end end
...@@ -70,34 +70,6 @@ ...@@ -70,34 +70,6 @@
end end
end end
describe '#geo_registry_status_text' do
where(:synchronization_state, :pending_synchronization, :pending_verification, :result) do
[
[:never, false, false, 'Never'],
[:failed, false, false, 'Failed'],
[:pending, true, false, 'Pending synchronization'],
[:pending, false, true, 'Pending verification'],
[:pending, false, false, 'Unknown'],
[:synced, false, false, 'Synced'],
[:fake, false, false, 'Unknown']
]
end
with_them do
let(:registry) do
Struct.new(
:synchronization_state,
:pending_synchronization?,
:pending_verification?
).new(synchronization_state, pending_synchronization, pending_verification)
end
it 'returns the correct result' do
expect(helper.geo_registry_status_text(registry)).to eq(result)
end
end
end
describe '#format_file_size_for_checksum' do describe '#format_file_size_for_checksum' do
context 'when file size is of even length' do context 'when file size is of even length' do
it 'returns same file size string' do it 'returns same file size string' do
......
...@@ -22009,12 +22009,6 @@ msgstr "" ...@@ -22009,12 +22009,6 @@ msgstr ""
msgid "Geo|Offline" msgid "Geo|Offline"
msgstr "" msgstr ""
   
msgid "Geo|Pending synchronization"
msgstr ""
msgid "Geo|Pending verification"
msgstr ""
msgid "Geo|Primary" msgid "Geo|Primary"
msgstr "" msgstr ""
   
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册