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
195880bb
Commit
195880bb
authored
Apr 14, 2021
by
Nicolò Maria Mezzopera
Committed by
Jose Ivan Vargas
Apr 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve "Package sort: showing Project in the project page"
parent
f379f644
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
35 additions
and
15 deletions
+35
-15
app/assets/javascripts/packages/list/components/package_search.vue
...s/javascripts/packages/list/components/package_search.vue
+2
-2
app/assets/javascripts/packages/list/utils.js
app/assets/javascripts/packages/list/utils.js
+2
-2
app/assets/javascripts/packages_and_registries/infrastructure_registry/components/infrastructure_search.vue
...rastructure_registry/components/infrastructure_search.vue
+2
-2
changelogs/unreleased/327692-package-sort-showing-project-in-the-project-page.yml
...7692-package-sort-showing-project-in-the-project-page.yml
+5
-0
spec/frontend/packages/list/components/packages_search_spec.js
...frontend/packages/list/components/packages_search_spec.js
+3
-3
spec/frontend/packages/list/utils_spec.js
spec/frontend/packages/list/utils_spec.js
+10
-1
spec/frontend/packages_and_registries/infrastructure_registry/components/infrastructure_search_spec.js
...ructure_registry/components/infrastructure_search_spec.js
+11
-5
No files found.
app/assets/javascripts/packages/list/components/package_search.vue
View file @
195880bb
...
...
@@ -3,7 +3,7 @@ import { mapState, mapActions } from 'vuex';
import
{
__
,
s__
}
from
'
~/locale
'
;
import
RegistrySearch
from
'
~/vue_shared/components/registry/registry_search.vue
'
;
import
UrlSync
from
'
~/vue_shared/components/url_sync.vue
'
;
import
getTableHeaders
from
'
../utils
'
;
import
{
sortableFields
}
from
'
../utils
'
;
import
PackageTypeToken
from
'
./tokens/package_type_token.vue
'
;
export
default
{
...
...
@@ -25,7 +25,7 @@ export default {
filter
:
(
state
)
=>
state
.
filter
,
}),
sortableFields
()
{
return
getTableHeader
s
(
this
.
isGroupPage
);
return
sortableField
s
(
this
.
isGroupPage
);
},
},
methods
:
{
...
...
app/assets/javascripts/packages/list/utils.js
View file @
195880bb
import
{
LIST_KEY_PROJECT
,
SORT_FIELDS
}
from
'
./constants
'
;
export
default
(
isGroupPage
)
=>
SORT_FIELDS
.
filter
((
f
)
=>
f
.
ke
y
!==
LIST_KEY_PROJECT
||
isGroupPage
);
export
const
sortableFields
=
(
isGroupPage
)
=>
SORT_FIELDS
.
filter
((
f
)
=>
f
.
orderB
y
!==
LIST_KEY_PROJECT
||
isGroupPage
);
/**
* A small util function that works out if the delete action has deleted the
...
...
app/assets/javascripts/packages_and_registries/infrastructure_registry/components/infrastructure_search.vue
View file @
195880bb
<
script
>
import
{
mapState
,
mapActions
}
from
'
vuex
'
;
import
{
LIST_KEY_PACKAGE_TYPE
}
from
'
~/packages/list/constants
'
;
import
getTableHeaders
from
'
~/packages/list/utils
'
;
import
{
sortableFields
}
from
'
~/packages/list/utils
'
;
import
RegistrySearch
from
'
~/vue_shared/components/registry/registry_search.vue
'
;
import
UrlSync
from
'
~/vue_shared/components/url_sync.vue
'
;
...
...
@@ -14,7 +14,7 @@ export default {
filter
:
(
state
)
=>
state
.
filter
,
}),
sortableFields
()
{
return
getTableHeader
s
(
this
.
isGroupPage
).
filter
((
h
)
=>
h
.
orderBy
!==
LIST_KEY_PACKAGE_TYPE
);
return
sortableField
s
(
this
.
isGroupPage
).
filter
((
h
)
=>
h
.
orderBy
!==
LIST_KEY_PACKAGE_TYPE
);
},
},
methods
:
{
...
...
changelogs/unreleased/327692-package-sort-showing-project-in-the-project-page.yml
0 → 100644
View file @
195880bb
---
title
:
Do not show sort by project in Package project page
merge_request
:
59367
author
:
type
:
fixed
spec/frontend/packages/list/components/packages_search_spec.js
View file @
195880bb
...
...
@@ -2,7 +2,7 @@ import { shallowMount, createLocalVue } from '@vue/test-utils';
import
Vuex
from
'
vuex
'
;
import
component
from
'
~/packages/list/components/package_search.vue
'
;
import
PackageTypeToken
from
'
~/packages/list/components/tokens/package_type_token.vue
'
;
import
getTableHeaders
from
'
~/packages/list/utils
'
;
import
{
sortableFields
}
from
'
~/packages/list/utils
'
;
import
RegistrySearch
from
'
~/vue_shared/components/registry/registry_search.vue
'
;
import
UrlSync
from
'
~/vue_shared/components/url_sync.vue
'
;
...
...
@@ -60,7 +60,7 @@ describe('Package Search', () => {
tokens
:
expect
.
arrayContaining
([
expect
.
objectContaining
({
token
:
PackageTypeToken
,
type
:
'
type
'
,
icon
:
'
package
'
}),
]),
sortableFields
:
getTableHeader
s
(),
sortableFields
:
sortableField
s
(),
});
});
...
...
@@ -77,7 +77,7 @@ describe('Package Search', () => {
tokens
:
expect
.
arrayContaining
([
expect
.
objectContaining
({
token
:
PackageTypeToken
,
type
:
'
type
'
,
icon
:
'
package
'
}),
]),
sortableFields
:
getTableHeader
s
(
isGroupPage
),
sortableFields
:
sortableField
s
(
isGroupPage
),
});
});
...
...
spec/frontend/packages/list/utils_spec.js
View file @
195880bb
import
{
getNewPaginationPage
}
from
'
~/packages/list/utils
'
;
import
{
SORT_FIELDS
}
from
'
~/packages/list/constants
'
;
import
{
getNewPaginationPage
,
sortableFields
}
from
'
~/packages/list/utils
'
;
describe
(
'
Packages list utils
'
,
()
=>
{
describe
(
'
sortableFields
'
,
()
=>
{
it
(
'
returns the correct list when is a project page
'
,
()
=>
{
expect
(
sortableFields
()).
toEqual
(
SORT_FIELDS
.
filter
((
f
)
=>
f
.
orderBy
!==
'
project_path
'
));
});
it
(
'
returns the full list on the group page
'
,
()
=>
{
expect
(
sortableFields
(
true
)).
toEqual
(
SORT_FIELDS
);
});
});
describe
(
'
packageTypeDisplay
'
,
()
=>
{
it
(
'
returns the current page when total items exceeds pagniation
'
,
()
=>
{
expect
(
getNewPaginationPage
(
2
,
20
,
21
)).
toBe
(
2
);
...
...
spec/frontend/packages_and_registries/infrastructure_registry/components/infrastructure_search_spec.js
View file @
195880bb
...
...
@@ -12,6 +12,12 @@ describe('Infrastructure Search', () => {
let
store
;
const
sortableFields
=
()
=>
[
{
orderBy
:
'
name
'
,
label
:
'
Name
'
},
{
orderBy
:
'
version
'
,
label
:
'
Version
'
},
{
orderBy
:
'
created_at
'
,
label
:
'
Published
'
},
];
const
groupSortableFields
=
()
=>
[
{
orderBy
:
'
name
'
,
label
:
'
Name
'
},
{
orderBy
:
'
project_path
'
,
label
:
'
Project
'
},
{
orderBy
:
'
version
'
,
label
:
'
Version
'
},
...
...
@@ -68,17 +74,17 @@ describe('Infrastructure Search', () => {
});
it
.
each
`
isGroupPage | page
${
false
}
|
${
'
project
'
}
${
true
}
|
${
'
group
'
}
`
(
'
in a $page page binds the right props
'
,
({
isGroupPage
})
=>
{
isGroupPage | page
| fields
${
false
}
|
${
'
project
'
}
|
${
sortableFields
()}
${
true
}
|
${
'
group
'
}
|
${
groupSortableFields
()}
`
(
'
in a $page page binds the right props
'
,
({
isGroupPage
,
fields
})
=>
{
mountComponent
(
isGroupPage
);
expect
(
findRegistrySearch
().
props
()).
toMatchObject
({
filter
:
store
.
state
.
filter
,
sorting
:
store
.
state
.
sorting
,
tokens
:
[],
sortableFields
:
sortableFields
()
,
sortableFields
:
fields
,
});
});
...
...
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