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
7a8ae2d4
Commit
7a8ae2d4
authored
Nov 11, 2020
by
Nicolò Maria Mezzopera
Committed by
Jose Ivan Vargas
Nov 11, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor dast profile cache_utils removeProfile to immer
parent
9a054c85
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
ee/app/assets/javascripts/security_configuration/dast_profiles/graphql/cache_utils.js
...curity_configuration/dast_profiles/graphql/cache_utils.js
+9
-3
ee/app/assets/javascripts/security_configuration/dast_profiles/graphql/provider.js
.../security_configuration/dast_profiles/graphql/provider.js
+6
-1
No files found.
ee/app/assets/javascripts/security_configuration/dast_profiles/graphql/cache_utils.js
View file @
7a8ae2d4
import
{
produce
}
from
'
immer
'
;
/**
/**
* Appends paginated results to existing ones
* Appends paginated results to existing ones
* - to be used with $apollo.queries.x.fetchMore
* - to be used with $apollo.queries.x.fetchMore
...
@@ -24,10 +25,15 @@ export const appendToPreviousResult = profileType => (previousResult, { fetchMor
...
@@ -24,10 +25,15 @@ export const appendToPreviousResult = profileType => (previousResult, { fetchMor
* @param queryBody
* @param queryBody
*/
*/
export
const
removeProfile
=
({
profileId
,
profileType
,
store
,
queryBody
})
=>
{
export
const
removeProfile
=
({
profileId
,
profileType
,
store
,
queryBody
})
=>
{
const
d
ata
=
store
.
readQuery
(
queryBody
);
const
sourceD
ata
=
store
.
readQuery
(
queryBody
);
data
.
project
[
profileType
].
edges
=
data
.
project
[
profileType
].
edges
.
filter
(({
node
})
=>
{
const
data
=
produce
(
sourceData
,
draftState
=>
{
// eslint-disable-next-line no-param-reassign
draftState
.
project
[
profileType
].
edges
=
draftState
.
project
[
profileType
].
edges
.
filter
(
({
node
})
=>
{
return
node
.
id
!==
profileId
;
return
node
.
id
!==
profileId
;
},
);
});
});
store
.
writeQuery
({
...
queryBody
,
data
});
store
.
writeQuery
({
...
queryBody
,
data
});
...
...
ee/app/assets/javascripts/security_configuration/dast_profiles/graphql/provider.js
View file @
7a8ae2d4
...
@@ -5,5 +5,10 @@ import createDefaultClient from '~/lib/graphql';
...
@@ -5,5 +5,10 @@ import createDefaultClient from '~/lib/graphql';
Vue
.
use
(
VueApollo
);
Vue
.
use
(
VueApollo
);
export
default
new
VueApollo
({
export
default
new
VueApollo
({
defaultClient
:
createDefaultClient
(),
defaultClient
:
createDefaultClient
(
{},
{
assumeImmutableResults
:
true
,
},
),
});
});
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