Commit 7f06b11a authored by Nick Kipling's avatar Nick Kipling

Added custom empty strings for each package type

Updated snapshot
Updated tests
Updated pot file
parent 34426a7f
...@@ -54,12 +54,21 @@ export default { ...@@ -54,12 +54,21 @@ export default {
this.setSelectedType(selectedType); this.setSelectedType(selectedType);
this.requestPackagesList(); this.requestPackagesList();
}, },
emptyStateTitle({ title, type }) {
if (type) {
return sprintf(s__('PackageRegistry|There are no %{packageType} packages yet'), {
packageType: title,
});
}
return s__('PackageRegistry|There are no packages yet');
},
}, },
}; };
</script> </script>
<template> <template>
<gl-tabs @input="tabChanged"> <gl-tabs active-tab-class="js-package-active-tab" @input="tabChanged">
<template #tabs-end> <template #tabs-end>
<div class="align-self-center ml-auto"> <div class="align-self-center ml-auto">
<package-sort @sort:changed="requestPackagesList" /> <package-sort @sort:changed="requestPackagesList" />
...@@ -69,10 +78,7 @@ export default { ...@@ -69,10 +78,7 @@ export default {
<gl-tab v-for="(tab, index) in tabsToRender" :key="index" :title="tab.title"> <gl-tab v-for="(tab, index) in tabsToRender" :key="index" :title="tab.title">
<package-list @page:changed="onPageChanged" @package:delete="onPackageDeleteRequest"> <package-list @page:changed="onPageChanged" @package:delete="onPackageDeleteRequest">
<template #empty-state> <template #empty-state>
<gl-empty-state <gl-empty-state :title="emptyStateTitle(tab)" :svg-path="emptyListIllustration">
:title="s__('PackageRegistry|There are no packages yet')"
:svg-path="emptyListIllustration"
>
<template #description> <template #description>
<p v-html="emptyListText"></p> <p v-html="emptyListText"></p>
</template> </template>
......
import { __, s__ } from '~/locale'; import { __, s__ } from '~/locale';
import { PackageType } from '../shared/constants';
export const FETCH_PACKAGES_LIST_ERROR_MESSAGE = __( export const FETCH_PACKAGES_LIST_ERROR_MESSAGE = __(
'Something went wrong while fetching the packages list.', 'Something went wrong while fetching the packages list.',
...@@ -74,18 +75,18 @@ export const PACKAGE_REGISTRY_TABS = [ ...@@ -74,18 +75,18 @@ export const PACKAGE_REGISTRY_TABS = [
}, },
{ {
title: s__('PackageRegistry|Conan'), title: s__('PackageRegistry|Conan'),
type: 'conan', type: PackageType.CONAN,
}, },
{ {
title: s__('PackageRegistry|Maven'), title: s__('PackageRegistry|Maven'),
type: 'maven', type: PackageType.MAVEN,
}, },
{ {
title: s__('PackageRegistry|NPM'), title: s__('PackageRegistry|NPM'),
type: 'npm', type: PackageType.NPM,
}, },
{ {
title: s__('PackageRegistry|NuGet'), title: s__('PackageRegistry|NuGet'),
type: 'nuget', type: PackageType.NUGET,
}, },
]; ];
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
exports[`packages_list_app renders 1`] = ` exports[`packages_list_app renders 1`] = `
<b-tabs-stub <b-tabs-stub
activenavitemclass="gl-tab-nav-item-active gl-tab-nav-item-active-indigo" activenavitemclass="gl-tab-nav-item-active gl-tab-nav-item-active-indigo"
activetabclass="js-package-active-tab"
class="gl-tabs" class="gl-tabs"
contentclass=",gl-tab-content" contentclass=",gl-tab-content"
navclass="gl-tabs-nav" navclass="gl-tabs-nav"
...@@ -97,7 +98,7 @@ exports[`packages_list_app renders 1`] = ` ...@@ -97,7 +98,7 @@ exports[`packages_list_app renders 1`] = `
class="svg-250 svg-content" class="svg-250 svg-content"
> >
<img <img
alt="There are no packages yet" alt="There are no Conan packages yet"
class="" class=""
src="helpSvg" src="helpSvg"
/> />
...@@ -114,7 +115,7 @@ exports[`packages_list_app renders 1`] = ` ...@@ -114,7 +115,7 @@ exports[`packages_list_app renders 1`] = `
class="center" class="center"
style="" style=""
> >
There are no packages yet There are no Conan packages yet
</h4> </h4>
<p <p
...@@ -164,7 +165,7 @@ exports[`packages_list_app renders 1`] = ` ...@@ -164,7 +165,7 @@ exports[`packages_list_app renders 1`] = `
class="svg-250 svg-content" class="svg-250 svg-content"
> >
<img <img
alt="There are no packages yet" alt="There are no Maven packages yet"
class="" class=""
src="helpSvg" src="helpSvg"
/> />
...@@ -181,7 +182,7 @@ exports[`packages_list_app renders 1`] = ` ...@@ -181,7 +182,7 @@ exports[`packages_list_app renders 1`] = `
class="center" class="center"
style="" style=""
> >
There are no packages yet There are no Maven packages yet
</h4> </h4>
<p <p
...@@ -231,7 +232,7 @@ exports[`packages_list_app renders 1`] = ` ...@@ -231,7 +232,7 @@ exports[`packages_list_app renders 1`] = `
class="svg-250 svg-content" class="svg-250 svg-content"
> >
<img <img
alt="There are no packages yet" alt="There are no NPM packages yet"
class="" class=""
src="helpSvg" src="helpSvg"
/> />
...@@ -248,7 +249,7 @@ exports[`packages_list_app renders 1`] = ` ...@@ -248,7 +249,7 @@ exports[`packages_list_app renders 1`] = `
class="center" class="center"
style="" style=""
> >
There are no packages yet There are no NPM packages yet
</h4> </h4>
<p <p
...@@ -298,7 +299,7 @@ exports[`packages_list_app renders 1`] = ` ...@@ -298,7 +299,7 @@ exports[`packages_list_app renders 1`] = `
class="svg-250 svg-content" class="svg-250 svg-content"
> >
<img <img
alt="There are no packages yet" alt="There are no NuGet packages yet"
class="" class=""
src="helpSvg" src="helpSvg"
/> />
...@@ -315,7 +316,7 @@ exports[`packages_list_app renders 1`] = ` ...@@ -315,7 +316,7 @@ exports[`packages_list_app renders 1`] = `
class="center" class="center"
style="" style=""
> >
There are no packages yet There are no NuGet packages yet
</h4> </h4>
<p <p
......
...@@ -58,13 +58,20 @@ describe('packages_list_app', () => { ...@@ -58,13 +58,20 @@ describe('packages_list_app', () => {
expect(wrapper.element).toMatchSnapshot(); expect(wrapper.element).toMatchSnapshot();
}); });
it('generate the correct empty list link', () => { describe('empty state', () => {
const emptyState = findListComponent(); it('generate the correct empty list link', () => {
const link = emptyState.find('a'); const link = findListComponent().find('a');
expect(link.html()).toMatchInlineSnapshot( expect(link.html()).toMatchInlineSnapshot(
`"<a href=\\"${emptyListHelpUrl}\\" target=\\"_blank\\">publish and share your packages</a>"`, `"<a href=\\"${emptyListHelpUrl}\\" target=\\"_blank\\">publish and share your packages</a>"`,
); );
});
it('includes the right content on the default tab', () => {
const heading = findListComponent().find('h4');
expect(heading.text()).toBe('There are no packages yet');
});
}); });
it('call requestPackagesList on page:changed', () => { it('call requestPackagesList on page:changed', () => {
......
...@@ -13951,6 +13951,9 @@ msgstr "" ...@@ -13951,6 +13951,9 @@ msgstr ""
msgid "PackageRegistry|Remove package" msgid "PackageRegistry|Remove package"
msgstr "" msgstr ""
msgid "PackageRegistry|There are no %{packageType} packages yet"
msgstr ""
msgid "PackageRegistry|There are no packages yet" msgid "PackageRegistry|There are no packages yet"
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