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
81191d35
Verified
Commit
81191d35
authored
1 month ago
by
Dennis Collaris
Browse files
Options
Downloads
Patches
Plain Diff
fix: ensure sortable order remains correct after rerunning query
parent
bfcd95ab
No related branches found
No related tags found
No related merge requests found
Pipeline
#146864
failed
1 month ago
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/lib/querybuilder/panel/QueryBuilderNav.tsx
+12
-3
12 additions, 3 deletions
src/lib/querybuilder/panel/QueryBuilderNav.tsx
with
12 additions
and
3 deletions
src/lib/querybuilder/panel/QueryBuilderNav.tsx
+
12
−
3
View file @
81191d35
...
@@ -25,6 +25,8 @@ import { wsAddQuery, wsDeleteQuery, wsManualQueryRequest, wsUpdateQuery } from '
...
@@ -25,6 +25,8 @@ import { wsAddQuery, wsDeleteQuery, wsManualQueryRequest, wsUpdateQuery } from '
import
{
Tabs
,
Tab
}
from
'
@/lib/components/tabs
'
;
import
{
Tabs
,
Tab
}
from
'
@/lib/components/tabs
'
;
import
{
addError
}
from
'
@/lib/data-access/store/configSlice
'
;
import
{
addError
}
from
'
@/lib/data-access/store/configSlice
'
;
import
Sortable
from
'
sortablejs
'
;
import
Sortable
from
'
sortablejs
'
;
import
{
Query
}
from
'
ts-common
'
;
import
objectHash
from
'
object-hash
'
;
export
type
QueryBuilderToggleSettings
=
'
settings
'
|
'
ml
'
|
'
logic
'
|
'
relatedNodes
'
|
undefined
;
export
type
QueryBuilderToggleSettings
=
'
settings
'
|
'
ml
'
|
'
logic
'
|
'
relatedNodes
'
|
undefined
;
...
@@ -67,8 +69,7 @@ export const QueryBuilderNav = (props: QueryBuilderNavProps) => {
...
@@ -67,8 +69,7 @@ export const QueryBuilderNav = (props: QueryBuilderNavProps) => {
const
tabsRef
=
useRef
<
HTMLDivElement
|
null
>
(
null
);
const
tabsRef
=
useRef
<
HTMLDivElement
|
null
>
(
null
);
useEffect
(()
=>
{
useEffect
(()
=>
{
if
(
!
tabsRef
.
current
)
return
;
if
(
!
activeSS
||
!
tabsRef
.
current
)
return
;
const
sortable
=
new
Sortable
(
tabsRef
.
current
,
{
const
sortable
=
new
Sortable
(
tabsRef
.
current
,
{
animation
:
150
,
animation
:
150
,
draggable
:
'
[data-type="tab"]
'
,
draggable
:
'
[data-type="tab"]
'
,
...
@@ -86,10 +87,17 @@ export const QueryBuilderNav = (props: QueryBuilderNavProps) => {
...
@@ -86,10 +87,17 @@ export const QueryBuilderNav = (props: QueryBuilderNavProps) => {
},
},
});
});
const
sortedQueries
=
activeSS
.
queryStates
.
openQueryArray
.
filter
(
query
=>
query
.
id
!=
null
)
.
sort
((
a
,
b
)
=>
{
return
a
.
order
<
b
.
order
?
-
1
:
1
;
});
sortable
.
sort
(
sortedQueries
.
map
(
x
=>
String
(
x
.
id
)));
return
()
=>
{
return
()
=>
{
sortable
.
destroy
();
sortable
.
destroy
();
};
};
},
[
activeSS
?.
queryStates
.
openQueryArray
]);
},
[
activeSS
?
objectHash
(
Object
.
fromEntries
(
activeSS
?.
queryStates
.
openQueryArray
.
map
(
x
=>
[
x
.
id
,
x
.
order
])))
:
null
]);
const
mlEnabled
=
ml
.
linkPrediction
.
enabled
||
ml
.
centrality
.
enabled
||
ml
.
communityDetection
.
enabled
||
ml
.
shortestPath
.
enabled
;
const
mlEnabled
=
ml
.
linkPrediction
.
enabled
||
ml
.
centrality
.
enabled
||
ml
.
communityDetection
.
enabled
||
ml
.
shortestPath
.
enabled
;
...
@@ -169,6 +177,7 @@ export const QueryBuilderNav = (props: QueryBuilderNavProps) => {
...
@@ -169,6 +177,7 @@ export const QueryBuilderNav = (props: QueryBuilderNavProps) => {
text
=
""
text
=
""
activeTab
=
{
query
.
id
===
activeQuery
?.
id
}
activeTab
=
{
query
.
id
===
activeQuery
?.
id
}
key
=
{
i
}
key
=
{
i
}
data-id
=
{
query
.
id
}
onClick
=
{
()
=>
{
onClick
=
{
()
=>
{
if
(
query
.
id
==
null
)
return
;
if
(
query
.
id
==
null
)
return
;
dispatch
(
setActiveQueryID
(
query
.
id
));
dispatch
(
setActiveQueryID
(
query
.
id
));
...
...
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