Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
Frontend V2
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GraphPolaris
Frontend V2
Commits
9ecb7248
Commit
9ecb7248
authored
2 months ago
by
Leonardo
Browse files
Options
Downloads
Patches
Plain Diff
feat: differentiation
parent
4766c036
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#145213
passed
2 months ago
Stage: tag-release
Stage: get-release-tag
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib/data-access/store/graphQueryResultSlice.ts
+22
-5
22 additions, 5 deletions
src/lib/data-access/store/graphQueryResultSlice.ts
with
22 additions
and
5 deletions
src/lib/data-access/store/graphQueryResultSlice.ts
+
22
−
5
View file @
9ecb7248
import
{
createSlice
,
PayloadAction
}
from
'
@reduxjs/toolkit
'
;
import
type
{
AppDispatch
,
RootState
}
from
'
./store
'
;
import
{
GraphQueryResultFromBackend
,
GraphStatistics
,
NodeAttributes
,
QueryStatusResult
}
from
'
ts-common
'
;
import
{
CountQueryResultFromBackend
,
GraphQueryResultFromBackend
,
GraphQueryResultMetaFromBackend
,
GraphStatistics
,
NodeAttributes
,
QueryStatusResult
,
}
from
'
ts-common
'
;
export
type
UniqueEdge
=
{
attributes
:
NodeAttributes
;
...
...
@@ -10,17 +17,21 @@ export type UniqueEdge = {
};
// Define a type for the slice state
export
type
GraphQueryResult
=
GraphQueryResultFromBackend
&
{
export
type
GraphQueryResult
=
GraphQueryResult
Meta
FromBackend
&
{
queryingBackend
:
boolean
;
metaData
?:
GraphStatistics
;
};
// Define the initial state using that type
export
const
initialState
:
GraphQueryResult
=
{
metaData
:
undefined
,
metaData
:
{
nodes
:
{
count
:
0
,
labels
:
[],
types
:
{}
},
edges
:
{
count
:
0
,
labels
:
[],
types
:
{}
},
topological
:
{
density
:
0
,
self_loops
:
0
},
},
nodes
:
[],
edges
:
[],
queryingBackend
:
false
,
nodeCounts
:
{},
};
export
const
graphQueryResultSlice
=
createSlice
({
...
...
@@ -32,13 +43,19 @@ export const graphQueryResultSlice = createSlice({
state
.
metaData
=
action
.
payload
.
result
.
payload
.
metaData
;
state
.
nodes
=
action
.
payload
.
result
.
payload
.
nodes
;
state
.
edges
=
action
.
payload
.
result
.
payload
.
edges
;
state
.
nodeCounts
=
action
.
payload
.
result
.
payload
.
nodeCounts
;
state
.
queryingBackend
=
false
;
},
resetGraphQueryResults
:
state
=>
{
// Assign new state
state
.
metaData
=
undefined
;
state
.
metaData
=
{
nodes
:
{
count
:
0
,
labels
:
[],
types
:
{}
},
edges
:
{
count
:
0
,
labels
:
[],
types
:
{}
},
topological
:
{
density
:
0
,
self_loops
:
0
},
};
state
.
nodes
=
[];
state
.
edges
=
[];
state
.
nodeCounts
=
{};
state
.
queryingBackend
=
false
;
},
queryingBackend
:
(
state
,
action
:
PayloadAction
<
boolean
|
undefined
>
)
=>
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment