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
94f5de02
Commit
94f5de02
authored
Sep 10, 2021
by
Nicolò Maria Mezzopera
Committed by
Natalia Tepluhina
Sep 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display available metadata for PyPI
parent
0536b808
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
2 deletions
+45
-2
app/assets/javascripts/packages_and_registries/package_registry/components/details/additional_metadata.vue
...ckage_registry/components/details/additional_metadata.vue
+19
-0
locale/gitlab.pot
locale/gitlab.pot
+3
-0
spec/frontend/packages_and_registries/package_registry/components/details/additional_metadata_spec.js
...e_registry/components/details/additional_metadata_spec.js
+21
-0
spec/frontend/packages_and_registries/package_registry/mock_data.js
...end/packages_and_registries/package_registry/mock_data.js
+2
-2
No files found.
app/assets/javascripts/packages_and_registries/package_registry/components/details/additional_metadata.vue
View file @
94f5de02
...
...
@@ -6,6 +6,7 @@ import {
PACKAGE_TYPE_CONAN
,
PACKAGE_TYPE_MAVEN
,
PACKAGE_TYPE_COMPOSER
,
PACKAGE_TYPE_PYPI
,
}
from
'
~/packages_and_registries/package_registry/constants
'
;
import
ClipboardButton
from
'
~/vue_shared/components/clipboard_button.vue
'
;
import
DetailsRow
from
'
~/vue_shared/components/registry/details_row.vue
'
;
...
...
@@ -22,6 +23,7 @@ export default {
composerJson
:
s__
(
'
PackageRegistry|Composer.json with license: %{license} and version: %{version}
'
,
),
requiredPython
:
s__
(
'
PackageRegistry|Required Python: %{pythonVersion}
'
),
},
components
:
{
DetailsRow
,
...
...
@@ -43,6 +45,7 @@ export default {
PACKAGE_TYPE_CONAN
,
PACKAGE_TYPE_MAVEN
,
PACKAGE_TYPE_COMPOSER
,
PACKAGE_TYPE_PYPI
,
].
includes
(
this
.
packageEntity
.
packageType
)
&&
this
.
packageEntity
.
metadata
);
},
...
...
@@ -58,6 +61,9 @@ export default {
showComposerMetadata
()
{
return
this
.
packageEntity
.
packageType
===
PACKAGE_TYPE_COMPOSER
;
},
showPypiMetadata
()
{
return
this
.
packageEntity
.
packageType
===
PACKAGE_TYPE_PYPI
;
},
},
};
</
script
>
...
...
@@ -141,6 +147,19 @@ export default {
</gl-sprintf>
</details-row>
</template>
<details-row
v-else-if=
"showPypiMetadata"
icon=
"information-o"
padding=
"gl-p-4"
data-testid=
"pypi-required-python"
>
<gl-sprintf
:message=
"$options.i18n.requiredPython"
>
<
template
#pythonVersion
>
<strong>
{{
packageEntity
.
metadata
.
requiredPython
}}
</strong>
</
template
>
</gl-sprintf>
</details-row>
</div>
</div>
</template>
locale/gitlab.pot
View file @
94f5de02
...
...
@@ -24043,6 +24043,9 @@ msgstr ""
msgid "PackageRegistry|Remove package"
msgstr ""
msgid "PackageRegistry|Required Python: %{pythonVersion}"
msgstr ""
msgid "PackageRegistry|RubyGems"
msgstr ""
...
...
spec/frontend/packages_and_registries/package_registry/components/details/additional_metadata_spec.js
View file @
94f5de02
...
...
@@ -6,6 +6,7 @@ import {
nugetMetadata
,
packageData
,
composerMetadata
,
pypiMetadata
,
}
from
'
jest/packages_and_registries/package_registry/mock_data
'
;
import
component
from
'
~/packages_and_registries/package_registry/components/details/additional_metadata.vue
'
;
import
{
...
...
@@ -14,6 +15,7 @@ import {
PACKAGE_TYPE_MAVEN
,
PACKAGE_TYPE_NPM
,
PACKAGE_TYPE_COMPOSER
,
PACKAGE_TYPE_PYPI
,
}
from
'
~/packages_and_registries/package_registry/constants
'
;
import
ClipboardButton
from
'
~/vue_shared/components/clipboard_button.vue
'
;
import
DetailsRow
from
'
~/vue_shared/components/registry/details_row.vue
'
;
...
...
@@ -22,6 +24,7 @@ const mavenPackage = { packageType: PACKAGE_TYPE_MAVEN, metadata: mavenMetadata(
const
conanPackage
=
{
packageType
:
PACKAGE_TYPE_CONAN
,
metadata
:
conanMetadata
()
};
const
nugetPackage
=
{
packageType
:
PACKAGE_TYPE_NUGET
,
metadata
:
nugetMetadata
()
};
const
composerPackage
=
{
packageType
:
PACKAGE_TYPE_COMPOSER
,
metadata
:
composerMetadata
()
};
const
pypiPackage
=
{
packageType
:
PACKAGE_TYPE_PYPI
,
metadata
:
pypiMetadata
()
};
const
npmPackage
=
{
packageType
:
PACKAGE_TYPE_NPM
,
metadata
:
{}
};
describe
(
'
Package Additional Metadata
'
,
()
=>
{
...
...
@@ -58,6 +61,7 @@ describe('Package Additional Metadata', () => {
const
findComposerTargetSha
=
()
=>
wrapper
.
findByTestId
(
'
composer-target-sha
'
);
const
findComposerTargetShaCopyButton
=
()
=>
wrapper
.
findComponent
(
ClipboardButton
);
const
findComposerJson
=
()
=>
wrapper
.
findByTestId
(
'
composer-json
'
);
const
findPypiRequiredPython
=
()
=>
wrapper
.
findByTestId
(
'
pypi-required-python
'
);
it
(
'
has the correct title
'
,
()
=>
{
mountComponent
();
...
...
@@ -74,6 +78,7 @@ describe('Package Additional Metadata', () => {
${
conanPackage
}
|
${
true
}
|
${
PACKAGE_TYPE_CONAN
}
${
nugetPackage
}
|
${
true
}
|
${
PACKAGE_TYPE_NUGET
}
${
composerPackage
}
|
${
true
}
|
${
PACKAGE_TYPE_COMPOSER
}
${
pypiPackage
}
|
${
true
}
|
${
PACKAGE_TYPE_PYPI
}
${
npmPackage
}
|
${
false
}
|
${
PACKAGE_TYPE_NPM
}
`
(
`It is $visible that the component is visible when the package is $packageType`
,
...
...
@@ -160,4 +165,20 @@ describe('Package Additional Metadata', () => {
});
});
});
describe
(
'
pypi metadata
'
,
()
=>
{
beforeEach
(()
=>
{
mountComponent
({
packageEntity
:
pypiPackage
});
});
it
.
each
`
name | finderFunction | text | icon
${
'
pypi-required-python
'
}
|
${
findPypiRequiredPython
}
|
${
'
Required Python: 1.0.0
'
}
|
${
'
information-o
'
}
`
(
'
$name element
'
,
({
finderFunction
,
text
,
icon
})
=>
{
const
element
=
finderFunction
();
expect
(
element
.
exists
()).
toBe
(
true
);
expect
(
element
.
text
()).
toBe
(
text
);
expect
(
element
.
props
(
'
icon
'
)).
toBe
(
icon
);
});
});
});
spec/frontend/packages_and_registries/package_registry/mock_data.js
View file @
94f5de02
...
...
@@ -133,7 +133,7 @@ export const composerMetadata = () => ({
},
});
export
const
pyp
y
Metadata
=
()
=>
({
export
const
pyp
i
Metadata
=
()
=>
({
requiredPython
:
'
1.0.0
'
,
});
...
...
@@ -157,7 +157,7 @@ export const packageDetailsQuery = (extendPackage) => ({
metadata
:
{
...
conanMetadata
(),
...
composerMetadata
(),
...
pyp
y
Metadata
(),
...
pyp
i
Metadata
(),
...
mavenMetadata
(),
...
nugetMetadata
(),
},
...
...
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