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
24b1e48a
Commit
24b1e48a
authored
Jan 14, 2022
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor project security discover data attributes
parent
0408d49e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
6 deletions
+68
-6
ee/app/helpers/projects/security/discover_helper.rb
ee/app/helpers/projects/security/discover_helper.rb
+19
-0
ee/app/views/projects/security/discover/show.html.haml
ee/app/views/projects/security/discover/show.html.haml
+1
-6
ee/spec/helpers/projects/security/discover_helper_spec.rb
ee/spec/helpers/projects/security/discover_helper_spec.rb
+48
-0
No files found.
ee/app/helpers/projects/security/discover_helper.rb
View file @
24b1e48a
...
...
@@ -7,4 +7,23 @@ module Projects::Security::DiscoverHelper
e
.
try
{
true
}
end
.
run
end
def
project_security_discover_data
(
project
)
content
=
pql_three_cta_test_experiment_candidate?
(
project
.
root_ancestor
)
?
'discover-project-security-pqltest'
:
'discover-project-security'
link_upgrade
=
project
.
personal?
?
profile_billings_path
(
project
.
group
,
source:
content
)
:
group_billings_path
(
@project
.
root_ancestor
,
source:
content
)
data
=
{
project:
{
id:
project
.
id
,
name:
project
.
name
},
link:
{
main:
new_trial_registration_path
(
glm_source:
'gitlab.com'
,
glm_content:
content
),
secondary:
link_upgrade
,
feedback:
'https://gitlab.com/gitlab-org/growth/ui-ux/issues/25'
}
}
data
.
merge
(
hand_raise_props
(
project
.
root_ancestor
))
end
end
ee/app/views/projects/security/discover/show.html.haml
View file @
24b1e48a
-
breadcrumb_title
_
(
"Security Dashboard"
)
-
page_title
_
(
"Security Dashboard"
)
-
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?
(
@project
.
root_ancestor
)
?
'discover-project-security-pqltest'
:
'discover-project-security'
-
linkUpgrade
=
@project
.
personal?
?
profile_billings_path
(
@project
.
group
,
source:
content
)
:
group_billings_path
(
@project
.
root_ancestor
,
source:
content
)
-
data
=
{
project:
{
id:
@project
.
id
,
name:
@project
.
name
},
link:
{
main:
new_trial_registration_path
(
glm_source:
'gitlab.com'
,
glm_content:
content
),
secondary:
linkUpgrade
,
feedback:
linkFeedback
}
}
-
data
.
merge!
(
hand_raise_props
(
@project
.
root_ancestor
))
#js-security-discover-app
{
data:
data
}
#js-security-discover-app
{
data:
project_security_discover_data
(
@project
)
}
ee/spec/helpers/projects/security/discover_helper_spec.rb
0 → 100644
View file @
24b1e48a
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Projects
::
Security
::
DiscoverHelper
do
describe
'#project_security_discover_data'
do
let_it_be
(
:project
)
{
create
(
:project
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let
(
:variant
)
{
:control
}
let
(
:content
)
{
'discover-project-security'
}
let
(
:expected_project_security_discover_data
)
do
{
project:
{
id:
project
.
id
,
name:
project
.
name
},
link:
{
main:
new_trial_registration_path
(
glm_source:
'gitlab.com'
,
glm_content:
content
),
secondary:
profile_billings_path
(
project
.
group
,
source:
content
),
feedback:
'https://gitlab.com/gitlab-org/growth/ui-ux/issues/25'
}
}.
merge
(
helper
.
hand_raise_props
(
project
.
root_ancestor
))
end
subject
(
:project_security_discover_data
)
do
helper
.
project_security_discover_data
(
project
)
end
before
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
stub_experiments
(
pql_three_cta_test:
variant
)
end
it
'builds correct hash'
do
expect
(
project_security_discover_data
).
to
eq
(
expected_project_security_discover_data
)
end
context
'candidate for pql_three_cta_test'
do
let
(
:variant
)
{
:candidate
}
let
(
:content
)
{
'discover-project-security-pqltest'
}
it
'renders a hash with pqltest content'
do
expect
(
project_security_discover_data
).
to
eq
(
expected_project_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