Commit 1a93abaa authored by Nathan Friend's avatar Nathan Friend

Merge branch '200014-update-geo-replication-empty' into 'master'

Add Geo Replication Empty States

Closes #200014

See merge request gitlab-org/gitlab!31010
parents 4ae6f414 14ff3ef3
...@@ -14,11 +14,7 @@ export default { ...@@ -14,11 +14,7 @@ export default {
GeoReplicableEmptyState, GeoReplicableEmptyState,
}, },
props: { props: {
geoSvgPath: { geoReplicableEmptySvgPath: {
type: String,
required: true,
},
issuesSvgPath: {
type: String, type: String,
required: true, required: true,
}, },
...@@ -50,7 +46,7 @@ export default { ...@@ -50,7 +46,7 @@ export default {
<geo-replicable v-if="hasReplicableItems" /> <geo-replicable v-if="hasReplicableItems" />
<geo-replicable-empty-state <geo-replicable-empty-state
v-else v-else
:issues-svg-path="issuesSvgPath" :geo-replicable-empty-svg-path="geoReplicableEmptySvgPath"
:geo-troubleshooting-link="geoTroubleshootingLink" :geo-troubleshooting-link="geoTroubleshootingLink"
/> />
</template> </template>
......
...@@ -9,7 +9,7 @@ export default { ...@@ -9,7 +9,7 @@ export default {
GlEmptyState, GlEmptyState,
}, },
props: { props: {
issuesSvgPath: { geoReplicableEmptySvgPath: {
type: String, type: String,
required: true, required: true,
}, },
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
linkText() { linkText() {
return sprintf( return sprintf(
s__( s__(
'If you believe this may be an error, please refer to the %{linkStart}Geo Troubleshooting%{linkEnd} documentation for more information.', 'Geo|Adjust your filters/search criteria above. If you believe this may be an error, please refer to the %{linkStart}Geo Troubleshooting%{linkEnd} documentation for more information.',
), ),
{ {
linkStart: `<a href="${this.geoTroubleshootingLink}" target="_blank">`, linkStart: `<a href="${this.geoTroubleshootingLink}" target="_blank">`,
...@@ -38,12 +38,11 @@ export default { ...@@ -38,12 +38,11 @@ export default {
<template> <template>
<gl-empty-state <gl-empty-state
:title="sprintf(__('No %{replicableType} match this filter'), { replicableType })" :title="sprintf(__('There are no %{replicableType} to show'), { replicableType })"
:svg-path="issuesSvgPath" :svg-path="geoReplicableEmptySvgPath"
> >
<template #description> <template #description>
<div class="text-center"> <div>
<p>{{ __('Adjust your filters/search criteria above.') }}</p>
<p v-html="linkText"></p> <p v-html="linkText"></p>
</div> </div>
</template> </template>
......
...@@ -17,22 +17,20 @@ export default () => { ...@@ -17,22 +17,20 @@ export default () => {
}, },
data() { data() {
const { const {
dataset: { geoSvgPath, issuesSvgPath, geoTroubleshootingLink }, dataset: { geoTroubleshootingLink, geoReplicableEmptySvgPath },
} = this.$options.el; } = this.$options.el;
return { return {
geoSvgPath,
issuesSvgPath,
geoTroubleshootingLink, geoTroubleshootingLink,
geoReplicableEmptySvgPath,
}; };
}, },
render(createElement) { render(createElement) {
return createElement('geo-replicable-app', { return createElement('geo-replicable-app', {
props: { props: {
geoSvgPath: this.geoSvgPath,
issuesSvgPath: this.issuesSvgPath,
geoTroubleshootingLink: this.geoTroubleshootingLink, geoTroubleshootingLink: this.geoTroubleshootingLink,
geoReplicableEmptySvgPath: this.geoReplicableEmptySvgPath,
}, },
}); });
}, },
......
- page_title _('Geo Designs') - page_title _('Geo Designs')
#js-geo-replicable{ data: { "geo-svg-path" => image_path('illustrations/empty-state/geo-empty.svg'), #js-geo-replicable{ data: { "geo-replicable-empty-svg-path" => image_path('illustrations/empty-state/geo-replication-empty.svg'),
"issues-svg-path" => image_path('illustrations/issues.svg'),
"geo-troubleshooting-link" => help_page_path('administration/geo/replication/troubleshooting.html'), "geo-troubleshooting-link" => help_page_path('administration/geo/replication/troubleshooting.html'),
"replicable-type" => 'designs' } } "replicable-type" => 'designs' } }
- @registries.each do |project_registry| - if @registries.any?
- @registries.each do |project_registry|
.card.project-card.prepend-top-15 .card.project-card.prepend-top-15
.card-header{ id: "project-#{project_registry.project_id}-header" } .card-header{ id: "project-#{project_registry.project_id}-header" }
.d-flex.align-items-center .d-flex.align-items-center
...@@ -16,4 +17,6 @@ ...@@ -16,4 +17,6 @@
= render partial: "registry_#{project_registry.synchronization_state}", locals: { project_registry: project_registry } = render partial: "registry_#{project_registry.synchronization_state}", locals: { project_registry: project_registry }
= paginate @registries, theme: 'gitlab' = paginate @registries, theme: 'gitlab'
- else
= render 'shared/empty_states/geo_replication', replicable_type: _('projects')
- @registries.each do |project_registry| - if @registries.any?
- @registries.each do |project_registry|
.card.project-card.prepend-top-15 .card.project-card.prepend-top-15
.card-header{ id: "project-#{project_registry.project_id}-header" } .card-header{ id: "project-#{project_registry.project_id}-header" }
.d-flex.align-items-center .d-flex.align-items-center
...@@ -15,4 +16,6 @@ ...@@ -15,4 +16,6 @@
= render partial: 'registry_failed', locals: { project_registry: project_registry } = render partial: 'registry_failed', locals: { project_registry: project_registry }
= paginate @registries, theme: 'gitlab' = paginate @registries, theme: 'gitlab'
- else
= render 'shared/empty_states/geo_replication', replicable_type: _('projects')
- @registries.each do |project_registry| - if @registries.any?
- @registries.each do |project_registry|
.card.project-card.prepend-top-15 .card.project-card.prepend-top-15
.card-header{ id: "project-#{project_registry.project_id}-header" } .card-header{ id: "project-#{project_registry.project_id}-header" }
.d-flex.align-items-center .d-flex.align-items-center
...@@ -16,4 +17,6 @@ ...@@ -16,4 +17,6 @@
= render partial: 'registry_pending', locals: { project_registry: project_registry } = render partial: 'registry_pending', locals: { project_registry: project_registry }
= paginate @registries, theme: 'gitlab' = paginate @registries, theme: 'gitlab'
- else
= render 'shared/empty_states/geo_replication', replicable_type: _('projects')
- @registries.each do |project_registry| - if @registries.any?
- @registries.each do |project_registry|
.card.project-card.prepend-top-15 .card.project-card.prepend-top-15
.card-header{ id: "project-#{project_registry.project_id}-header" } .card-header{ id: "project-#{project_registry.project_id}-header" }
.d-flex.align-items-center .d-flex.align-items-center
...@@ -14,4 +15,6 @@ ...@@ -14,4 +15,6 @@
= render partial: 'registry_synced', locals: { project_registry: project_registry } = render partial: 'registry_synced', locals: { project_registry: project_registry }
= paginate @registries, theme: 'gitlab' = paginate @registries, theme: 'gitlab'
- else
= render 'shared/empty_states/geo_replication', replicable_type: _('projects')
...@@ -19,7 +19,10 @@ ...@@ -19,7 +19,10 @@
.nav-controls .nav-controls
= render(partial: 'shared/projects/search_form', autofocus: true) = render(partial: 'shared/projects/search_form', autofocus: true)
- @registries.each do |upload_registry| - if @registries.any?
- @registries.each do |upload_registry|
= render partial: 'registry', locals: { upload_registry: upload_registry } = render partial: 'registry', locals: { upload_registry: upload_registry }
= paginate @registries, theme: 'gitlab' = paginate @registries, theme: 'gitlab'
- else
= render 'shared/empty_states/geo_replication', replicable_type: _('uploads')
- geo_troubleshooting_link = help_page_path('administration/geo/replication/troubleshooting.html')
.row.empty-state
.col-12
.svg-content.svg-250
= image_tag 'illustrations/empty-state/geo-replication-empty.svg'
.col-12
.text-content
%h4.text-center= sprintf(s_('Geo|There are no %{replicable_type} to show'), { replicable_type: replicable_type })
%p
= sprintf(s_('Adjust your filters/search criteria above. If you believe this may be an error, please refer to the %{linkStart}Geo Troubleshooting%{linkEnd} documentation for more information.') , { linkStart: "<a href=\"#{geo_troubleshooting_link}\" target=\"_blank\">", linkEnd: "</a>", }).html_safe;
---
title: Geo - Add Empty States
merge_request: 31010
author:
type: changed
...@@ -30,6 +30,7 @@ describe 'admin Geo Projects', :js, :geo do ...@@ -30,6 +30,7 @@ describe 'admin Geo Projects', :js, :geo do
expect(page).to have_content(sync_pending_registry.project.full_name) expect(page).to have_content(sync_pending_registry.project.full_name)
expect(page).to have_content(sync_failed_registry.project.full_name) expect(page).to have_content(sync_failed_registry.project.full_name)
expect(page).to have_content(never_synced_registry.project.full_name) expect(page).to have_content(never_synced_registry.project.full_name)
expect(page).not_to have_content('There are no projects to show')
end end
end end
...@@ -45,6 +46,24 @@ describe 'admin Geo Projects', :js, :geo do ...@@ -45,6 +46,24 @@ describe 'admin Geo Projects', :js, :geo do
expect(page).not_to have_content(sync_pending_registry.project.full_name) expect(page).not_to have_content(sync_pending_registry.project.full_name)
expect(page).not_to have_content(sync_failed_registry.project.full_name) expect(page).not_to have_content(sync_failed_registry.project.full_name)
expect(page).not_to have_content(never_synced_registry.project.full_name) expect(page).not_to have_content(never_synced_registry.project.full_name)
expect(page).not_to have_content('There are no projects to show')
end
end
end
describe 'with no registries', :geo_fdw do
it 'shows empty state' do
fill_in :name, with: 'asdfasdf'
find('#project-filter-form-field').native.send_keys(:enter)
wait_for_requests
page.within(find('#content-body', match: :first)) do
expect(page).not_to have_content(synced_registry.project.full_name)
expect(page).not_to have_content(sync_pending_registry.project.full_name)
expect(page).not_to have_content(sync_failed_registry.project.full_name)
expect(page).not_to have_content(never_synced_registry.project.full_name)
expect(page).to have_content('There are no projects to show')
end end
end end
end end
......
...@@ -11,6 +11,48 @@ describe 'admin Geo Uploads', :js, :geo do ...@@ -11,6 +11,48 @@ describe 'admin Geo Uploads', :js, :geo do
sign_in(create(:admin)) sign_in(create(:admin))
end end
describe 'visiting geo uploads initial page' do
before do
visit(admin_geo_uploads_path)
wait_for_requests
end
it 'shows all uploads in the registry' do
page.within(find('#content-body', match: :first)) do
expect(page).to have_content(synced_registry.file)
expect(page).not_to have_content('There are no uploads to show')
end
end
describe 'searching for a geo upload', :geo_fdw do
it 'filters out uploads with the search term' do
fill_in :name, with: synced_registry.file
find('#project-filter-form-field').native.send_keys(:enter)
wait_for_requests
page.within(find('#content-body', match: :first)) do
expect(page).to have_content(synced_registry.file)
expect(page).not_to have_content('There are no uploads to show')
end
end
end
describe 'with no registries', :geo_fdw do
it 'shows empty state' do
fill_in :name, with: 'asdfasdf'
find('#project-filter-form-field').native.send_keys(:enter)
wait_for_requests
page.within(find('#content-body', match: :first)) do
expect(page).not_to have_content(synced_registry.file)
expect(page).to have_content('There are no uploads to show')
end
end
end
end
describe 'remove an orphaned Tracking Entry' do describe 'remove an orphaned Tracking Entry' do
before do before do
synced_registry.upload.destroy! synced_registry.upload.destroy!
......
...@@ -7,8 +7,7 @@ import GeoReplicable from 'ee/geo_replicable/components/geo_replicable.vue'; ...@@ -7,8 +7,7 @@ import GeoReplicable from 'ee/geo_replicable/components/geo_replicable.vue';
import GeoReplicableEmptyState from 'ee/geo_replicable/components/geo_replicable_empty_state.vue'; import GeoReplicableEmptyState from 'ee/geo_replicable/components/geo_replicable_empty_state.vue';
import GeoReplicableFilterBar from 'ee/geo_replicable/components/geo_replicable_filter_bar.vue'; import GeoReplicableFilterBar from 'ee/geo_replicable/components/geo_replicable_filter_bar.vue';
import { import {
MOCK_GEO_SVG_PATH, MOCK_GEO_REPLICATION_SVG_PATH,
MOCK_ISSUES_SVG_PATH,
MOCK_GEO_TROUBLESHOOTING_LINK, MOCK_GEO_TROUBLESHOOTING_LINK,
MOCK_BASIC_FETCH_DATA_MAP, MOCK_BASIC_FETCH_DATA_MAP,
} from '../mock_data'; } from '../mock_data';
...@@ -20,9 +19,8 @@ describe('GeoReplicableApp', () => { ...@@ -20,9 +19,8 @@ describe('GeoReplicableApp', () => {
let wrapper; let wrapper;
const propsData = { const propsData = {
geoSvgPath: MOCK_GEO_SVG_PATH,
issuesSvgPath: MOCK_ISSUES_SVG_PATH,
geoTroubleshootingLink: MOCK_GEO_TROUBLESHOOTING_LINK, geoTroubleshootingLink: MOCK_GEO_TROUBLESHOOTING_LINK,
geoReplicableEmptySvgPath: MOCK_GEO_REPLICATION_SVG_PATH,
}; };
const actionSpies = { const actionSpies = {
......
import Vuex from 'vuex'; import Vuex from 'vuex';
import { createLocalVue, mount } from '@vue/test-utils'; import { createLocalVue, shallowMount } from '@vue/test-utils';
import { GlEmptyState } from '@gitlab/ui'; import { GlEmptyState } from '@gitlab/ui';
import store from 'ee/geo_replicable/store'; import store from 'ee/geo_replicable/store';
import GeoReplicableEmptyState from 'ee/geo_replicable/components/geo_replicable_empty_state.vue'; import GeoReplicableEmptyState from 'ee/geo_replicable/components/geo_replicable_empty_state.vue';
import { MOCK_ISSUES_SVG_PATH, MOCK_GEO_TROUBLESHOOTING_LINK } from '../mock_data'; import { MOCK_GEO_REPLICATION_SVG_PATH, MOCK_GEO_TROUBLESHOOTING_LINK } from '../mock_data';
const localVue = createLocalVue(); const localVue = createLocalVue();
localVue.use(Vuex); localVue.use(Vuex);
...@@ -12,12 +12,12 @@ describe('GeoReplicableEmptyState', () => { ...@@ -12,12 +12,12 @@ describe('GeoReplicableEmptyState', () => {
let wrapper; let wrapper;
const propsData = { const propsData = {
issuesSvgPath: MOCK_ISSUES_SVG_PATH,
geoTroubleshootingLink: MOCK_GEO_TROUBLESHOOTING_LINK, geoTroubleshootingLink: MOCK_GEO_TROUBLESHOOTING_LINK,
geoReplicableEmptySvgPath: MOCK_GEO_REPLICATION_SVG_PATH,
}; };
const createComponent = () => { const createComponent = () => {
wrapper = mount(GeoReplicableEmptyState, { wrapper = shallowMount(GeoReplicableEmptyState, {
localVue, localVue,
store, store,
propsData, propsData,
...@@ -29,19 +29,20 @@ describe('GeoReplicableEmptyState', () => { ...@@ -29,19 +29,20 @@ describe('GeoReplicableEmptyState', () => {
}); });
const findGlEmptyState = () => wrapper.find(GlEmptyState); const findGlEmptyState = () => wrapper.find(GlEmptyState);
const findLink = () => findGlEmptyState().find('a');
describe('template', () => { describe('template', () => {
beforeEach(() => { beforeEach(() => {
createComponent(); createComponent();
}); });
it('renders GlEmptyState', () => { describe('GlEmptyState', () => {
it('renders always', () => {
expect(findGlEmptyState().exists()).toBe(true); expect(findGlEmptyState().exists()).toBe(true);
}); });
it('Link renders', () => { it('sets correct svg', () => {
expect(findLink().exists()).toBe(true); expect(findGlEmptyState().attributes('svgpath')).toBe(MOCK_GEO_REPLICATION_SVG_PATH);
});
}); });
}); });
}); });
import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils';
export const MOCK_GEO_SVG_PATH = 'illustrations/empty-state/geo-empty.svg'; export const MOCK_GEO_REPLICATION_SVG_PATH = 'illustrations/empty-state/geo-replication-empty.svg';
export const MOCK_ISSUES_SVG_PATH = 'illustrations/issues.svg';
export const MOCK_GEO_TROUBLESHOOTING_LINK = export const MOCK_GEO_TROUBLESHOOTING_LINK =
'https://docs.gitlab.com/ee/administration/geo/replication/troubleshooting.html'; 'https://docs.gitlab.com/ee/administration/geo/replication/troubleshooting.html';
......
...@@ -1356,7 +1356,7 @@ msgstr "" ...@@ -1356,7 +1356,7 @@ msgstr ""
msgid "Adds an issue to an epic." msgid "Adds an issue to an epic."
msgstr "" msgstr ""
msgid "Adjust your filters/search criteria above." msgid "Adjust your filters/search criteria above. If you believe this may be an error, please refer to the %{linkStart}Geo Troubleshooting%{linkEnd} documentation for more information."
msgstr "" msgstr ""
msgid "Admin Area" msgid "Admin Area"
...@@ -9790,6 +9790,9 @@ msgstr "" ...@@ -9790,6 +9790,9 @@ msgstr ""
msgid "Geo|%{name} is scheduled for re-verify" msgid "Geo|%{name} is scheduled for re-verify"
msgstr "" msgstr ""
msgid "Geo|Adjust your filters/search criteria above. If you believe this may be an error, please refer to the %{linkStart}Geo Troubleshooting%{linkEnd} documentation for more information."
msgstr ""
msgid "Geo|All" msgid "Geo|All"
msgstr "" msgstr ""
...@@ -9913,6 +9916,9 @@ msgstr "" ...@@ -9913,6 +9916,9 @@ msgstr ""
msgid "Geo|The node is currently %{minutes_behind} behind the primary node." msgid "Geo|The node is currently %{minutes_behind} behind the primary node."
msgstr "" msgstr ""
msgid "Geo|There are no %{replicable_type} to show"
msgstr ""
msgid "Geo|Tracking database entry will be removed. Are you sure?" msgid "Geo|Tracking database entry will be removed. Are you sure?"
msgstr "" msgstr ""
...@@ -11132,9 +11138,6 @@ msgstr "" ...@@ -11132,9 +11138,6 @@ msgstr ""
msgid "If using GitHub, you’ll see pipeline statuses on GitHub for your commits and pull requests. %{more_info_link}" msgid "If using GitHub, you’ll see pipeline statuses on GitHub for your commits and pull requests. %{more_info_link}"
msgstr "" msgstr ""
msgid "If you believe this may be an error, please refer to the %{linkStart}Geo Troubleshooting%{linkEnd} documentation for more information."
msgstr ""
msgid "If you lose your recovery codes you can generate new ones, invalidating all previous codes." msgid "If you lose your recovery codes you can generate new ones, invalidating all previous codes."
msgstr "" msgstr ""
...@@ -13798,9 +13801,6 @@ msgstr "" ...@@ -13798,9 +13801,6 @@ msgstr ""
msgid "No %{providerTitle} repositories found" msgid "No %{providerTitle} repositories found"
msgstr "" msgstr ""
msgid "No %{replicableType} match this filter"
msgstr ""
msgid "No Epic" msgid "No Epic"
msgstr "" msgstr ""
...@@ -20962,6 +20962,9 @@ msgstr "" ...@@ -20962,6 +20962,9 @@ msgstr ""
msgid "The vulnerability is no longer detected. Verify the vulnerability has been remediated before changing its status." msgid "The vulnerability is no longer detected. Verify the vulnerability has been remediated before changing its status."
msgstr "" msgstr ""
msgid "There are no %{replicableType} to show"
msgstr ""
msgid "There are no GPG keys associated with this account." msgid "There are no GPG keys associated with this account."
msgstr "" msgstr ""
...@@ -25821,6 +25824,9 @@ msgstr "" ...@@ -25821,6 +25824,9 @@ msgstr ""
msgid "updated %{time_ago}" msgid "updated %{time_ago}"
msgstr "" msgstr ""
msgid "uploads"
msgstr ""
msgid "user avatar" msgid "user avatar"
msgstr "" 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