Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
Nos Hs2023
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Språksamlingane
stadnamn
Nos Hs2023
Commits
0d98de44
Commit
0d98de44
authored
4 years ago
by
esikkala
Browse files
Options
Downloads
Patches
Plain Diff
Update changeNodeAtPath
parent
18e71bce
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/client/components/facet_bar/HierarchicalFacet.js
+27
-27
27 additions, 27 deletions
src/client/components/facet_bar/HierarchicalFacet.js
with
27 additions
and
27 deletions
src/client/components/facet_bar/HierarchicalFacet.js
+
27
−
27
View file @
0d98de44
...
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
...
@@ -3,7 +3,7 @@ import PropTypes from 'prop-types'
import
intl
from
'
react-intl-universal
'
import
intl
from
'
react-intl-universal
'
import
{
withStyles
}
from
'
@material-ui/core/styles
'
import
{
withStyles
}
from
'
@material-ui/core/styles
'
import
{
has
}
from
'
lodash
'
import
{
has
}
from
'
lodash
'
import
SortableTree
,
{
changeNodeAtPath
,
getNodeAtPath
}
from
'
react-sortable-tree
'
import
SortableTree
,
{
changeNodeAtPath
}
from
'
react-sortable-tree
'
import
FileExplorerTheme
from
'
react-sortable-tree-theme-file-explorer
'
import
FileExplorerTheme
from
'
react-sortable-tree-theme-file-explorer
'
import
Checkbox
from
'
@material-ui/core/Checkbox
'
import
Checkbox
from
'
@material-ui/core/Checkbox
'
import
FormControlLabel
from
'
@material-ui/core/FormControlLabel
'
import
FormControlLabel
from
'
@material-ui/core/FormControlLabel
'
...
@@ -95,37 +95,37 @@ class HierarchicalFacet extends Component {
...
@@ -95,37 +95,37 @@ class HierarchicalFacet extends Component {
serverFScomponentDidUpdate
=
prevProps
=>
{
serverFScomponentDidUpdate
=
prevProps
=>
{
// update component state if the user modified this facet
// update component state if the user modified this facet
if
(
prevProps
.
facetUpdateID
!==
this
.
props
.
facetUpdateID
)
{
if
(
prevProps
.
facetUpdateID
!==
this
.
props
.
facetUpdateID
)
{
// When removing, node may be already removed by the SPARQL query, check for those
if
(
!
this
.
props
.
facet
.
useConjuction
&&
this
.
props
.
updatedFacet
===
this
.
props
.
facetID
)
{
if
(
!
this
.
props
.
facet
.
useConjuction
&&
this
.
props
.
updatedFacet
===
this
.
props
.
facetID
)
{
if
(
has
(
this
.
props
.
updatedFilter
,
'
path
'
)
&&
!
this
.
props
.
updatedFilter
.
added
&&
!
getNodeAtPath
(
this
.
props
.
updatedFilter
.
path
)
)
{
return
}
if
(
has
(
this
.
props
.
updatedFilter
,
'
path
'
))
{
if
(
has
(
this
.
props
.
updatedFilter
,
'
path
'
))
{
const
treeObj
=
this
.
props
.
updatedFilter
const
treeObj
=
this
.
props
.
updatedFilter
const
newTreeData
=
changeNodeAtPath
({
try
{
treeData
:
this
.
state
.
treeData
,
const
newTreeData
=
changeNodeAtPath
({
getNodeKey
:
({
treeIndex
})
=>
treeIndex
,
treeData
:
this
.
state
.
treeData
,
path
:
treeObj
.
path
,
getNodeKey
:
({
treeIndex
})
=>
treeIndex
,
newNode
:
()
=>
{
path
:
treeObj
.
path
,
const
oldNode
=
treeObj
.
node
newNode
:
()
=>
{
if
(
has
(
oldNode
,
'
children
'
))
{
const
oldNode
=
treeObj
.
node
return
{
if
(
has
(
oldNode
,
'
children
'
))
{
...
oldNode
,
return
{
selected
:
treeObj
.
added
?
'
true
'
:
'
false
'
,
...
oldNode
,
// select also children by default if 'selectAlsoSubconcepts' is not defined
selected
:
treeObj
.
added
?
'
true
'
:
'
false
'
,
...((
!
Object
.
prototype
.
hasOwnProperty
.
call
(
this
.
props
.
facet
,
'
selectAlsoSubconcepts
'
)
||
this
.
props
.
facet
.
selectAlsoSubconcepts
)
&&
// select also children by default if 'selectAlsoSubconcepts' is not defined
{
children
:
this
.
recursiveSelect
(
oldNode
.
children
,
treeObj
.
added
)
})
...((
!
Object
.
prototype
.
hasOwnProperty
.
call
(
this
.
props
.
facet
,
'
selectAlsoSubconcepts
'
)
||
this
.
props
.
facet
.
selectAlsoSubconcepts
)
&&
}
{
children
:
this
.
recursiveSelect
(
oldNode
.
children
,
treeObj
.
added
)
})
}
else
{
}
return
{
}
else
{
...
oldNode
,
return
{
selected
:
treeObj
.
added
?
'
true
'
:
'
false
'
...
oldNode
,
selected
:
treeObj
.
added
?
'
true
'
:
'
false
'
}
}
}
}
}
}
})
})
this
.
setState
({
treeData
:
newTreeData
})
this
.
setState
({
treeData
:
newTreeData
})
}
catch
(
err
)
{
// console.log(err)
// Ignore the error -- the null return will be explanation enough
}
}
}
}
else
{
// else fetch new values, because some other facet was updated
}
else
{
// else fetch new values, because some other facet was updated
// console.log(`fetching new values for ${this.props.facetID}`)
// console.log(`fetching new values for ${this.props.facetID}`)
...
...
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