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
4330a96e
Commit
4330a96e
authored
Jan 14, 2022
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor group security discover data attributes
parent
e9155538
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
6 deletions
+60
-6
ee/app/helpers/groups/security_features_helper.rb
ee/app/helpers/groups/security_features_helper.rb
+18
-0
ee/app/views/groups/security/discover/show.html.haml
ee/app/views/groups/security/discover/show.html.haml
+1
-6
ee/spec/helpers/groups/security_features_helper_spec.rb
ee/spec/helpers/groups/security_features_helper_spec.rb
+41
-0
No files found.
ee/app/helpers/groups/security_features_helper.rb
View file @
4330a96e
...
...
@@ -35,4 +35,22 @@ module Groups::SecurityFeaturesHelper
has_projects:
group
.
projects
.
any?
.
to_s
}
end
def
group_security_discover_data
(
group
)
content
=
pql_three_cta_test_experiment_candidate?
(
group
.
root_ancestor
)
?
'discover-group-security-pqltest'
:
'discover-group-security'
data
=
{
group:
{
id:
group
.
id
,
name:
group
.
name
},
link:
{
main:
new_trial_registration_path
(
glm_source:
'gitlab.com'
,
glm_content:
content
),
secondary:
group_billings_path
(
group
.
root_ancestor
,
source:
content
),
feedback:
'https://gitlab.com/gitlab-org/growth/ui-ux/issues/25'
}
}
data
.
merge
(
hand_raise_props
(
group
.
root_ancestor
))
end
end
ee/app/views/groups/security/discover/show.html.haml
View file @
4330a96e
-
breadcrumb_title
_
(
"Security"
)
-
page_title
_
(
"Security"
)
-
add_page_specific_style
'page_bundles/security_discover'
-
linkFeedback
=
'https://gitlab.com/gitlab-org/growth/ui-ux/issues/25'
-
content
=
pql_three_cta_test_experiment_candidate?
(
@group
.
root_ancestor
)
?
'discover-group-security-pqltest'
:
'discover-group-security'
-
linkUpgrade
=
group_billings_path
(
@group
.
root_ancestor
,
source:
content
)
-
data
=
{
group:
{
id:
@group
.
id
,
name:
@group
.
name
},
link:
{
main:
new_trial_registration_path
(
glm_source:
'gitlab.com'
,
glm_content:
content
),
secondary:
linkUpgrade
,
feedback:
linkFeedback
}
}
-
data
.
merge!
(
hand_raise_props
(
@group
.
root_ancestor
))
#js-security-discover-app
{
data:
data
}
#js-security-discover-app
{
data:
group_security_discover_data
(
@group
)
}
ee/spec/helpers/groups/security_features_helper_spec.rb
View file @
4330a96e
...
...
@@ -88,4 +88,45 @@ RSpec.describe Groups::SecurityFeaturesHelper do
it
{
is_expected
.
to
eq
(
expected_data
)
}
end
describe
'#group_security_discover_data'
do
let_it_be
(
:group
)
{
create
(
:group
)
}
let
(
:variant
)
{
:control
}
let
(
:content
)
{
'discover-group-security'
}
let
(
:expected_group_security_discover_data
)
do
{
group:
{
id:
group
.
id
,
name:
group
.
name
},
link:
{
main:
new_trial_registration_path
(
glm_source:
'gitlab.com'
,
glm_content:
content
),
secondary:
group_billings_path
(
group
.
root_ancestor
,
source:
content
),
feedback:
'https://gitlab.com/gitlab-org/growth/ui-ux/issues/25'
}
}.
merge
(
helper
.
hand_raise_props
(
group
.
root_ancestor
))
end
subject
(
:group_security_discover_data
)
do
helper
.
group_security_discover_data
(
group
)
end
before
do
stub_experiments
(
pql_three_cta_test:
variant
)
end
it
'builds correct hash'
do
expect
(
group_security_discover_data
).
to
eq
(
expected_group_security_discover_data
)
end
context
'candidate for pql_three_cta_test'
do
let
(
:variant
)
{
:candidate
}
let
(
:content
)
{
'discover-group-security-pqltest'
}
it
'renders a hash with pqltest content'
do
expect
(
group_security_discover_data
).
to
eq
(
expected_group_security_discover_data
)
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