Commit 5d467f01 authored by Gabriel Mazetto's avatar Gabriel Mazetto Committed by Douglas Barbosa Alexandre

Geo: Add a Geo Status Widget to Admin > Projects

parent 6dba97cf
...@@ -114,6 +114,8 @@ ...@@ -114,6 +114,8 @@
= visibility_level_icon(@project.visibility_level) = visibility_level_icon(@project.visibility_level)
= visibility_level_label(@project.visibility_level) = visibility_level_label(@project.visibility_level)
= render_if_exists 'admin/projects/geo_status_widget', locals: { project: @project }
.card .card
.card-header .card-header
Transfer project Transfer project
......
...@@ -177,7 +177,8 @@ ...@@ -177,7 +177,8 @@
} }
} }
.geo-admin-projects { .geo-admin-projects,
.admin-projects {
.card-header { .card-header {
.header-text-primary, .header-text-primary,
.header-text-secondary { .header-text-secondary {
......
...@@ -21,11 +21,6 @@ ...@@ -21,11 +21,6 @@
= time_ago_with_tooltip(project_registry.last_repository_synced_at, placement: 'bottom') = time_ago_with_tooltip(project_registry.last_repository_synced_at, placement: 'bottom')
- else - else
= s_('Geo|Waiting for scheduler') = s_('Geo|Waiting for scheduler')
.col-sm.project-status-container
.project-status-title.text-muted
= s_('Geo|Retry count')
.project-status-content
= project_registry.repository_retry_count.nil? ? 0 : project_registry.repository_retry_count
.project-card-errors .project-card-errors
.card-header.bg-transparent.border-bottom-0.border-top .card-header.bg-transparent.border-bottom-0.border-top
...@@ -41,6 +36,8 @@ ...@@ -41,6 +36,8 @@
'aria-labelledby' => "project-#{project_registry.project_id}-header" } 'aria-labelledby' => "project-#{project_registry.project_id}-header" }
.card-body .card-body
.container.project-container .container.project-container
.row
.col-sm-8.project-status-container
%ul.unstyled-list.errors-list %ul.unstyled-list.errors-list
- if project_registry.last_repository_sync_failure - if project_registry.last_repository_sync_failure
%li.p-0.d-flex %li.p-0.d-flex
...@@ -52,3 +49,8 @@ ...@@ -52,3 +49,8 @@
= sprite_icon('warning', size: 18, css_class: 'error-icon') = sprite_icon('warning', size: 18, css_class: 'error-icon')
%span.error-text.prepend-left-5 %span.error-text.prepend-left-5
= s_('Geo|Verification failed - %{error}') % { error: project_registry.last_repository_verification_failure } = s_('Geo|Verification failed - %{error}') % { error: project_registry.last_repository_verification_failure }
.col-sm-4.project-status-container
.project-status-title.text-muted
= s_('Geo|Retry count')
.project-status-content
= project_registry.repository_retry_count.nil? ? 0 : project_registry.repository_retry_count
...@@ -21,11 +21,6 @@ ...@@ -21,11 +21,6 @@
= time_ago_with_tooltip(project_registry.last_repository_synced_at, placement: 'bottom') = time_ago_with_tooltip(project_registry.last_repository_synced_at, placement: 'bottom')
- else - else
= s_('Geo|Waiting for scheduler') = s_('Geo|Waiting for scheduler')
.col-sm.project-status-container
.project-status-title.text-muted
= s_('Geo|Retry counts')
.project-status-content
= project_registry.repository_retry_count.nil? ? 0 : project_registry.repository_retry_count
- if project_registry.last_repository_sync_failure || project_registry.last_repository_verification_failure - if project_registry.last_repository_sync_failure || project_registry.last_repository_verification_failure
.project-card-errors .project-card-errors
...@@ -42,6 +37,8 @@ ...@@ -42,6 +37,8 @@
'aria-labelledby' => "project-#{project_registry.project_id}-header" } 'aria-labelledby' => "project-#{project_registry.project_id}-header" }
.card-body .card-body
.container.project-container .container.project-container
.row
.col-sm-8.project-status-container
%ul.unstyled-list.errors-list %ul.unstyled-list.errors-list
- if project_registry.last_repository_sync_failure - if project_registry.last_repository_sync_failure
%li.p-0.d-flex %li.p-0.d-flex
...@@ -53,3 +50,8 @@ ...@@ -53,3 +50,8 @@
= sprite_icon('warning', size: 18, css_class: 'error-icon') = sprite_icon('warning', size: 18, css_class: 'error-icon')
%span.error-text.prepend-left-5 %span.error-text.prepend-left-5
= s_('Geo|Verification failed - %{error}') % { error: project_registry.last_repository_verification_failure } = s_('Geo|Verification failed - %{error}') % { error: project_registry.last_repository_verification_failure }
.col-sm-4.project-status-container
.project-status-title.text-muted
= s_('Geo|Retry count')
.project-status-content
= project_registry.repository_retry_count.nil? ? 0 : project_registry.repository_retry_count
...@@ -21,4 +21,3 @@ ...@@ -21,4 +21,3 @@
= time_ago_with_tooltip(project_registry.last_repository_synced_at, placement: 'bottom') = time_ago_with_tooltip(project_registry.last_repository_synced_at, placement: 'bottom')
- else - else
= s_('Geo|Never') = s_('Geo|Never')
.col-sm.d-sm-none.d-md-block
...@@ -21,4 +21,3 @@ ...@@ -21,4 +21,3 @@
= time_ago_with_tooltip(project_registry.last_repository_check_at, placement: 'bottom') = time_ago_with_tooltip(project_registry.last_repository_check_at, placement: 'bottom')
- else - else
= s_('Geo|Never') = s_('Geo|Never')
.col-sm.d-sm-none.d-md-block
- if Gitlab::Geo.secondary? && @project.project_registry
.card
.card-header
= s_('Geo|Geo Status')
.float-right
= link_to(recheck_admin_geo_project_path(@project.project_registry), method: :post, class: 'btn btn-default btn-sm mr-2') do
= s_('Geo|Recheck')
= link_to(resync_admin_geo_project_path(@project.project_registry), method: :post, class: 'btn btn-default-primary btn-sm') do
= s_('Geo|Resync')
= render partial: "admin/geo/projects/registry_#{@project.project_registry.synchronization_state}", locals: { project_registry: @project.project_registry }
---
title: 'Geo: Add a Geo Status Widget to Admin > Projects'
merge_request: 7789
author:
type: added
# frozen_string_literal: true
require 'spec_helper'
describe Admin::ProjectsController do
include EE::GeoHelpers
let!(:project_registry) { create(:geo_project_registry) }
let(:project) { project_registry.project }
before do
sign_in(create(:admin))
end
describe 'GET /projects/:id' do
subject { get :show, namespace_id: project.namespace.path, id: project.path }
render_views
it 'includes Geo Status widget partial' do
expect(subject).to have_gitlab_http_status(200)
expect(subject.body).to match(project.name)
expect(subject).to render_template(partial: 'admin/projects/_geo_status_widget')
end
context 'when Geo is enabled and is a secondary node' do
before do
stub_current_geo_node(create(:geo_node))
end
it 'renders Geo Status widget' do
expect(subject.body).to match('Geo Status')
end
end
context 'without Geo enabled' do
it 'doesnt render Geo Status widget' do
expect(subject.body).not_to match('Geo Status')
end
end
end
end
...@@ -3658,6 +3658,9 @@ msgstr "" ...@@ -3658,6 +3658,9 @@ msgstr ""
msgid "Geo|File sync capacity" msgid "Geo|File sync capacity"
msgstr "" msgstr ""
msgid "Geo|Geo Status"
msgstr ""
msgid "Geo|Groups to synchronize" msgid "Geo|Groups to synchronize"
msgstr "" msgstr ""
...@@ -3718,9 +3721,6 @@ msgstr "" ...@@ -3718,9 +3721,6 @@ msgstr ""
msgid "Geo|Retry count" msgid "Geo|Retry count"
msgstr "" msgstr ""
msgid "Geo|Retry counts"
msgstr ""
msgid "Geo|Select groups to replicate." msgid "Geo|Select groups to replicate."
msgstr "" msgstr ""
......
...@@ -42,4 +42,15 @@ describe Admin::ProjectsController do ...@@ -42,4 +42,15 @@ describe Admin::ProjectsController do
expect { get :index }.not_to exceed_query_limit(control_count) expect { get :index }.not_to exceed_query_limit(control_count)
end end
end end
describe 'GET /projects/:id' do
render_views
it 'renders show page' do
get :show, namespace_id: project.namespace.path, id: project.path
expect(response).to have_gitlab_http_status(200)
expect(response.body).to match(project.name)
end
end
end 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