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
cf535999
Commit
cf535999
authored
Mar 15, 2022
by
Samantha Ming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix security provider logo
Use import svg logos as relative path is not working in production
parent
b2a22b6e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
18 deletions
+31
-18
app/assets/javascripts/security_configuration/components/constants.js
...avascripts/security_configuration/components/constants.js
+4
-2
app/assets/javascripts/security_configuration/components/training_provider_list.vue
...urity_configuration/components/training_provider_list.vue
+7
-4
ee/app/assets/javascripts/vulnerabilities/components/vulnerability_training.vue
...pts/vulnerabilities/components/vulnerability_training.vue
+10
-2
ee/spec/frontend/vulnerabilities/vulnerability_training_spec.js
...c/frontend/vulnerabilities/vulnerability_training_spec.js
+4
-4
spec/frontend/security_configuration/components/training_provider_list_spec.js
...y_configuration/components/training_provider_list_spec.js
+4
-4
spec/frontend/security_configuration/mock_data.js
spec/frontend/security_configuration/mock_data.js
+2
-2
No files found.
app/assets/javascripts/security_configuration/components/constants.js
View file @
cf535999
...
...
@@ -16,6 +16,8 @@ import {
REPORT_TYPE_LICENSE_COMPLIANCE
,
}
from
'
~/vue_shared/security_reports/constants
'
;
import
kontraLogo
from
'
images/vulnerability/kontra-logo.svg
'
;
import
scwLogo
from
'
images/vulnerability/scw-logo.svg
'
;
import
configureSastMutation
from
'
../graphql/configure_sast.mutation.graphql
'
;
import
configureSastIacMutation
from
'
../graphql/configure_iac.mutation.graphql
'
;
import
configureSecretDetectionMutation
from
'
../graphql/configure_secret_detection.mutation.graphql
'
;
...
...
@@ -284,9 +286,9 @@ export const AUTO_DEVOPS_ENABLED_ALERT_DISMISSED_STORAGE_KEY =
// https://gitlab.com/gitlab-org/gitlab/-/issues/346899
export
const
TEMP_PROVIDER_LOGOS
=
{
Kontra
:
{
svg
:
'
/assets/vulnerability/kontra-logo.svg
'
,
svg
:
kontraLogo
,
},
[
__
(
'
Secure Code Warrior
'
)]:
{
svg
:
'
/assets/vulnerability/scw-logo.svg
'
,
svg
:
scwLogo
,
},
};
app/assets/javascripts/security_configuration/components/training_provider_list.vue
View file @
cf535999
...
...
@@ -7,6 +7,7 @@ import {
GlLink
,
GlSkeletonLoader
,
GlIcon
,
GlSafeHtmlDirective
,
}
from
'
@gitlab/ui
'
;
import
*
as
Sentry
from
'
@sentry/browser
'
;
import
Tracking
from
'
~/tracking
'
;
...
...
@@ -50,6 +51,7 @@ export default {
},
directives
:
{
GlTooltip
:
GlTooltipDirective
,
SafeHtml
:
GlSafeHtmlDirective
,
},
mixins
:
[
Tracking
.
mixin
()],
inject
:
[
'
projectFullPath
'
],
...
...
@@ -233,11 +235,12 @@ export default {
@
change=
"toggleProvider(provider)"
/>
<div
v-if=
"$options.TEMP_PROVIDER_LOGOS[provider.name]"
class=
"gl-ml-4"
>
<img
:src=
"$options.TEMP_PROVIDER_LOGOS[provider.name].svg"
width=
"18"
<div
v-safe-html=
"$options.TEMP_PROVIDER_LOGOS[provider.name].svg"
data-testid=
"provider-logo"
style=
"width: 18px"
role=
"presentation"
/
>
></div
>
</div>
<div
class=
"gl-ml-3"
>
<h3
class=
"gl-font-lg gl-m-0 gl-mb-2"
>
{{
provider
.
name
}}
</h3>
...
...
ee/app/assets/javascripts/vulnerabilities/components/vulnerability_training.vue
View file @
cf535999
<
script
>
import
{
GlLink
,
GlIcon
,
GlSkeletonLoader
}
from
'
@gitlab/ui
'
;
import
{
GlLink
,
GlIcon
,
GlSkeletonLoader
,
GlSafeHtmlDirective
}
from
'
@gitlab/ui
'
;
import
*
as
Sentry
from
'
@sentry/browser
'
;
import
{
s__
,
__
}
from
'
~/locale
'
;
import
securityTrainingProvidersQuery
from
'
~/security_configuration/graphql/security_training_providers.query.graphql
'
;
...
...
@@ -30,6 +30,9 @@ export default {
GlIcon
,
GlSkeletonLoader
,
},
directives
:
{
SafeHtml
:
GlSafeHtmlDirective
,
},
mixins
:
[
glFeatureFlagsMixin
(),
Tracking
.
mixin
()],
props
:
{
projectFullPath
:
{
...
...
@@ -162,7 +165,12 @@ export default {
<div
v-for=
"(
{ name, url }, index) in securityTrainingUrls" :key="index" class="gl-mt-6">
<div>
<span
v-if=
"$options.TEMP_PROVIDER_LOGOS[name]"
class=
"gl-mr-1 gl-display-inline-flex"
>
<img
:src=
"$options.TEMP_PROVIDER_LOGOS[name].svg"
width=
"12"
role=
"presentation"
/>
<div
v-safe-html=
"$options.TEMP_PROVIDER_LOGOS[name].svg"
data-testid=
"provider-logo"
style=
"width: 12px"
role=
"presentation"
></div>
</span>
<span
class=
"gl-font-weight-bold gl-font-base"
>
{{
name
}}
</span>
</div>
...
...
ee/spec/frontend/vulnerabilities/vulnerability_training_spec.js
View file @
cf535999
...
...
@@ -99,7 +99,7 @@ describe('VulnerabilityTraining component', () => {
const
findTrainingItemName
=
(
name
)
=>
wrapper
.
findByText
(
name
);
const
findTrainingItemLinks
=
()
=>
wrapper
.
findAllComponents
(
GlLink
);
const
findTrainingItemLinkIcons
=
()
=>
wrapper
.
findAllComponents
(
GlIcon
);
const
findTrainingLogos
=
()
=>
wrapper
.
findAll
(
'
img
'
);
const
findTrainingLogos
=
()
=>
wrapper
.
findAll
ByTestId
(
'
provider-logo
'
);
describe
(
'
with the query being successful
'
,
()
=>
{
describe
(
'
basic structure
'
,
()
=>
{
...
...
@@ -225,15 +225,15 @@ describe('VulnerabilityTraining component', () => {
const
providerIndexArray
=
[
0
,
1
];
it
.
each
(
providerIndexArray
)(
'
displays the correct width for training item %s
'
,
(
index
)
=>
{
expect
(
findTrainingLogos
().
at
(
index
).
attributes
(
'
width
'
)).
toBe
(
'
12
'
);
expect
(
findTrainingLogos
().
at
(
index
).
attributes
(
'
style
'
)).
toBe
(
'
width: 12px;
'
);
});
it
.
each
(
providerIndexArray
)(
'
has a11y decorative attribute for provider %s
'
,
(
index
)
=>
{
expect
(
findTrainingLogos
().
at
(
index
).
attributes
(
'
role
'
)).
toBe
(
'
presentation
'
);
});
it
.
each
(
providerIndexArray
)(
'
displays the correct svg path
for training item %s
'
,
(
index
)
=>
{
expect
(
findTrainingLogos
().
at
(
index
).
attributes
(
'
src
'
)).
toBe
(
it
.
each
(
providerIndexArray
)(
'
renders the svg content
for training item %s
'
,
(
index
)
=>
{
expect
(
findTrainingLogos
().
at
(
index
).
html
()).
toContain
(
tempProviderLogos
[
testProviderName
[
index
]].
svg
,
);
});
...
...
spec/frontend/security_configuration/components/training_provider_list_spec.js
View file @
cf535999
...
...
@@ -89,7 +89,7 @@ describe('TrainingProviderList component', () => {
const
findPrimaryProviderRadios
=
()
=>
wrapper
.
findAllByTestId
(
'
primary-provider-radio
'
);
const
findLoader
=
()
=>
wrapper
.
findComponent
(
GlSkeletonLoader
);
const
findErrorAlert
=
()
=>
wrapper
.
findComponent
(
GlAlert
);
const
findLogos
=
()
=>
wrapper
.
findAll
(
'
img
'
);
const
findLogos
=
()
=>
wrapper
.
findAll
ByTestId
(
'
provider-logo
'
);
const
toggleFirstProvider
=
()
=>
findFirstToggle
().
vm
.
$emit
(
'
change
'
,
testProviderIds
[
0
]);
...
...
@@ -205,15 +205,15 @@ describe('TrainingProviderList component', () => {
const
providerIndexArray
=
[
0
,
1
];
it
.
each
(
providerIndexArray
)(
'
displays the correct width for provider %s
'
,
(
provider
)
=>
{
expect
(
findLogos
().
at
(
provider
).
attributes
(
'
width
'
)).
toBe
(
'
18
'
);
expect
(
findLogos
().
at
(
provider
).
attributes
(
'
style
'
)).
toBe
(
'
width: 18px;
'
);
});
it
.
each
(
providerIndexArray
)(
'
has a11y decorative attribute for provider %s
'
,
(
provider
)
=>
{
expect
(
findLogos
().
at
(
provider
).
attributes
(
'
role
'
)).
toBe
(
'
presentation
'
);
});
it
.
each
(
providerIndexArray
)(
'
displays the correct svg path
for provider %s
'
,
(
provider
)
=>
{
expect
(
findLogos
().
at
(
provider
).
attributes
(
'
src
'
)).
toBe
(
it
.
each
(
providerIndexArray
)(
'
renders the svg content
for provider %s
'
,
(
provider
)
=>
{
expect
(
findLogos
().
at
(
provider
).
html
()).
toContain
(
tempProviderLogos
[
testProviderName
[
provider
]].
svg
,
);
});
...
...
spec/frontend/security_configuration/mock_data.js
View file @
cf535999
...
...
@@ -105,9 +105,9 @@ export const updateSecurityTrainingProvidersErrorResponse = {
// https://gitlab.com/gitlab-org/gitlab/-/issues/346899
export
const
tempProviderLogos
=
{
[
testProviderName
[
0
]]:
{
svg
:
'
/assets/illustrations/vulnerability/vendor-1.svg
'
,
svg
:
`<svg>
${[
testProviderName
[
0
]]}
</svg>`
,
},
[
testProviderName
[
1
]]:
{
svg
:
'
/assets/illustrations/vulnerability/vendor-2.svg
'
,
svg
:
`<svg>
${[
testProviderName
[
1
]]}
</svg>`
,
},
};
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