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
6d6f0514
Commit
6d6f0514
authored
Jul 08, 2021
by
Nicolò Maria Mezzopera
Committed by
Olena Horal-Koretska
Jul 08, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show empty option for keep_n and older_than in Cleanup Policies
parent
985fc6db
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
20 additions
and
10 deletions
+20
-10
app/assets/javascripts/packages_and_registries/settings/project/components/settings_form.vue
..._registries/settings/project/components/settings_form.vue
+0
-2
app/assets/javascripts/packages_and_registries/settings/project/utils.js
...scripts/packages_and_registries/settings/project/utils.js
+5
-2
spec/frontend/packages_and_registries/settings/project/settings/__snapshots__/utils_spec.js.snap
...ettings/project/settings/__snapshots__/utils_spec.js.snap
+8
-0
spec/frontend/packages_and_registries/settings/project/settings/components/__snapshots__/settings_form_spec.js.snap
...tings/components/__snapshots__/settings_form_spec.js.snap
+2
-2
spec/frontend/packages_and_registries/settings/project/settings/components/settings_form_spec.js
...ettings/project/settings/components/settings_form_spec.js
+4
-4
spec/frontend/packages_and_registries/settings/project/settings/utils_spec.js
...es_and_registries/settings/project/settings/utils_spec.js
+1
-0
No files found.
app/assets/javascripts/packages_and_registries/settings/project/components/settings_form.vue
View file @
6d6f0514
...
@@ -88,8 +88,6 @@ export default {
...
@@ -88,8 +88,6 @@ export default {
return
{
return
{
...
this
.
value
,
...
this
.
value
,
cadence
:
this
.
findDefaultOption
(
'
cadence
'
),
cadence
:
this
.
findDefaultOption
(
'
cadence
'
),
keepN
:
this
.
findDefaultOption
(
'
keepN
'
),
olderThan
:
this
.
findDefaultOption
(
'
olderThan
'
),
};
};
},
},
showLoadingIcon
()
{
showLoadingIcon
()
{
...
...
app/assets/javascripts/packages_and_registries/settings/project/utils.js
View file @
6d6f0514
...
@@ -11,11 +11,14 @@ export const olderThanTranslationGenerator = (variable) => n__('%d day', '%d day
...
@@ -11,11 +11,14 @@ export const olderThanTranslationGenerator = (variable) => n__('%d day', '%d day
export
const
keepNTranslationGenerator
=
(
variable
)
=>
export
const
keepNTranslationGenerator
=
(
variable
)
=>
n__
(
'
%d tag per image name
'
,
'
%d tags per image name
'
,
variable
);
n__
(
'
%d tag per image name
'
,
'
%d tags per image name
'
,
variable
);
export
const
optionLabelGenerator
=
(
collection
,
translationFn
)
=>
export
const
optionLabelGenerator
=
(
collection
,
translationFn
)
=>
{
collection
.
map
((
option
)
=>
({
co
nst
result
=
co
llection
.
map
((
option
)
=>
({
...
option
,
...
option
,
label
:
translationFn
(
option
.
variable
),
label
:
translationFn
(
option
.
variable
),
}));
}));
result
.
unshift
({
key
:
null
,
label
:
''
});
return
result
;
};
export
const
formOptionsGenerator
=
()
=>
{
export
const
formOptionsGenerator
=
()
=>
{
return
{
return
{
...
...
spec/frontend/packages_and_registries/settings/project/settings/__snapshots__/utils_spec.js.snap
View file @
6d6f0514
...
@@ -32,6 +32,10 @@ Array [
...
@@ -32,6 +32,10 @@ Array [
exports[`Utils formOptionsGenerator returns an object containing keepN 1`] = `
exports[`Utils formOptionsGenerator returns an object containing keepN 1`] = `
Array [
Array [
Object {
"key": null,
"label": "",
},
Object {
Object {
"default": false,
"default": false,
"key": "ONE_TAG",
"key": "ONE_TAG",
...
@@ -73,6 +77,10 @@ Array [
...
@@ -73,6 +77,10 @@ Array [
exports[`Utils formOptionsGenerator returns an object containing olderThan 1`] = `
exports[`Utils formOptionsGenerator returns an object containing olderThan 1`] = `
Array [
Array [
Object {
"key": null,
"label": "",
},
Object {
Object {
"default": false,
"default": false,
"key": "SEVEN_DAYS",
"key": "SEVEN_DAYS",
...
...
spec/frontend/packages_and_registries/settings/project/settings/components/__snapshots__/settings_form_spec.js.snap
View file @
6d6f0514
...
@@ -22,7 +22,7 @@ exports[`Settings Form Enable matches snapshot 1`] = `
...
@@ -22,7 +22,7 @@ exports[`Settings Form Enable matches snapshot 1`] = `
exports[`Settings Form Keep N matches snapshot 1`] = `
exports[`Settings Form Keep N matches snapshot 1`] = `
<expiration-dropdown-stub
<expiration-dropdown-stub
data-testid="keep-n-dropdown"
data-testid="keep-n-dropdown"
formoptions="[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]"
formoptions="[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
,[object Object]
"
label="Keep the most recent:"
label="Keep the most recent:"
name="keep-n"
name="keep-n"
value="TEN_TAGS"
value="TEN_TAGS"
...
@@ -44,7 +44,7 @@ exports[`Settings Form Keep Regex matches snapshot 1`] = `
...
@@ -44,7 +44,7 @@ exports[`Settings Form Keep Regex matches snapshot 1`] = `
exports[`Settings Form OlderThan matches snapshot 1`] = `
exports[`Settings Form OlderThan matches snapshot 1`] = `
<expiration-dropdown-stub
<expiration-dropdown-stub
data-testid="older-than-dropdown"
data-testid="older-than-dropdown"
formoptions="[object Object],[object Object],[object Object],[object Object]"
formoptions="[object Object],[object Object],[object Object],[object Object]
,[object Object]
"
label="Remove tags older than:"
label="Remove tags older than:"
name="older-than"
name="older-than"
value="FOURTEEN_DAYS"
value="FOURTEEN_DAYS"
...
...
spec/frontend/packages_and_registries/settings/project/settings/components/settings_form_spec.js
View file @
6d6f0514
...
@@ -132,9 +132,9 @@ describe('Settings Form', () => {
...
@@ -132,9 +132,9 @@ describe('Settings Form', () => {
model | finder | fieldName | type | defaultValue
model | finder | fieldName | type | defaultValue
${
'
enabled
'
}
|
${
findEnableToggle
}
|
${
'
Enable
'
}
|
${
'
toggle
'
}
|
${
false
}
${
'
enabled
'
}
|
${
findEnableToggle
}
|
${
'
Enable
'
}
|
${
'
toggle
'
}
|
${
false
}
${
'
cadence
'
}
|
${
findCadenceDropdown
}
|
${
'
Cadence
'
}
|
${
'
dropdown
'
}
|
${
'
EVERY_DAY
'
}
${
'
cadence
'
}
|
${
findCadenceDropdown
}
|
${
'
Cadence
'
}
|
${
'
dropdown
'
}
|
${
'
EVERY_DAY
'
}
${
'
keepN
'
}
|
${
findKeepNDropdown
}
|
${
'
Keep N
'
}
|
${
'
dropdown
'
}
|
${
'
TEN_TAGS
'
}
${
'
keepN
'
}
|
${
findKeepNDropdown
}
|
${
'
Keep N
'
}
|
${
'
dropdown
'
}
|
${
''
}
${
'
nameRegexKeep
'
}
|
${
findKeepRegexInput
}
|
${
'
Keep Regex
'
}
|
${
'
textarea
'
}
|
${
''
}
${
'
nameRegexKeep
'
}
|
${
findKeepRegexInput
}
|
${
'
Keep Regex
'
}
|
${
'
textarea
'
}
|
${
''
}
${
'
olderThan
'
}
|
${
findOlderThanDropdown
}
|
${
'
OlderThan
'
}
|
${
'
dropdown
'
}
|
${
'
NINETY_DAYS
'
}
${
'
olderThan
'
}
|
${
findOlderThanDropdown
}
|
${
'
OlderThan
'
}
|
${
'
dropdown
'
}
|
${
''
}
${
'
nameRegex
'
}
|
${
findRemoveRegexInput
}
|
${
'
Remove regex
'
}
|
${
'
textarea
'
}
|
${
''
}
${
'
nameRegex
'
}
|
${
findRemoveRegexInput
}
|
${
'
Remove regex
'
}
|
${
'
textarea
'
}
|
${
''
}
`
(
'
$fieldName
'
,
({
model
,
finder
,
type
,
defaultValue
})
=>
{
`
(
'
$fieldName
'
,
({
model
,
finder
,
type
,
defaultValue
})
=>
{
it
(
'
matches snapshot
'
,
()
=>
{
it
(
'
matches snapshot
'
,
()
=>
{
...
@@ -293,10 +293,10 @@ describe('Settings Form', () => {
...
@@ -293,10 +293,10 @@ describe('Settings Form', () => {
input
:
{
input
:
{
cadence
:
'
EVERY_DAY
'
,
cadence
:
'
EVERY_DAY
'
,
enabled
:
true
,
enabled
:
true
,
keepN
:
'
TEN_TAGS
'
,
keepN
:
null
,
nameRegex
:
'
asdasdssssdfdf
'
,
nameRegex
:
'
asdasdssssdfdf
'
,
nameRegexKeep
:
'
sss
'
,
nameRegexKeep
:
'
sss
'
,
olderThan
:
'
NINETY_DAYS
'
,
olderThan
:
null
,
projectPath
:
'
path
'
,
projectPath
:
'
path
'
,
},
},
});
});
...
...
spec/frontend/packages_and_registries/settings/project/settings/utils_spec.js
View file @
6d6f0514
...
@@ -12,6 +12,7 @@ describe('Utils', () => {
...
@@ -12,6 +12,7 @@ describe('Utils', () => {
olderThanTranslationGenerator
,
olderThanTranslationGenerator
,
);
);
expect
(
result
).
toEqual
([
expect
(
result
).
toEqual
([
{
key
:
null
,
label
:
''
},
{
variable
:
1
,
label
:
'
1 day
'
},
{
variable
:
1
,
label
:
'
1 day
'
},
{
variable
:
2
,
label
:
'
2 days
'
},
{
variable
:
2
,
label
:
'
2 days
'
},
]);
]);
...
...
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