Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1e60e3c1
Commit
1e60e3c1
authored
Mar 19, 2020
by
Nick Kipling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated with custom empty message
Displays a custom empty message when no filter results Updated tests
parent
39e416cf
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
51 additions
and
14 deletions
+51
-14
ee/app/assets/javascripts/packages/list/components/packages_list_app.vue
...avascripts/packages/list/components/packages_list_app.vue
+9
-2
ee/app/assets/javascripts/packages/list/stores/state.js
ee/app/assets/javascripts/packages/list/stores/state.js
+4
-0
ee/spec/frontend/packages/list/components/packages_list_app_spec.js
...ontend/packages/list/components/packages_list_app_spec.js
+32
-12
locale/gitlab.pot
locale/gitlab.pot
+6
-0
No files found.
ee/app/assets/javascripts/packages/list/components/packages_list_app.vue
View file @
1e60e3c1
...
...
@@ -18,12 +18,15 @@ export default {
},
computed
:
{
...
mapState
({
resourceId
:
state
=>
state
.
config
.
resourceId
,
emptyListIllustration
:
state
=>
state
.
config
.
emptyListIllustration
,
emptyListHelpUrl
:
state
=>
state
.
config
.
emptyListHelpUrl
,
totalItems
:
state
=>
state
.
pagination
.
total
,
filterQuery
:
state
=>
state
.
filterQuery
,
}),
emptyListText
()
{
if
(
this
.
filterQuery
)
{
return
s__
(
'
PackageRegistry|To widen your search, change or remove the filters above.
'
);
}
return
sprintf
(
s__
(
'
PackageRegistry|Learn how to %{noPackagesLinkStart}publish and share your packages%{noPackagesLinkEnd} with GitLab.
'
,
...
...
@@ -57,6 +60,10 @@ export default {
this
.
requestPackagesList
();
},
emptyStateTitle
({
title
,
type
})
{
if
(
this
.
filterQuery
)
{
return
s__
(
'
PackageRegistry|Sorry, your filter produced no results
'
);
}
if
(
type
)
{
return
sprintf
(
s__
(
'
PackageRegistry|There are no %{packageType} packages yet
'
),
{
packageType
:
title
,
...
...
ee/app/assets/javascripts/packages/list/stores/state.js
View file @
1e60e3c1
...
...
@@ -43,4 +43,8 @@ export default () => ({
sort
:
'
desc
'
,
orderBy
:
'
created_at
'
,
},
/**
* The search query that is used to filter packages by name
*/
filterQuery
:
''
,
});
ee/spec/frontend/packages/list/components/packages_list_app_spec.js
View file @
1e60e3c1
...
...
@@ -17,9 +17,25 @@ describe('packages_list_app', () => {
const
GlLoadingIcon
=
{
name
:
'
gl-loading-icon
'
,
template
:
'
<div>loading</div>
'
};
const
emptyListHelpUrl
=
'
helpUrl
'
;
const
findEmptyState
=
()
=>
wrapper
.
find
(
GlEmptyState
);
const
findListComponent
=
()
=>
wrapper
.
find
(
PackageList
);
const
findTabComponent
=
(
index
=
0
)
=>
wrapper
.
findAll
(
GlTab
).
at
(
index
);
const
createStore
=
(
filterQuery
=
''
)
=>
{
store
=
new
Vuex
.
Store
({
state
:
{
isLoading
:
false
,
config
:
{
resourceId
:
'
project_id
'
,
emptyListIllustration
:
'
helpSvg
'
,
emptyListHelpUrl
,
},
filterQuery
,
},
});
store
.
dispatch
=
jest
.
fn
();
};
const
mountComponent
=
()
=>
{
wrapper
=
shallowMount
(
PackageListApp
,
{
localVue
,
...
...
@@ -35,17 +51,7 @@ describe('packages_list_app', () => {
};
beforeEach
(()
=>
{
store
=
new
Vuex
.
Store
({
state
:
{
isLoading
:
false
,
config
:
{
resourceId
:
'
project_id
'
,
emptyListIllustration
:
'
helpSvg
'
,
emptyListHelpUrl
,
},
},
});
store
.
dispatch
=
jest
.
fn
();
createStore
();
mountComponent
();
});
...
...
@@ -73,7 +79,7 @@ describe('packages_list_app', () => {
});
it
(
'
includes the right content on the default tab
'
,
()
=>
{
const
heading
=
find
ListComponent
().
find
(
'
h4
'
);
const
heading
=
find
EmptyState
().
find
(
'
h4
'
);
expect
(
heading
.
text
()).
toBe
(
'
There are no packages yet
'
);
});
...
...
@@ -110,4 +116,18 @@ describe('packages_list_app', () => {
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
requestPackagesList
'
);
});
});
describe
(
'
filter without results
'
,
()
=>
{
beforeEach
(()
=>
{
createStore
(
'
foo
'
);
mountComponent
();
});
it
(
'
should show specific empty message
'
,
()
=>
{
expect
(
findEmptyState
().
text
()).
toContain
(
'
Sorry, your filter produced no results
'
);
expect
(
findEmptyState
().
text
()).
toContain
(
'
To widen your search, change or remove the filters above
'
,
);
});
});
});
locale/gitlab.pot
View file @
1e60e3c1
...
...
@@ -14017,6 +14017,9 @@ msgstr ""
msgid "PackageRegistry|Remove package"
msgstr ""
msgid "PackageRegistry|Sorry, your filter produced no results"
msgstr ""
msgid "PackageRegistry|There are no %{packageType} packages yet"
msgstr ""
...
...
@@ -14026,6 +14029,9 @@ msgstr ""
msgid "PackageRegistry|There was a problem fetching the details for this package."
msgstr ""
msgid "PackageRegistry|To widen your search, change or remove the filters above."
msgstr ""
msgid "PackageRegistry|Unable to load package"
msgstr ""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment