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
d92d9b5e
Commit
d92d9b5e
authored
Dec 20, 2019
by
Steve Abrams
Committed by
Ash McKenzie
Dec 20, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add default values to container_expiration_policies_helper
parent
b539ef7a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
app/helpers/container_expiration_policies_helper.rb
app/helpers/container_expiration_policies_helper.rb
+9
-3
spec/helpers/container_expiration_policies_helper_spec.rb
spec/helpers/container_expiration_policies_helper_spec.rb
+3
-3
No files found.
app/helpers/container_expiration_policies_helper.rb
View file @
d92d9b5e
...
...
@@ -3,19 +3,25 @@
module
ContainerExpirationPoliciesHelper
def
cadence_options
ContainerExpirationPolicy
.
cadence_options
.
map
do
|
key
,
val
|
{
key:
key
.
to_s
,
label:
val
}
{
key:
key
.
to_s
,
label:
val
}.
tap
do
|
base
|
base
[
:default
]
=
true
if
key
.
to_s
==
'1d'
end
end
end
def
keep_n_options
ContainerExpirationPolicy
.
keep_n_options
.
map
do
|
key
,
val
|
{
key:
key
,
label:
val
}
{
key:
key
,
label:
val
}.
tap
do
|
base
|
base
[
:default
]
=
true
if
key
==
10
end
end
end
def
older_than_options
ContainerExpirationPolicy
.
older_than_options
.
map
do
|
key
,
val
|
{
key:
key
.
to_s
,
label:
val
}
{
key:
key
.
to_s
,
label:
val
}.
tap
do
|
base
|
base
[
:default
]
=
true
if
key
.
to_s
==
'30d'
end
end
end
end
spec/helpers/container_expiration_policies_helper_spec.rb
View file @
d92d9b5e
...
...
@@ -8,7 +8,7 @@ describe ContainerExpirationPoliciesHelper do
expected_result
=
[
{
key:
1
,
label:
'1 tag per image name'
},
{
key:
5
,
label:
'5 tags per image name'
},
{
key:
10
,
label:
'10 tags per image name'
},
{
key:
10
,
label:
'10 tags per image name'
,
default:
true
},
{
key:
25
,
label:
'25 tags per image name'
},
{
key:
50
,
label:
'50 tags per image name'
},
{
key:
100
,
label:
'100 tags per image name'
}
...
...
@@ -21,7 +21,7 @@ describe ContainerExpirationPoliciesHelper do
describe
'#cadence_options'
do
it
'returns cadence options formatted for dropdown usage'
do
expected_result
=
[
{
key:
'1d'
,
label:
'Every day'
},
{
key:
'1d'
,
label:
'Every day'
,
default:
true
},
{
key:
'7d'
,
label:
'Every week'
},
{
key:
'14d'
,
label:
'Every two weeks'
},
{
key:
'1month'
,
label:
'Every month'
},
...
...
@@ -37,7 +37,7 @@ describe ContainerExpirationPoliciesHelper do
expected_result
=
[
{
key:
'7d'
,
label:
'7 days until tags are automatically removed'
},
{
key:
'14d'
,
label:
'14 days until tags are automatically removed'
},
{
key:
'30d'
,
label:
'30 days until tags are automatically removed'
},
{
key:
'30d'
,
label:
'30 days until tags are automatically removed'
,
default:
true
},
{
key:
'90d'
,
label:
'90 days until tags are automatically removed'
}
]
...
...
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