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
602b3e44
Commit
602b3e44
authored
Apr 07, 2021
by
Daniel Tian
Committed by
Jose Ivan Vargas
Apr 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve vulnerability project GraphQL queries and error message
parent
e71e28d4
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
41 additions
and
48 deletions
+41
-48
ee/app/assets/javascripts/security_dashboard/components/first_class_group_security_dashboard.vue
...board/components/first_class_group_security_dashboard.vue
+2
-2
ee/app/assets/javascripts/security_dashboard/components/first_class_instance_security_dashboard.vue
...rd/components/first_class_instance_security_dashboard.vue
+4
-4
ee/app/assets/javascripts/security_dashboard/components/first_class_instance_security_dashboard_settings.vue
...ents/first_class_instance_security_dashboard_settings.vue
+5
-9
ee/app/assets/javascripts/security_dashboard/components/first_class_project_manager/project_manager.vue
...omponents/first_class_project_manager/project_manager.vue
+5
-5
ee/app/assets/javascripts/security_dashboard/components/group_security_charts.vue
...s/security_dashboard/components/group_security_charts.vue
+4
-4
ee/app/assets/javascripts/security_dashboard/components/instance_security_charts.vue
...ecurity_dashboard/components/instance_security_charts.vue
+4
-4
ee/app/assets/javascripts/security_dashboard/components/project_security_charts.vue
...security_dashboard/components/project_security_charts.vue
+2
-2
ee/app/assets/javascripts/security_dashboard/graphql/queries/get_instance_security_dashboard_projects.query.graphql
...es/get_instance_security_dashboard_projects.query.graphql
+0
-13
ee/app/assets/javascripts/security_dashboard/graphql/queries/group_projects.query.graphql
...ty_dashboard/graphql/queries/group_projects.query.graphql
+3
-4
ee/app/assets/javascripts/security_dashboard/graphql/queries/instance_projects.query.graphql
...dashboard/graphql/queries/instance_projects.query.graphql
+11
-0
ee/app/assets/javascripts/security_dashboard/helpers.js
ee/app/assets/javascripts/security_dashboard/helpers.js
+1
-1
No files found.
ee/app/assets/javascripts/security_dashboard/components/first_class_group_security_dashboard.vue
View file @
602b3e44
...
...
@@ -4,7 +4,7 @@ import GroupSecurityVulnerabilities from 'ee/security_dashboard/components/first
import
Filters
from
'
ee/security_dashboard/components/first_class_vulnerability_filters.vue
'
;
import
SecurityDashboardLayout
from
'
ee/security_dashboard/components/security_dashboard_layout.vue
'
;
import
{
vulnerabilitiesSeverityCountScopes
}
from
'
../constants
'
;
import
vulnerableProjectsQuery
from
'
../graphql/queries/vulnerable
_projects.query.graphql
'
;
import
groupProjectsQuery
from
'
../graphql/queries/group
_projects.query.graphql
'
;
import
CsvExportButton
from
'
./csv_export_button.vue
'
;
import
DashboardNotConfigured
from
'
./empty_states/group_dashboard_not_configured.vue
'
;
import
VulnerabilitiesCountList
from
'
./vulnerability_count_list.vue
'
;
...
...
@@ -22,7 +22,7 @@ export default {
inject
:
[
'
groupFullPath
'
],
apollo
:
{
projects
:
{
query
:
vulnerable
ProjectsQuery
,
query
:
group
ProjectsQuery
,
variables
()
{
return
{
fullPath
:
this
.
groupFullPath
};
},
...
...
ee/app/assets/javascripts/security_dashboard/components/first_class_instance_security_dashboard.vue
View file @
602b3e44
<
script
>
import
Filters
from
'
ee/security_dashboard/components/first_class_vulnerability_filters.vue
'
;
import
SecurityDashboardLayout
from
'
ee/security_dashboard/components/security_dashboard_layout.vue
'
;
import
projectsQuery
from
'
ee/security_dashboard/graphql/queries/get_instance_security_dashboard
_projects.query.graphql
'
;
import
instanceProjectsQuery
from
'
ee/security_dashboard/graphql/queries/instance
_projects.query.graphql
'
;
import
createFlash
from
'
~/flash
'
;
import
{
vulnerabilitiesSeverityCountScopes
}
from
'
../constants
'
;
import
{
createProjectLoadingError
}
from
'
../helpers
'
;
import
{
PROJECT_LOADING_ERROR_MESSAGE
}
from
'
../helpers
'
;
import
CsvExportButton
from
'
./csv_export_button.vue
'
;
import
DashboardNotConfigured
from
'
./empty_states/instance_dashboard_not_configured.vue
'
;
import
InstanceSecurityVulnerabilities
from
'
./first_class_instance_security_dashboard_vulnerabilities.vue
'
;
...
...
@@ -21,12 +21,12 @@ export default {
},
apollo
:
{
projects
:
{
query
:
p
rojectsQuery
,
query
:
instanceP
rojectsQuery
,
update
(
data
)
{
return
data
.
instanceSecurityDashboard
.
projects
.
nodes
;
},
error
()
{
createFlash
({
message
:
createProjectLoadingError
()
});
createFlash
({
message
:
PROJECT_LOADING_ERROR_MESSAGE
});
},
},
},
...
...
ee/app/assets/javascripts/security_dashboard/components/first_class_instance_security_dashboard_settings.vue
View file @
602b3e44
<
script
>
import
{
GlAlert
}
from
'
@gitlab/ui
'
;
import
SecurityDashboardLayout
from
'
ee/security_dashboard/components/security_dashboard_layout.vue
'
;
import
projectsQuery
from
'
ee/security_dashboard/graphql/queries/get_instance_security_dashboard
_projects.query.graphql
'
;
import
{
createProjectLoadingError
}
from
'
../helpers
'
;
import
instanceProjectsQuery
from
'
ee/security_dashboard/graphql/queries/instance
_projects.query.graphql
'
;
import
{
PROJECT_LOADING_ERROR_MESSAGE
}
from
'
../helpers
'
;
import
ProjectManager
from
'
./first_class_project_manager/project_manager.vue
'
;
export
default
{
...
...
@@ -13,7 +13,7 @@ export default {
},
apollo
:
{
projects
:
{
query
:
p
rojectsQuery
,
query
:
instanceP
rojectsQuery
,
update
(
data
)
{
return
data
.
instanceSecurityDashboard
.
projects
.
nodes
;
},
...
...
@@ -28,18 +28,14 @@ export default {
hasError
:
false
,
};
},
computed
:
{
errorMessage
()
{
return
createProjectLoadingError
();
},
},
PROJECT_LOADING_ERROR_MESSAGE
,
};
</
script
>
<
template
>
<security-dashboard-layout>
<gl-alert
v-if=
"hasError"
variant=
"danger"
>
{{
errorMessage
}}
{{
$options
.
PROJECT_LOADING_ERROR_MESSAGE
}}
</gl-alert>
<div
v-else
class=
"gl-display-flex gl-justify-content-center"
>
<project-manager
:projects=
"projects"
/>
...
...
ee/app/assets/javascripts/security_dashboard/components/first_class_project_manager/project_manager.vue
View file @
602b3e44
...
...
@@ -3,8 +3,8 @@ import { GlButton } from '@gitlab/ui';
import
produce
from
'
immer
'
;
import
addProjectToSecurityDashboard
from
'
ee/security_dashboard/graphql/mutations/add_project_to_security_dashboard.mutation.graphql
'
;
import
deleteProjectFromSecurityDashboard
from
'
ee/security_dashboard/graphql/mutations/delete_project_from_security_dashboard.mutation.graphql
'
;
import
projectsQuery
from
'
ee/security_dashboard/graphql/queries/get_instance_security_dashboard_projects.query.graphql
'
;
import
getProjects
from
'
ee/security_dashboard/graphql/queries/get_projects.query.graphql
'
;
import
instanceProjectsQuery
from
'
ee/security_dashboard/graphql/queries/instance_projects.query.graphql
'
;
import
{
createInvalidProjectMessage
}
from
'
ee/security_dashboard/utils/first_class_project_manager_utils
'
;
import
createFlash
from
'
~/flash
'
;
import
{
__
,
s__
,
sprintf
}
from
'
~/locale
'
;
...
...
@@ -78,7 +78,7 @@ export default {
return
;
}
const
sourceData
=
store
.
readQuery
({
query
:
p
rojectsQuery
});
const
sourceData
=
store
.
readQuery
({
query
:
instanceP
rojectsQuery
});
const
newProject
=
results
.
addProjectToSecurityDashboard
.
project
;
const
data
=
produce
(
sourceData
,
(
draftData
)
=>
{
...
...
@@ -91,7 +91,7 @@ export default {
];
});
store
.
writeQuery
({
query
:
p
rojectsQuery
,
data
});
store
.
writeQuery
({
query
:
instanceP
rojectsQuery
,
data
});
},
})
.
then
(({
data
})
=>
{
...
...
@@ -155,7 +155,7 @@ export default {
mutation
:
deleteProjectFromSecurityDashboard
,
variables
:
{
id
},
update
(
store
)
{
const
sourceData
=
store
.
readQuery
({
query
:
p
rojectsQuery
});
const
sourceData
=
store
.
readQuery
({
query
:
instanceP
rojectsQuery
});
const
data
=
produce
(
sourceData
,
(
draftData
)
=>
{
draftData
.
instanceSecurityDashboard
.
projects
.
nodes
=
draftData
.
instanceSecurityDashboard
.
projects
.
nodes
.
filter
(
...
...
@@ -163,7 +163,7 @@ export default {
);
});
store
.
writeQuery
({
query
:
p
rojectsQuery
,
data
});
store
.
writeQuery
({
query
:
instanceP
rojectsQuery
,
data
});
},
})
.
then
(()
=>
{
...
...
ee/app/assets/javascripts/security_dashboard/components/group_security_charts.vue
View file @
602b3e44
<
script
>
import
{
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
createFlash
from
'
~/flash
'
;
import
groupProjectsQuery
from
'
../graphql/queries/group_projects.query.graphql
'
;
import
vulnerabilityGradesQuery
from
'
../graphql/queries/group_vulnerability_grades.query.graphql
'
;
import
vulnerabilityHistoryQuery
from
'
../graphql/queries/group_vulnerability_history.query.graphql
'
;
import
vulnerableProjectsQuery
from
'
../graphql/queries/vulnerable_projects.query.graphql
'
;
import
{
createProjectLoadingError
}
from
'
../helpers
'
;
import
{
PROJECT_LOADING_ERROR_MESSAGE
}
from
'
../helpers
'
;
import
DashboardNotConfigured
from
'
./empty_states/group_dashboard_not_configured.vue
'
;
import
VulnerabilityChart
from
'
./first_class_vulnerability_chart.vue
'
;
import
VulnerabilitySeverities
from
'
./first_class_vulnerability_severities.vue
'
;
...
...
@@ -21,7 +21,7 @@ export default {
inject
:
[
'
groupFullPath
'
],
apollo
:
{
projects
:
{
query
:
vulnerable
ProjectsQuery
,
query
:
group
ProjectsQuery
,
variables
()
{
return
{
fullPath
:
this
.
groupFullPath
};
},
...
...
@@ -29,7 +29,7 @@ export default {
return
data
?.
group
?.
projects
?.
nodes
??
[];
},
error
()
{
createFlash
({
message
:
createProjectLoadingError
()
});
createFlash
({
message
:
PROJECT_LOADING_ERROR_MESSAGE
});
},
},
},
...
...
ee/app/assets/javascripts/security_dashboard/components/instance_security_charts.vue
View file @
602b3e44
<
script
>
import
{
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
createFlash
from
'
~/flash
'
;
import
projectsQuery
from
'
../graphql/queries/get_instance_security_dashboard
_projects.query.graphql
'
;
import
instanceProjectsQuery
from
'
../graphql/queries/instance
_projects.query.graphql
'
;
import
vulnerabilityGradesQuery
from
'
../graphql/queries/instance_vulnerability_grades.query.graphql
'
;
import
vulnerabilityHistoryQuery
from
'
../graphql/queries/instance_vulnerability_history.query.graphql
'
;
import
{
createProjectLoadingError
}
from
'
../helpers
'
;
import
{
PROJECT_LOADING_ERROR_MESSAGE
}
from
'
../helpers
'
;
import
DashboardNotConfigured
from
'
./empty_states/instance_dashboard_not_configured.vue
'
;
import
VulnerabilityChart
from
'
./first_class_vulnerability_chart.vue
'
;
import
VulnerabilitySeverities
from
'
./first_class_vulnerability_severities.vue
'
;
...
...
@@ -20,12 +20,12 @@ export default {
},
apollo
:
{
projects
:
{
query
:
p
rojectsQuery
,
query
:
instanceP
rojectsQuery
,
update
(
data
)
{
return
data
?.
instanceSecurityDashboard
?.
projects
?.
nodes
??
[];
},
error
()
{
createFlash
({
message
:
createProjectLoadingError
()
});
createFlash
({
message
:
PROJECT_LOADING_ERROR_MESSAGE
});
},
},
},
...
...
ee/app/assets/javascripts/security_dashboard/components/project_security_charts.vue
View file @
602b3e44
...
...
@@ -6,7 +6,7 @@ import { formatDate, getDateInPast } from '~/lib/utils/datetime_utility';
import
{
getSvgIconPathContent
}
from
'
~/lib/utils/icon_utils
'
;
import
{
s__
,
__
}
from
'
~/locale
'
;
import
projectsHistoryQuery
from
'
../graphql/queries/project_vulnerabilities_by_day_and_count.query.graphql
'
;
import
{
createProjectLoadingError
}
from
'
../helpers
'
;
import
{
PROJECT_LOADING_ERROR_MESSAGE
}
from
'
../helpers
'
;
import
DashboardNotConfigured
from
'
./empty_states/reports_not_configured.vue
'
;
import
SecurityChartsLayout
from
'
./security_charts_layout.vue
'
;
...
...
@@ -59,7 +59,7 @@ export default {
return
data
?.
project
?.
vulnerabilitiesCountByDay
?.
nodes
??
[];
},
error
()
{
createFlash
({
message
:
createProjectLoadingError
()
});
createFlash
({
message
:
PROJECT_LOADING_ERROR_MESSAGE
});
},
skip
()
{
return
!
this
.
hasVulnerabilities
;
...
...
ee/app/assets/javascripts/security_dashboard/graphql/queries/get_instance_security_dashboard_projects.query.graphql
deleted
100644 → 0
View file @
e71e28d4
#import "ee/security_dashboard/graphql/fragments/project.fragment.graphql"
#import "ee/security_dashboard/graphql/fragments/project_vulnerability_severities_count.fragment.graphql"
query
projectsQuery
{
instanceSecurityDashboard
{
projects
{
nodes
{
...
Project
...
ProjectVulnerabilitySeveritiesCount
}
}
}
}
ee/app/assets/javascripts/security_dashboard/graphql/queries/
vulnerable
_projects.query.graphql
→
ee/app/assets/javascripts/security_dashboard/graphql/queries/
group
_projects.query.graphql
View file @
602b3e44
#import "../fragments/project.fragment.graphql"
query
group
(
$fullPath
:
ID
!)
{
query
groupProjects
(
$fullPath
:
ID
!)
{
group
(
fullPath
:
$fullPath
)
{
projects
(
includeSubgroups
:
true
)
{
nodes
{
...
Project
id
name
}
}
}
...
...
ee/app/assets/javascripts/security_dashboard/graphql/queries/instance_projects.query.graphql
0 → 100644
View file @
602b3e44
query
instanceProjects
{
instanceSecurityDashboard
{
projects
{
nodes
{
id
name
nameWithNamespace
}
}
}
}
ee/app/assets/javascripts/security_dashboard/helpers.js
View file @
602b3e44
...
...
@@ -134,6 +134,6 @@ export const preparePageInfo = (pageInfo) => {
return
{
...
pageInfo
,
hasNextPage
:
Boolean
(
pageInfo
?.
endCursor
)
};
};
export
const
createProjectLoadingError
=
()
=>
__
(
'
An error occurred while retrieving projects.
'
);
export
const
PROJECT_LOADING_ERROR_MESSAGE
=
__
(
'
An error occurred while retrieving projects.
'
);
export
default
()
=>
({});
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