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
42920455
Commit
42920455
authored
Mar 17, 2021
by
Daniel Tian
Committed by
Mark Florian
Mar 17, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use provide/inject for groupFullPath instead of props
parent
05c4cd32
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
26 additions
and
39 deletions
+26
-39
ee/app/assets/javascripts/security_dashboard/components/first_class_group_security_dashboard.vue
...board/components/first_class_group_security_dashboard.vue
+2
-5
ee/app/assets/javascripts/security_dashboard/components/first_class_group_security_dashboard_vulnerabilities.vue
.../first_class_group_security_dashboard_vulnerabilities.vue
+1
-4
ee/app/assets/javascripts/security_dashboard/components/first_class_vulnerability_chart.vue
..._dashboard/components/first_class_vulnerability_chart.vue
+1
-1
ee/app/assets/javascripts/security_dashboard/components/first_class_vulnerability_severities.vue
...board/components/first_class_vulnerability_severities.vue
+1
-5
ee/app/assets/javascripts/security_dashboard/components/group_security_charts.vue
...s/security_dashboard/components/group_security_charts.vue
+3
-11
ee/app/assets/javascripts/security_dashboard/first_class_init.js
...assets/javascripts/security_dashboard/first_class_init.js
+1
-1
ee/app/assets/javascripts/security_dashboard/security_charts_init.js
...ts/javascripts/security_dashboard/security_charts_init.js
+1
-0
ee/changelogs/unreleased/284471-use-provide-inject-for-group-full-path.yml
...eleased/284471-use-provide-inject-for-group-full-path.yml
+5
-0
ee/spec/frontend/security_dashboard/components/first_class_group_security_dashboard_spec.js
...d/components/first_class_group_security_dashboard_spec.js
+1
-2
ee/spec/frontend/security_dashboard/components/first_class_group_security_dashboard_vulnerabilities_spec.js
...st_class_group_security_dashboard_vulnerabilities_spec.js
+1
-3
ee/spec/frontend/security_dashboard/components/first_class_vulnerability_chart_spec.js
...hboard/components/first_class_vulnerability_chart_spec.js
+3
-2
ee/spec/frontend/security_dashboard/components/first_class_vulnerability_severities_spec.js
...d/components/first_class_vulnerability_severities_spec.js
+4
-2
ee/spec/frontend/security_dashboard/components/group_security_charts_spec.js
...curity_dashboard/components/group_security_charts_spec.js
+2
-3
No files found.
ee/app/assets/javascripts/security_dashboard/components/first_class_group_security_dashboard.vue
View file @
42920455
...
@@ -19,11 +19,8 @@ export default {
...
@@ -19,11 +19,8 @@ export default {
GlLoadingIcon
,
GlLoadingIcon
,
VulnerabilitiesCountList
,
VulnerabilitiesCountList
,
},
},
inject
:
[
'
groupFullPath
'
],
props
:
{
props
:
{
groupFullPath
:
{
type
:
String
,
required
:
true
,
},
vulnerabilitiesExportEndpoint
:
{
vulnerabilitiesExportEndpoint
:
{
type
:
String
,
type
:
String
,
required
:
true
,
required
:
true
,
...
@@ -88,7 +85,7 @@ export default {
...
@@ -88,7 +85,7 @@ export default {
<
template
#sticky
>
<
template
#sticky
>
<filters
:projects=
"projects"
@
filterChange=
"handleFilterChange"
/>
<filters
:projects=
"projects"
@
filterChange=
"handleFilterChange"
/>
</
template
>
</
template
>
<group-security-vulnerabilities
:
group-full-path=
"groupFullPath"
:
filters=
"filters"
/>
<group-security-vulnerabilities
:filters=
"filters"
/>
</security-dashboard-layout>
</security-dashboard-layout>
</div>
</div>
</template>
</template>
ee/app/assets/javascripts/security_dashboard/components/first_class_group_security_dashboard_vulnerabilities.vue
View file @
42920455
...
@@ -13,11 +13,8 @@ export default {
...
@@ -13,11 +13,8 @@ export default {
GlIntersectionObserver
,
GlIntersectionObserver
,
VulnerabilityList
,
VulnerabilityList
,
},
},
inject
:
[
'
groupFullPath
'
],
props
:
{
props
:
{
groupFullPath
:
{
type
:
String
,
required
:
true
,
},
filters
:
{
filters
:
{
type
:
Object
,
type
:
Object
,
required
:
false
,
required
:
false
,
...
...
ee/app/assets/javascripts/security_dashboard/components/first_class_vulnerability_chart.vue
View file @
42920455
...
@@ -25,9 +25,9 @@ export default {
...
@@ -25,9 +25,9 @@ export default {
directives
:
{
directives
:
{
GlTooltip
:
GlTooltipDirective
,
GlTooltip
:
GlTooltipDirective
,
},
},
inject
:
[
'
groupFullPath
'
],
props
:
{
props
:
{
query
:
{
type
:
Object
,
required
:
true
},
query
:
{
type
:
Object
,
required
:
true
},
groupFullPath
:
{
type
:
String
,
required
:
false
,
default
:
undefined
},
},
},
data
()
{
data
()
{
return
{
return
{
...
...
ee/app/assets/javascripts/security_dashboard/components/first_class_vulnerability_severities.vue
View file @
42920455
...
@@ -32,6 +32,7 @@ export default {
...
@@ -32,6 +32,7 @@ export default {
directives
:
{
directives
:
{
'
gl-tooltip
'
:
GlTooltipDirective
,
'
gl-tooltip
'
:
GlTooltipDirective
,
},
},
inject
:
[
'
groupFullPath
'
],
props
:
{
props
:
{
helpPagePath
:
{
helpPagePath
:
{
type
:
String
,
type
:
String
,
...
@@ -42,11 +43,6 @@ export default {
...
@@ -42,11 +43,6 @@ export default {
type
:
Object
,
type
:
Object
,
required
:
true
,
required
:
true
,
},
},
groupFullPath
:
{
type
:
String
,
required
:
false
,
default
:
undefined
,
},
},
},
data
()
{
data
()
{
return
{
return
{
...
...
ee/app/assets/javascripts/security_dashboard/components/group_security_charts.vue
View file @
42920455
...
@@ -18,12 +18,7 @@ export default {
...
@@ -18,12 +18,7 @@ export default {
VulnerabilitySeverities
,
VulnerabilitySeverities
,
VulnerabilityChart
,
VulnerabilityChart
,
},
},
props
:
{
inject
:
[
'
groupFullPath
'
],
groupFullPath
:
{
type
:
String
,
required
:
true
,
},
},
apollo
:
{
apollo
:
{
projects
:
{
projects
:
{
query
:
vulnerableProjectsQuery
,
query
:
vulnerableProjectsQuery
,
...
@@ -65,11 +60,8 @@ export default {
...
@@ -65,11 +60,8 @@ export default {
<dashboard-not-configured
/>
<dashboard-not-configured
/>
</
template
>
</
template
>
<
template
v-else-if=
"shouldShowCharts"
#default
>
<
template
v-else-if=
"shouldShowCharts"
#default
>
<vulnerability-chart
:query=
"vulnerabilityHistoryQuery"
:group-full-path=
"groupFullPath"
/>
<vulnerability-chart
:query=
"vulnerabilityHistoryQuery"
/>
<vulnerability-severities
<vulnerability-severities
:query=
"vulnerabilityGradesQuery"
/>
:query=
"vulnerabilityGradesQuery"
:group-full-path=
"groupFullPath"
/>
</
template
>
</
template
>
<
template
v-else
#loading
>
<
template
v-else
#loading
>
<gl-loading-icon
size=
"lg"
class=
"gl-mt-6"
/>
<gl-loading-icon
size=
"lg"
class=
"gl-mt-6"
/>
...
...
ee/app/assets/javascripts/security_dashboard/first_class_init.js
View file @
42920455
...
@@ -61,6 +61,7 @@ export default (el, dashboardType) => {
...
@@ -61,6 +61,7 @@ export default (el, dashboardType) => {
emptyStateSvgPath
,
emptyStateSvgPath
,
notEnabledScannersHelpPath
,
notEnabledScannersHelpPath
,
noPipelineRunScannersHelpPath
,
noPipelineRunScannersHelpPath
,
groupFullPath
,
securityConfigurationPath
,
securityConfigurationPath
,
hasVulnerabilities
:
parseBoolean
(
hasVulnerabilities
),
hasVulnerabilities
:
parseBoolean
(
hasVulnerabilities
),
scanners
:
scanners
?
JSON
.
parse
(
scanners
)
:
[],
scanners
:
scanners
?
JSON
.
parse
(
scanners
)
:
[],
...
@@ -92,7 +93,6 @@ export default (el, dashboardType) => {
...
@@ -92,7 +93,6 @@ export default (el, dashboardType) => {
provide
.
autoFixMrsPath
=
autoFixMrsPath
;
provide
.
autoFixMrsPath
=
autoFixMrsPath
;
}
else
if
(
dashboardType
===
DASHBOARD_TYPES
.
GROUP
)
{
}
else
if
(
dashboardType
===
DASHBOARD_TYPES
.
GROUP
)
{
component
=
FirstClassGroupSecurityDashboard
;
component
=
FirstClassGroupSecurityDashboard
;
props
.
groupFullPath
=
groupFullPath
;
}
else
if
(
dashboardType
===
DASHBOARD_TYPES
.
INSTANCE
)
{
}
else
if
(
dashboardType
===
DASHBOARD_TYPES
.
INSTANCE
)
{
provide
.
instanceDashboardSettingsPath
=
instanceDashboardSettingsPath
;
provide
.
instanceDashboardSettingsPath
=
instanceDashboardSettingsPath
;
component
=
FirstClassInstanceSecurityDashboard
;
component
=
FirstClassInstanceSecurityDashboard
;
...
...
ee/app/assets/javascripts/security_dashboard/security_charts_init.js
View file @
42920455
...
@@ -32,6 +32,7 @@ export default (el, dashboardType) => {
...
@@ -32,6 +32,7 @@ export default (el, dashboardType) => {
const
provide
=
{
const
provide
=
{
dashboardDocumentation
:
el
.
dataset
.
dashboardDocumentation
,
dashboardDocumentation
:
el
.
dataset
.
dashboardDocumentation
,
emptyStateSvgPath
:
el
.
dataset
.
emptyStateSvgPath
,
emptyStateSvgPath
:
el
.
dataset
.
emptyStateSvgPath
,
groupFullPath
:
el
.
dataset
.
groupFullPath
,
securityConfigurationPath
:
el
.
dataset
.
securityConfigurationPath
,
securityConfigurationPath
:
el
.
dataset
.
securityConfigurationPath
,
};
};
...
...
ee/changelogs/unreleased/284471-use-provide-inject-for-group-full-path.yml
0 → 100644
View file @
42920455
---
title
:
Use provide/inject for groupFullPath instead of props
merge_request
:
56472
author
:
type
:
other
ee/spec/frontend/security_dashboard/components/first_class_group_security_dashboard_spec.js
View file @
42920455
...
@@ -29,9 +29,9 @@ describe('First Class Group Dashboard Component', () => {
...
@@ -29,9 +29,9 @@ describe('First Class Group Dashboard Component', () => {
propsData
:
{
propsData
:
{
dashboardDocumentation
,
dashboardDocumentation
,
emptyStateSvgPath
,
emptyStateSvgPath
,
groupFullPath
,
vulnerabilitiesExportEndpoint
,
vulnerabilitiesExportEndpoint
,
},
},
provide
:
{
groupFullPath
},
data
,
data
,
stubs
:
{
stubs
:
{
SecurityDashboardLayout
,
SecurityDashboardLayout
,
...
@@ -66,7 +66,6 @@ describe('First Class Group Dashboard Component', () => {
...
@@ -66,7 +66,6 @@ describe('First Class Group Dashboard Component', () => {
it
(
'
should render correctly
'
,
()
=>
{
it
(
'
should render correctly
'
,
()
=>
{
expect
(
findGroupVulnerabilities
().
props
()).
toEqual
({
expect
(
findGroupVulnerabilities
().
props
()).
toEqual
({
groupFullPath
,
filters
:
{},
filters
:
{},
});
});
});
});
...
...
ee/spec/frontend/security_dashboard/components/first_class_group_security_dashboard_vulnerabilities_spec.js
View file @
42920455
...
@@ -24,15 +24,13 @@ describe('First Class Group Dashboard Vulnerabilities Component', () => {
...
@@ -24,15 +24,13 @@ describe('First Class Group Dashboard Vulnerabilities Component', () => {
const
createWrapper
=
({
$apollo
=
apolloMock
,
stubs
}
=
{})
=>
{
const
createWrapper
=
({
$apollo
=
apolloMock
,
stubs
}
=
{})
=>
{
return
shallowMount
(
FirstClassGroupVulnerabilities
,
{
return
shallowMount
(
FirstClassGroupVulnerabilities
,
{
propsData
:
{
groupFullPath
,
},
stubs
,
stubs
,
mocks
:
{
mocks
:
{
$apollo
,
$apollo
,
fetchNextPage
:
()
=>
{},
fetchNextPage
:
()
=>
{},
},
},
provide
:
{
provide
:
{
groupFullPath
,
hasVulnerabilities
:
true
,
hasVulnerabilities
:
true
,
hasJiraVulnerabilitiesIntegrationEnabled
:
false
,
hasJiraVulnerabilitiesIntegrationEnabled
:
false
,
},
},
...
...
ee/spec/frontend/security_dashboard/components/first_class_vulnerability_chart_spec.js
View file @
42920455
...
@@ -21,10 +21,11 @@ describe('First class vulnerability chart component', () => {
...
@@ -21,10 +21,11 @@ describe('First class vulnerability chart component', () => {
const
findActiveChartButton
=
()
=>
findChartButtons
().
find
(
'
.selected
'
);
const
findActiveChartButton
=
()
=>
findChartButtons
().
find
(
'
.selected
'
);
const
find90DaysChartButton
=
()
=>
findChartButtons
().
find
(
'
[data-days="90"]
'
);
const
find90DaysChartButton
=
()
=>
findChartButtons
().
find
(
'
[data-days="90"]
'
);
const
createComponent
=
({
$apollo
,
propsData
,
stubs
,
data
}
=
{})
=>
{
const
createComponent
=
({
$apollo
,
propsData
,
stubs
,
data
,
provide
}
=
{})
=>
{
const
instance
=
shallowMount
(
VulnerabilityChart
,
{
const
instance
=
shallowMount
(
VulnerabilityChart
,
{
$apollo
,
$apollo
,
propsData
:
{
query
:
{},
...
propsData
},
propsData
:
{
query
:
{},
...
propsData
},
provide
:
{
groupFullPath
:
undefined
,
...
provide
},
stubs
:
{
stubs
:
{
...
stubChildren
(
VulnerabilityChart
),
...
stubChildren
(
VulnerabilityChart
),
...
stubs
,
...
stubs
,
...
@@ -84,7 +85,7 @@ describe('First class vulnerability chart component', () => {
...
@@ -84,7 +85,7 @@ describe('First class vulnerability chart component', () => {
describe
(
'
when loading the history chart for group level dashboard
'
,
()
=>
{
describe
(
'
when loading the history chart for group level dashboard
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
wrapper
=
createComponent
({
wrapper
=
createComponent
({
pro
psData
:
{
groupFullPath
:
'
gitlab-org
'
},
pro
vide
:
{
groupFullPath
:
'
gitlab-org
'
},
$apollo
:
{
$apollo
:
{
queries
:
{
vulnerabilitiesHistory
:
{
group
:
responseData
}
},
queries
:
{
vulnerabilitiesHistory
:
{
group
:
responseData
}
},
},
},
...
...
ee/spec/frontend/security_dashboard/components/first_class_vulnerability_severities_spec.js
View file @
42920455
...
@@ -33,7 +33,7 @@ describe('Vulnerability Severity component', () => {
...
@@ -33,7 +33,7 @@ describe('Vulnerability Severity component', () => {
return
createMockApollo
([...
queries
]);
return
createMockApollo
([...
queries
]);
};
};
const
createComponent
=
({
propsData
,
data
,
apolloProvider
})
=>
{
const
createComponent
=
({
propsData
,
data
,
apolloProvider
,
provide
})
=>
{
return
shallowMount
(
VulnerabilitySeverity
,
{
return
shallowMount
(
VulnerabilitySeverity
,
{
localVue
,
localVue
,
apolloProvider
,
apolloProvider
,
...
@@ -42,6 +42,7 @@ describe('Vulnerability Severity component', () => {
...
@@ -42,6 +42,7 @@ describe('Vulnerability Severity component', () => {
helpPagePath
,
helpPagePath
,
...
propsData
,
...
propsData
,
},
},
provide
:
{
groupFullPath
:
undefined
,
...
provide
},
stubs
:
{
stubs
:
{
Accordion
,
Accordion
,
AccordionItem
,
AccordionItem
,
...
@@ -69,7 +70,8 @@ describe('Vulnerability Severity component', () => {
...
@@ -69,7 +70,8 @@ describe('Vulnerability Severity component', () => {
]);
]);
wrapper
=
createComponent
({
wrapper
=
createComponent
({
propsData
:
{
groupFullPath
:
'
gitlab-org
'
,
query
:
groupVulnerabilityGradesQuery
},
propsData
:
{
query
:
groupVulnerabilityGradesQuery
},
provide
:
{
groupFullPath
:
'
gitlab-org
'
},
apolloProvider
,
apolloProvider
,
});
});
...
...
ee/spec/frontend/security_dashboard/components/group_security_charts_spec.js
View file @
42920455
...
@@ -41,7 +41,7 @@ describe('Group Security Charts component', () => {
...
@@ -41,7 +41,7 @@ describe('Group Security Charts component', () => {
},
},
},
},
},
},
pro
psData
:
{
groupFullPath
},
pro
vide
:
{
groupFullPath
},
stubs
:
{
stubs
:
{
SecurityChartsLayout
,
SecurityChartsLayout
,
},
},
...
@@ -100,11 +100,10 @@ describe('Group Security Charts component', () => {
...
@@ -100,11 +100,10 @@ describe('Group Security Charts component', () => {
expect
(
dashboardNotConfigured
.
exists
()).
toBe
(
false
);
expect
(
dashboardNotConfigured
.
exists
()).
toBe
(
false
);
expect
(
loadingIcon
.
exists
()).
toBe
(
false
);
expect
(
loadingIcon
.
exists
()).
toBe
(
false
);
expect
(
vulnerabilityChart
.
exists
()).
toBe
(
true
);
expect
(
vulnerabilityChart
.
exists
()).
toBe
(
true
);
expect
(
vulnerabilityChart
.
props
()).
toEqual
({
query
:
vulnerabilityHistoryQuery
,
groupFullPath
});
expect
(
vulnerabilityChart
.
props
()).
toEqual
({
query
:
vulnerabilityHistoryQuery
});
expect
(
vulnerabilitySeverities
.
exists
()).
toBe
(
true
);
expect
(
vulnerabilitySeverities
.
exists
()).
toBe
(
true
);
expect
(
vulnerabilitySeverities
.
props
()).
toEqual
({
expect
(
vulnerabilitySeverities
.
props
()).
toEqual
({
query
:
vulnerabilityGradesQuery
,
query
:
vulnerabilityGradesQuery
,
groupFullPath
,
helpPagePath
:
''
,
helpPagePath
:
''
,
});
});
});
});
...
...
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