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
c3a0ffa4
Commit
c3a0ffa4
authored
Mar 29, 2022
by
Jose Vargas
Committed by
Jose Ivan Vargas
Apr 01, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Config changes to make it work with filtered search
parent
07a8b271
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
9 deletions
+37
-9
app/assets/javascripts/jobs/components/table/graphql/cache_config.js
...javascripts/jobs/components/table/graphql/cache_config.js
+21
-8
spec/frontend/jobs/components/table/graphql/cache_config_spec.js
...ontend/jobs/components/table/graphql/cache_config_spec.js
+9
-1
spec/frontend/jobs/mock_data.js
spec/frontend/jobs/mock_data.js
+7
-0
No files found.
app/assets/javascripts/jobs/components/table/graphql/cache_config.js
View file @
c3a0ffa4
import
{
isEqual
,
differenceWith
}
from
'
lodash
'
;
import
{
isEqual
}
from
'
lodash
'
;
export
default
{
typePolicies
:
{
...
...
@@ -13,15 +13,28 @@ export default {
merge
(
existing
=
{},
incoming
,
{
args
=
{}
})
{
let
nodes
;
const
areNodesEqual
=
isEqual
(
existing
.
nodes
,
incoming
.
nodes
);
const
statuses
=
Array
.
isArray
(
args
.
statuses
)
?
[...
args
.
statuses
]
:
args
.
statuses
;
const
{
pageInfo
}
=
incoming
;
if
(
Object
.
keys
(
existing
).
length
!==
0
&&
isEqual
(
existing
?.
statuses
,
args
?.
statuses
))
{
const
diff
=
differenceWith
(
existing
.
nodes
,
incoming
.
nodes
,
isEqual
);
if
(
existing
.
nodes
.
length
===
incoming
.
nodes
.
length
)
{
if
(
diff
.
length
!==
0
)
{
nodes
=
[...
existing
.
nodes
,
...
diff
];
if
(
areNodesEqual
)
{
if
(
incoming
.
pageInfo
.
hasNextPage
)
{
nodes
=
[...
existing
.
nodes
,
...
incoming
.
nodes
];
}
else
{
nodes
=
[...
exist
ing
.
nodes
];
nodes
=
[...
incom
ing
.
nodes
];
}
}
else
{
if
(
!
existing
.
pageInfo
?.
hasNextPage
)
{
nodes
=
[...
incoming
.
nodes
];
return
{
nodes
,
statuses
,
pageInfo
,
};
}
nodes
=
[...
existing
.
nodes
,
...
incoming
.
nodes
];
}
}
else
{
...
...
@@ -30,8 +43,8 @@ export default {
return
{
nodes
,
statuses
:
Array
.
isArray
(
args
.
statuses
)
?
[...
args
.
statuses
]
:
args
.
statuses
,
pageInfo
:
incoming
.
pageInfo
,
statuses
,
pageInfo
,
};
},
},
...
...
spec/frontend/jobs/components/table/graphql/cache_config_spec.js
View file @
c3a0ffa4
...
...
@@ -34,9 +34,17 @@ describe('jobs/components/table/graphql/cache_config', () => {
});
it
(
'
should not add to existing cache if the incoming elements are the same
'
,
()
=>
{
// simulate that this is the last page
const
finalExistingCache
=
{
...
CIJobConnectionExistingCache
,
pageInfo
:
{
hasNextPage
:
false
,
},
};
const
res
=
cacheConfig
.
typePolicies
.
CiJobConnection
.
merge
(
CIJobConnectionExistingCache
,
CIJobConnection
ExistingCache
,
final
ExistingCache
,
{
args
:
firstLoadArgs
,
},
...
...
spec/frontend/jobs/mock_data.js
View file @
c3a0ffa4
...
...
@@ -1911,6 +1911,13 @@ export const CIJobConnectionIncomingCacheRunningStatus = {
};
export
const
CIJobConnectionExistingCache
=
{
pageInfo
:
{
__typename
:
'
PageInfo
'
,
endCursor
:
'
eyJpZCI6IjIwNTEifQ
'
,
hasNextPage
:
true
,
hasPreviousPage
:
false
,
startCursor
:
'
eyJpZCI6IjIxNzMifQ
'
,
},
nodes
:
[
{
__ref
:
'
CiJob:gid://gitlab/Ci::Build/2100
'
},
{
__ref
:
'
CiJob:gid://gitlab/Ci::Build/2101
'
},
...
...
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