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
4ef622e5
Commit
4ef622e5
authored
Jan 26, 2021
by
Nicolò Maria Mezzopera
Committed by
Olena Horal-Koretska
Jan 26, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add callout config to view pages
- project - group - bundle.js
parent
5ff6c862
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
86 additions
and
11 deletions
+86
-11
app/assets/javascripts/registry/explorer/index.js
app/assets/javascripts/registry/explorer/index.js
+9
-1
app/assets/javascripts/registry/explorer/pages/details.vue
app/assets/javascripts/registry/explorer/pages/details.vue
+11
-3
app/helpers/user_callouts_helper.rb
app/helpers/user_callouts_helper.rb
+5
-0
app/models/user_callout.rb
app/models/user_callout.rb
+2
-1
app/views/groups/registry/repositories/index.html.haml
app/views/groups/registry/repositories/index.html.haml
+4
-1
app/views/projects/registry/repositories/index.html.haml
app/views/projects/registry/repositories/index.html.haml
+4
-1
changelogs/unreleased/291048-allow-unfinished-tag-cleanup-alert-to-be-permanently-dismissible-f.yml
...hed-tag-cleanup-alert-to-be-permanently-dismissible-f.yml
+5
-0
spec/frontend/registry/explorer/pages/details_spec.js
spec/frontend/registry/explorer/pages/details_spec.js
+26
-4
spec/helpers/user_callouts_helper_spec.rb
spec/helpers/user_callouts_helper_spec.rb
+20
-0
No files found.
app/assets/javascripts/registry/explorer/index.js
View file @
4ef622e5
...
@@ -29,7 +29,14 @@ export default () => {
...
@@ -29,7 +29,14 @@ export default () => {
return
null
;
return
null
;
}
}
const
{
endpoint
,
expirationPolicy
,
isGroupPage
,
isAdmin
,
...
config
}
=
el
.
dataset
;
const
{
endpoint
,
expirationPolicy
,
isGroupPage
,
isAdmin
,
showUnfinishedTagCleanupCallout
,
...
config
}
=
el
.
dataset
;
// This is a mini state to help the breadcrumb have the correct name in the details page
// This is a mini state to help the breadcrumb have the correct name in the details page
const
breadCrumbState
=
Vue
.
observable
({
const
breadCrumbState
=
Vue
.
observable
({
...
@@ -57,6 +64,7 @@ export default () => {
...
@@ -57,6 +64,7 @@ export default () => {
expirationPolicy
:
expirationPolicy
?
JSON
.
parse
(
expirationPolicy
)
:
undefined
,
expirationPolicy
:
expirationPolicy
?
JSON
.
parse
(
expirationPolicy
)
:
undefined
,
isGroupPage
:
parseBoolean
(
isGroupPage
),
isGroupPage
:
parseBoolean
(
isGroupPage
),
isAdmin
:
parseBoolean
(
isAdmin
),
isAdmin
:
parseBoolean
(
isAdmin
),
showUnfinishedTagCleanupCallout
:
parseBoolean
(
showUnfinishedTagCleanupCallout
),
},
},
/* eslint-disable @gitlab/require-i18n-strings */
/* eslint-disable @gitlab/require-i18n-strings */
dockerBuildCommand
:
`docker build -t
${
config
.
repositoryUrl
}
.`
,
dockerBuildCommand
:
`docker build -t
${
config
.
repositoryUrl
}
.`
,
...
...
app/assets/javascripts/registry/explorer/pages/details.vue
View file @
4ef622e5
...
@@ -3,6 +3,7 @@ import { GlKeysetPagination, GlResizeObserverDirective } from '@gitlab/ui';
...
@@ -3,6 +3,7 @@ import { GlKeysetPagination, GlResizeObserverDirective } from '@gitlab/ui';
import
{
GlBreakpointInstance
}
from
'
@gitlab/ui/dist/utils
'
;
import
{
GlBreakpointInstance
}
from
'
@gitlab/ui/dist/utils
'
;
import
createFlash
from
'
~/flash
'
;
import
createFlash
from
'
~/flash
'
;
import
Tracking
from
'
~/tracking
'
;
import
Tracking
from
'
~/tracking
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
joinPaths
}
from
'
~/lib/utils/url_utility
'
;
import
{
joinPaths
}
from
'
~/lib/utils/url_utility
'
;
import
DeleteAlert
from
'
../components/details_page/delete_alert.vue
'
;
import
DeleteAlert
from
'
../components/details_page/delete_alert.vue
'
;
import
PartialCleanupAlert
from
'
../components/details_page/partial_cleanup_alert.vue
'
;
import
PartialCleanupAlert
from
'
../components/details_page/partial_cleanup_alert.vue
'
;
...
@@ -68,7 +69,7 @@ export default {
...
@@ -68,7 +69,7 @@ export default {
isMobile
:
false
,
isMobile
:
false
,
mutationLoading
:
false
,
mutationLoading
:
false
,
deleteAlertType
:
null
,
deleteAlertType
:
null
,
dismiss
PartialCleanupWarning
:
false
,
hide
PartialCleanupWarning
:
false
,
};
};
},
},
computed
:
{
computed
:
{
...
@@ -86,8 +87,9 @@ export default {
...
@@ -86,8 +87,9 @@ export default {
},
},
showPartialCleanupWarning
()
{
showPartialCleanupWarning
()
{
return
(
return
(
this
.
config
.
showUnfinishedTagCleanupCallout
&&
this
.
image
?.
expirationPolicyCleanupStatus
===
UNFINISHED_STATUS
&&
this
.
image
?.
expirationPolicyCleanupStatus
===
UNFINISHED_STATUS
&&
!
this
.
dismiss
PartialCleanupWarning
!
this
.
hide
PartialCleanupWarning
);
);
},
},
tracking
()
{
tracking
()
{
...
@@ -168,6 +170,12 @@ export default {
...
@@ -168,6 +170,12 @@ export default {
});
});
}
}
},
},
dismissPartialCleanupWarning
()
{
this
.
hidePartialCleanupWarning
=
true
;
axios
.
post
(
this
.
config
.
userCalloutsPath
,
{
feature_name
:
this
.
config
.
userCalloutId
,
});
},
},
},
};
};
</
script
>
</
script
>
...
@@ -185,7 +193,7 @@ export default {
...
@@ -185,7 +193,7 @@ export default {
v-if=
"showPartialCleanupWarning"
v-if=
"showPartialCleanupWarning"
:run-cleanup-policies-help-page-path=
"config.runCleanupPoliciesHelpPagePath"
:run-cleanup-policies-help-page-path=
"config.runCleanupPoliciesHelpPagePath"
:cleanup-policies-help-page-path=
"config.cleanupPoliciesHelpPagePath"
:cleanup-policies-help-page-path=
"config.cleanupPoliciesHelpPagePath"
@
dismiss=
"dismissPartialCleanupWarning
= true
"
@
dismiss=
"dismissPartialCleanupWarning"
/>
/>
<details-header
:image=
"image"
:metadata-loading=
"isLoading"
/>
<details-header
:image=
"image"
:metadata-loading=
"isLoading"
/>
...
...
app/helpers/user_callouts_helper.rb
View file @
4ef622e5
...
@@ -11,6 +11,7 @@ module UserCalloutsHelper
...
@@ -11,6 +11,7 @@ module UserCalloutsHelper
CUSTOMIZE_HOMEPAGE
=
'customize_homepage'
CUSTOMIZE_HOMEPAGE
=
'customize_homepage'
FEATURE_FLAGS_NEW_VERSION
=
'feature_flags_new_version'
FEATURE_FLAGS_NEW_VERSION
=
'feature_flags_new_version'
REGISTRATION_ENABLED_CALLOUT
=
'registration_enabled_callout'
REGISTRATION_ENABLED_CALLOUT
=
'registration_enabled_callout'
UNFINISHED_TAG_CLEANUP_CALLOUT
=
'unfinished_tag_cleanup_callout'
def
show_admin_integrations_moved?
def
show_admin_integrations_moved?
!
user_dismissed?
(
ADMIN_INTEGRATIONS_MOVED
)
!
user_dismissed?
(
ADMIN_INTEGRATIONS_MOVED
)
...
@@ -56,6 +57,10 @@ module UserCalloutsHelper
...
@@ -56,6 +57,10 @@ module UserCalloutsHelper
!
user_dismissed?
(
FEATURE_FLAGS_NEW_VERSION
)
!
user_dismissed?
(
FEATURE_FLAGS_NEW_VERSION
)
end
end
def
show_unfinished_tag_cleanup_callout?
!
user_dismissed?
(
UNFINISHED_TAG_CLEANUP_CALLOUT
)
end
def
show_registration_enabled_user_callout?
def
show_registration_enabled_user_callout?
!
Gitlab
.
com?
&&
!
Gitlab
.
com?
&&
current_user
&
.
admin?
&&
current_user
&
.
admin?
&&
...
...
app/models/user_callout.rb
View file @
4ef622e5
...
@@ -27,7 +27,8 @@ class UserCallout < ApplicationRecord
...
@@ -27,7 +27,8 @@ class UserCallout < ApplicationRecord
customize_homepage:
23
,
customize_homepage:
23
,
feature_flags_new_version:
24
,
feature_flags_new_version:
24
,
registration_enabled_callout:
25
,
registration_enabled_callout:
25
,
new_user_signups_cap_reached:
26
# EE-only
new_user_signups_cap_reached:
26
,
# EE-only
unfinished_tag_cleanup_callout:
27
}
}
validates
:user
,
presence:
true
validates
:user
,
presence:
true
...
...
app/views/groups/registry/repositories/index.html.haml
View file @
4ef622e5
...
@@ -17,4 +17,7 @@
...
@@ -17,4 +17,7 @@
is_group_page:
"true"
,
is_group_page:
"true"
,
"group_path"
:
@group
.
full_path
,
"group_path"
:
@group
.
full_path
,
"gid_prefix"
:
container_repository_gid_prefix
,
"gid_prefix"
:
container_repository_gid_prefix
,
character_error:
@character_error
.
to_s
}
}
character_error:
@character_error
.
to_s
,
user_callouts_path:
user_callouts_path
,
user_callout_id:
UserCalloutsHelper
::
UNFINISHED_TAG_CLEANUP_CALLOUT
,
show_unfinished_tag_cleanup_callout:
show_unfinished_tag_cleanup_callout?
.
to_s
}
}
app/views/projects/registry/repositories/index.html.haml
View file @
4ef622e5
...
@@ -19,4 +19,7 @@
...
@@ -19,4 +19,7 @@
"project_path"
:
@project
.
full_path
,
"project_path"
:
@project
.
full_path
,
"gid_prefix"
:
container_repository_gid_prefix
,
"gid_prefix"
:
container_repository_gid_prefix
,
"is_admin"
:
current_user
&
.
admin
.
to_s
,
"is_admin"
:
current_user
&
.
admin
.
to_s
,
character_error:
@character_error
.
to_s
}
}
character_error:
@character_error
.
to_s
,
user_callouts_path:
user_callouts_path
,
user_callout_id:
UserCalloutsHelper
::
UNFINISHED_TAG_CLEANUP_CALLOUT
,
show_unfinished_tag_cleanup_callout:
show_unfinished_tag_cleanup_callout?
.
to_s
,
}
}
changelogs/unreleased/291048-allow-unfinished-tag-cleanup-alert-to-be-permanently-dismissible-f.yml
0 → 100644
View file @
4ef622e5
---
title
:
Add callout disabling feature to cleanup policy alert
merge_request
:
52327
author
:
type
:
changed
spec/frontend/registry/explorer/pages/details_spec.js
View file @
4ef622e5
...
@@ -4,6 +4,7 @@ import VueApollo from 'vue-apollo';
...
@@ -4,6 +4,7 @@ import VueApollo from 'vue-apollo';
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
createMockApollo
from
'
helpers/mock_apollo_helper
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
waitForPromises
from
'
helpers/wait_for_promises
'
;
import
Tracking
from
'
~/tracking
'
;
import
Tracking
from
'
~/tracking
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
component
from
'
~/registry/explorer/pages/details.vue
'
;
import
component
from
'
~/registry/explorer/pages/details.vue
'
;
import
DeleteAlert
from
'
~/registry/explorer/components/details_page/delete_alert.vue
'
;
import
DeleteAlert
from
'
~/registry/explorer/components/details_page/delete_alert.vue
'
;
import
PartialCleanupAlert
from
'
~/registry/explorer/components/details_page/partial_cleanup_alert.vue
'
;
import
PartialCleanupAlert
from
'
~/registry/explorer/components/details_page/partial_cleanup_alert.vue
'
;
...
@@ -401,6 +402,9 @@ describe('Details Page', () => {
...
@@ -401,6 +402,9 @@ describe('Details Page', () => {
const
config
=
{
const
config
=
{
runCleanupPoliciesHelpPagePath
:
'
foo
'
,
runCleanupPoliciesHelpPagePath
:
'
foo
'
,
cleanupPoliciesHelpPagePath
:
'
bar
'
,
cleanupPoliciesHelpPagePath
:
'
bar
'
,
userCalloutsPath
:
'
call_out_path
'
,
userCalloutId
:
'
call_out_id
'
,
showUnfinishedTagCleanupCallout
:
true
,
};
};
describe
(
`when expirationPolicyCleanupStatus is
${
UNFINISHED_STATUS
}
`
,
()
=>
{
describe
(
`when expirationPolicyCleanupStatus is
${
UNFINISHED_STATUS
}
`
,
()
=>
{
...
@@ -413,8 +417,9 @@ describe('Details Page', () => {
...
@@ -413,8 +417,9 @@ describe('Details Page', () => {
}),
}),
);
);
});
});
it
(
'
exists
'
,
async
()
=>
{
it
(
'
exists
'
,
async
()
=>
{
mountComponent
({
resolver
});
mountComponent
({
resolver
,
config
});
await
waitForApolloRequestRender
();
await
waitForApolloRequestRender
();
...
@@ -426,11 +431,16 @@ describe('Details Page', () => {
...
@@ -426,11 +431,16 @@ describe('Details Page', () => {
await
waitForApolloRequestRender
();
await
waitForApolloRequestRender
();
expect
(
findPartialCleanupAlert
().
props
()).
toEqual
({
...
config
});
expect
(
findPartialCleanupAlert
().
props
()).
toEqual
({
runCleanupPoliciesHelpPagePath
:
config
.
runCleanupPoliciesHelpPagePath
,
cleanupPoliciesHelpPagePath
:
config
.
cleanupPoliciesHelpPagePath
,
});
});
});
it
(
'
dismiss hides the component
'
,
async
()
=>
{
it
(
'
dismiss hides the component
'
,
async
()
=>
{
mountComponent
({
resolver
});
jest
.
spyOn
(
axios
,
'
post
'
).
mockReturnValue
();
mountComponent
({
resolver
,
config
});
await
waitForApolloRequestRender
();
await
waitForApolloRequestRender
();
...
@@ -440,13 +450,25 @@ describe('Details Page', () => {
...
@@ -440,13 +450,25 @@ describe('Details Page', () => {
await
wrapper
.
vm
.
$nextTick
();
await
wrapper
.
vm
.
$nextTick
();
expect
(
axios
.
post
).
toHaveBeenCalledWith
(
config
.
userCalloutsPath
,
{
feature_name
:
config
.
userCalloutId
,
});
expect
(
findPartialCleanupAlert
().
exists
()).
toBe
(
false
);
});
it
(
'
is hidden if the callout is dismissed
'
,
async
()
=>
{
mountComponent
({
resolver
});
await
waitForApolloRequestRender
();
expect
(
findPartialCleanupAlert
().
exists
()).
toBe
(
false
);
expect
(
findPartialCleanupAlert
().
exists
()).
toBe
(
false
);
});
});
});
});
describe
(
`when expirationPolicyCleanupStatus is not
${
UNFINISHED_STATUS
}
`
,
()
=>
{
describe
(
`when expirationPolicyCleanupStatus is not
${
UNFINISHED_STATUS
}
`
,
()
=>
{
it
(
'
the component is hidden
'
,
async
()
=>
{
it
(
'
the component is hidden
'
,
async
()
=>
{
mountComponent
();
mountComponent
({
config
});
await
waitForApolloRequestRender
();
await
waitForApolloRequestRender
();
expect
(
findPartialCleanupAlert
().
exists
()).
toBe
(
false
);
expect
(
findPartialCleanupAlert
().
exists
()).
toBe
(
false
);
...
...
spec/helpers/user_callouts_helper_spec.rb
View file @
4ef622e5
...
@@ -222,4 +222,24 @@ RSpec.describe UserCalloutsHelper do
...
@@ -222,4 +222,24 @@ RSpec.describe UserCalloutsHelper do
it
{
is_expected
.
to
be
true
}
it
{
is_expected
.
to
be
true
}
end
end
end
end
describe
'.show_unfinished_tag_cleanup_callout?'
do
subject
{
helper
.
show_unfinished_tag_cleanup_callout?
}
before
do
allow
(
helper
).
to
receive
(
:user_dismissed?
).
with
(
described_class
::
UNFINISHED_TAG_CLEANUP_CALLOUT
)
{
dismissed
}
end
context
'when user has not dismissed'
do
let
(
:dismissed
)
{
false
}
it
{
is_expected
.
to
be
true
}
end
context
'when user dismissed'
do
let
(
:dismissed
)
{
true
}
it
{
is_expected
.
to
be
false
}
end
end
end
end
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