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
863634d4
Commit
863634d4
authored
Jul 28, 2020
by
Nicolò Maria Mezzopera
Committed by
Natalia Tepluhina
Jul 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add composer to packages contansts
- shared constants - list constants - utils - unit tests - snapshots
parent
8f37b22a
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
119 additions
and
12 deletions
+119
-12
app/assets/javascripts/packages/list/components/packages_list_app.vue
...avascripts/packages/list/components/packages_list_app.vue
+5
-4
app/assets/javascripts/packages/list/constants.js
app/assets/javascripts/packages/list/constants.js
+5
-0
app/assets/javascripts/packages/list/stores/state.js
app/assets/javascripts/packages/list/stores/state.js
+6
-0
app/assets/javascripts/packages/shared/constants.js
app/assets/javascripts/packages/shared/constants.js
+1
-0
app/assets/javascripts/packages/shared/utils.js
app/assets/javascripts/packages/shared/utils.js
+2
-0
changelogs/unreleased/222469-view-your-composer-dependencies-in-the-package-registry-ui.yml
...your-composer-dependencies-in-the-package-registry-ui.yml
+5
-0
locale/gitlab.pot
locale/gitlab.pot
+6
-0
spec/frontend/packages/list/components/__snapshots__/packages_list_app_spec.js.snap
...t/components/__snapshots__/packages_list_app_spec.js.snap
+61
-0
spec/frontend/packages/list/components/packages_list_app_spec.js
...ontend/packages/list/components/packages_list_app_spec.js
+20
-1
spec/frontend/packages/shared/utils_spec.js
spec/frontend/packages/shared/utils_spec.js
+8
-7
No files found.
app/assets/javascripts/packages/list/components/packages_list_app.vue
View file @
863634d4
...
@@ -26,6 +26,7 @@ export default {
...
@@ -26,6 +26,7 @@ export default {
emptyListHelpUrl
:
state
=>
state
.
config
.
emptyListHelpUrl
,
emptyListHelpUrl
:
state
=>
state
.
config
.
emptyListHelpUrl
,
comingSoon
:
state
=>
state
.
config
.
comingSoon
,
comingSoon
:
state
=>
state
.
config
.
comingSoon
,
filterQuery
:
state
=>
state
.
filterQuery
,
filterQuery
:
state
=>
state
.
filterQuery
,
selectedType
:
state
=>
state
.
selectedType
,
}),
}),
tabsToRender
()
{
tabsToRender
()
{
return
PACKAGE_REGISTRY_TABS
;
return
PACKAGE_REGISTRY_TABS
;
...
@@ -42,11 +43,11 @@ export default {
...
@@ -42,11 +43,11 @@ export default {
onPackageDeleteRequest
(
item
)
{
onPackageDeleteRequest
(
item
)
{
return
this
.
requestDeletePackage
(
item
);
return
this
.
requestDeletePackage
(
item
);
},
},
tabChanged
(
e
)
{
tabChanged
(
index
)
{
const
selected
Type
=
PACKAGE_REGISTRY_TABS
[
e
];
const
selected
=
PACKAGE_REGISTRY_TABS
[
index
];
if
(
selectedType
)
{
if
(
selected
!==
this
.
selected
Type
)
{
this
.
setSelectedType
(
selected
Type
);
this
.
setSelectedType
(
selected
);
this
.
requestPackagesList
();
this
.
requestPackagesList
();
}
}
},
},
...
...
app/assets/javascripts/packages/list/constants.js
View file @
863634d4
...
@@ -73,10 +73,15 @@ export const PACKAGE_REGISTRY_TABS = [
...
@@ -73,10 +73,15 @@ export const PACKAGE_REGISTRY_TABS = [
title
:
__
(
'
All
'
),
title
:
__
(
'
All
'
),
type
:
null
,
type
:
null
,
},
},
{
title
:
s__
(
'
PackageRegistry|Composer
'
),
type
:
PackageType
.
COMPOSER
,
},
{
{
title
:
s__
(
'
PackageRegistry|Conan
'
),
title
:
s__
(
'
PackageRegistry|Conan
'
),
type
:
PackageType
.
CONAN
,
type
:
PackageType
.
CONAN
,
},
},
{
{
title
:
s__
(
'
PackageRegistry|Maven
'
),
title
:
s__
(
'
PackageRegistry|Maven
'
),
type
:
PackageType
.
MAVEN
,
type
:
PackageType
.
MAVEN
,
...
...
app/assets/javascripts/packages/list/stores/state.js
View file @
863634d4
import
{
PACKAGE_REGISTRY_TABS
}
from
'
../constants
'
;
export
default
()
=>
({
export
default
()
=>
({
/**
/**
* Determine if the component is loading data from the API
* Determine if the component is loading data from the API
...
@@ -48,4 +50,8 @@ export default () => ({
...
@@ -48,4 +50,8 @@ export default () => ({
* The search query that is used to filter packages by name
* The search query that is used to filter packages by name
*/
*/
filterQuery
:
''
,
filterQuery
:
''
,
/**
* The selected TAB of the package types tabs
*/
selectedType
:
PACKAGE_REGISTRY_TABS
[
0
],
});
});
app/assets/javascripts/packages/shared/constants.js
View file @
863634d4
...
@@ -4,6 +4,7 @@ export const PackageType = {
...
@@ -4,6 +4,7 @@ export const PackageType = {
NPM
:
'
npm
'
,
NPM
:
'
npm
'
,
NUGET
:
'
nuget
'
,
NUGET
:
'
nuget
'
,
PYPI
:
'
pypi
'
,
PYPI
:
'
pypi
'
,
COMPOSER
:
'
composer
'
,
};
};
export
const
TrackingActions
=
{
export
const
TrackingActions
=
{
...
...
app/assets/javascripts/packages/shared/utils.js
View file @
863634d4
...
@@ -19,6 +19,8 @@ export const getPackageTypeLabel = packageType => {
...
@@ -19,6 +19,8 @@ export const getPackageTypeLabel = packageType => {
return
s__
(
'
PackageType|NuGet
'
);
return
s__
(
'
PackageType|NuGet
'
);
case
PackageType
.
PYPI
:
case
PackageType
.
PYPI
:
return
s__
(
'
PackageType|PyPi
'
);
return
s__
(
'
PackageType|PyPi
'
);
case
PackageType
.
COMPOSER
:
return
s__
(
'
PackageType|Composer
'
);
default
:
default
:
return
null
;
return
null
;
...
...
changelogs/unreleased/222469-view-your-composer-dependencies-in-the-package-registry-ui.yml
0 → 100644
View file @
863634d4
---
title
:
Add composer tab and package type to package list
merge_request
:
37928
author
:
type
:
changed
locale/gitlab.pot
View file @
863634d4
...
@@ -16753,6 +16753,9 @@ msgstr ""
...
@@ -16753,6 +16753,9 @@ msgstr ""
msgid "PackageRegistry|Add NuGet Source"
msgid "PackageRegistry|Add NuGet Source"
msgstr ""
msgstr ""
msgid "PackageRegistry|Composer"
msgstr ""
msgid "PackageRegistry|Conan"
msgid "PackageRegistry|Conan"
msgstr ""
msgstr ""
...
@@ -16930,6 +16933,9 @@ msgstr ""
...
@@ -16930,6 +16933,9 @@ msgstr ""
msgid "PackageRegistry|yarn"
msgid "PackageRegistry|yarn"
msgstr ""
msgstr ""
msgid "PackageType|Composer"
msgstr ""
msgid "PackageType|Conan"
msgid "PackageType|Conan"
msgstr ""
msgstr ""
...
...
spec/frontend/packages/list/components/__snapshots__/packages_list_app_spec.js.snap
View file @
863634d4
...
@@ -73,6 +73,67 @@ exports[`packages_list_app renders 1`] = `
...
@@ -73,6 +73,67 @@ exports[`packages_list_app renders 1`] = `
</div>
</div>
</template>
</template>
</b-tab-stub>
</b-tab-stub>
<b-tab-stub
tag="div"
title="Composer"
titlelinkclass="gl-tab-nav-item"
>
<template>
<div>
<section
class="row empty-state text-center"
>
<div
class="col-12"
>
<div
class="svg-250 svg-content"
>
<img
alt="There are no Composer packages yet"
class="gl-max-w-full"
src="helpSvg"
/>
</div>
</div>
<div
class="col-12"
>
<div
class="text-content gl-mx-auto gl-my-0 gl-p-5"
>
<h1
class="h4"
>
There are no Composer packages yet
</h1>
<p>
Learn how to
<b-link-stub
class="gl-link"
event="click"
href="helpUrl"
routertag="a"
target="_blank"
>
publish and share your packages
</b-link-stub>
with GitLab.
</p>
<div>
<!---->
<!---->
</div>
</div>
</div>
</section>
</div>
</template>
</b-tab-stub>
<b-tab-stub
<b-tab-stub
tag="div"
tag="div"
title="Conan"
title="Conan"
...
...
spec/frontend/packages/list/components/packages_list_app_spec.js
View file @
863634d4
...
@@ -54,7 +54,6 @@ describe('packages_list_app', () => {
...
@@ -54,7 +54,6 @@ describe('packages_list_app', () => {
beforeEach
(()
=>
{
beforeEach
(()
=>
{
createStore
();
createStore
();
mountComponent
();
});
});
afterEach
(()
=>
{
afterEach
(()
=>
{
...
@@ -68,6 +67,8 @@ describe('packages_list_app', () => {
...
@@ -68,6 +67,8 @@ describe('packages_list_app', () => {
describe
(
'
empty state
'
,
()
=>
{
describe
(
'
empty state
'
,
()
=>
{
it
(
'
generate the correct empty list link
'
,
()
=>
{
it
(
'
generate the correct empty list link
'
,
()
=>
{
mountComponent
();
const
link
=
findListComponent
().
find
(
GlLink
);
const
link
=
findListComponent
().
find
(
GlLink
);
expect
(
link
.
attributes
(
'
href
'
)).
toBe
(
emptyListHelpUrl
);
expect
(
link
.
attributes
(
'
href
'
)).
toBe
(
emptyListHelpUrl
);
...
@@ -75,6 +76,8 @@ describe('packages_list_app', () => {
...
@@ -75,6 +76,8 @@ describe('packages_list_app', () => {
});
});
it
(
'
includes the right content on the default tab
'
,
()
=>
{
it
(
'
includes the right content on the default tab
'
,
()
=>
{
mountComponent
();
const
heading
=
findEmptyState
().
find
(
'
h1
'
);
const
heading
=
findEmptyState
().
find
(
'
h1
'
);
expect
(
heading
.
text
()).
toBe
(
'
There are no packages yet
'
);
expect
(
heading
.
text
()).
toBe
(
'
There are no packages yet
'
);
...
@@ -82,31 +85,47 @@ describe('packages_list_app', () => {
...
@@ -82,31 +85,47 @@ describe('packages_list_app', () => {
});
});
it
(
'
call requestPackagesList on page:changed
'
,
()
=>
{
it
(
'
call requestPackagesList on page:changed
'
,
()
=>
{
mountComponent
();
const
list
=
findListComponent
();
const
list
=
findListComponent
();
list
.
vm
.
$emit
(
'
page:changed
'
,
1
);
list
.
vm
.
$emit
(
'
page:changed
'
,
1
);
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
requestPackagesList
'
,
{
page
:
1
});
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
requestPackagesList
'
,
{
page
:
1
});
});
});
it
(
'
call requestDeletePackage on package:delete
'
,
()
=>
{
it
(
'
call requestDeletePackage on package:delete
'
,
()
=>
{
mountComponent
();
const
list
=
findListComponent
();
const
list
=
findListComponent
();
list
.
vm
.
$emit
(
'
package:delete
'
,
'
foo
'
);
list
.
vm
.
$emit
(
'
package:delete
'
,
'
foo
'
);
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
requestDeletePackage
'
,
'
foo
'
);
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
requestDeletePackage
'
,
'
foo
'
);
});
});
it
(
'
calls requestPackagesList on sort:changed
'
,
()
=>
{
it
(
'
calls requestPackagesList on sort:changed
'
,
()
=>
{
mountComponent
();
const
list
=
findListComponent
();
const
list
=
findListComponent
();
list
.
vm
.
$emit
(
'
sort:changed
'
);
list
.
vm
.
$emit
(
'
sort:changed
'
);
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
requestPackagesList
'
);
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
requestPackagesList
'
);
});
});
it
(
'
does not call requestPackagesList two times on render
'
,
()
=>
{
mountComponent
();
expect
(
store
.
dispatch
).
toHaveBeenCalledTimes
(
1
);
});
describe
(
'
tab change
'
,
()
=>
{
describe
(
'
tab change
'
,
()
=>
{
it
(
'
calls requestPackagesList when all tab is clicked
'
,
()
=>
{
it
(
'
calls requestPackagesList when all tab is clicked
'
,
()
=>
{
mountComponent
();
findTabComponent
().
trigger
(
'
click
'
);
findTabComponent
().
trigger
(
'
click
'
);
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
requestPackagesList
'
);
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
requestPackagesList
'
);
});
});
it
(
'
calls requestPackagesList when a package type tab is clicked
'
,
()
=>
{
it
(
'
calls requestPackagesList when a package type tab is clicked
'
,
()
=>
{
mountComponent
();
findTabComponent
(
1
).
trigger
(
'
click
'
);
findTabComponent
(
1
).
trigger
(
'
click
'
);
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
requestPackagesList
'
);
expect
(
store
.
dispatch
).
toHaveBeenCalledWith
(
'
requestPackagesList
'
);
...
...
spec/frontend/packages/shared/utils_spec.js
View file @
863634d4
...
@@ -38,6 +38,7 @@ describe('Packages shared utils', () => {
...
@@ -38,6 +38,7 @@ describe('Packages shared utils', () => {
${
'
npm
'
}
|
${
'
NPM
'
}
${
'
npm
'
}
|
${
'
NPM
'
}
${
'
nuget
'
}
|
${
'
NuGet
'
}
${
'
nuget
'
}
|
${
'
NuGet
'
}
${
'
pypi
'
}
|
${
'
PyPi
'
}
${
'
pypi
'
}
|
${
'
PyPi
'
}
${
'
composer
'
}
|
${
'
Composer
'
}
${
'
foo
'
}
|
${
null
}
${
'
foo
'
}
|
${
null
}
`
(
`package type`
,
({
packageType
,
expectedResult
})
=>
{
`
(
`package type`
,
({
packageType
,
expectedResult
})
=>
{
it
(
`
${
packageType
}
should show as
${
expectedResult
}
`
,
()
=>
{
it
(
`
${
packageType
}
should show as
${
expectedResult
}
`
,
()
=>
{
...
...
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