-
Notifications
You must be signed in to change notification settings - Fork 410
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added infinite nesting to TOC #1388
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do we handle group id assignment?
Is it working for current configurations?
let getGroupVisibility = (nodes) => { | ||
let visibility = true; | ||
let visibility = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this refactor is correct. The group visibility is true only if every node is visible
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -9,21 +9,41 @@ | |||
const assign = require('object-assign'); | |||
const {isObject, isArray} = require('lodash'); | |||
|
|||
const getGroup = (groupId, groups) => { | |||
return groups.filter((subGroup) => isObject(subGroup) && subGroup.id === groupId).pop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use lodash head to get first element of array, not pop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The id is autogenerated and is the same then before, are name and title that change.
@@ -204,7 +149,29 @@ function layers(state = [], action) { | |||
}); | |||
let originalNode = head(flatLayers.filter((layer) => { return (layer[selector] === action.node || layer[selector].indexOf(action.node + '.') === 0); })); | |||
if (!sameGroup && originalNode ) { | |||
let newGroups = moveNode(state.groups, action.node, (action.options.group || 'Default')); | |||
// Remove layers from old group |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you remove moveNode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
@@ -0,0 +1,25 @@ | |||
/** | |||
* Copyright 2016, GeoSolutions Sas. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2017
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -31,7 +31,7 @@ const GroupTitle = React.createClass({ | |||
let expanded = (this.props.node.expanded !== undefined) ? this.props.node.expanded : true; | |||
let groupTitle = this.props.node && this.props.node.title || 'Default'; | |||
return ( | |||
<div className="toc-group-title" onClick={() => this.props.onClick(this.props.node.name, expanded)} style={this.props.style}> | |||
<div className="toc-group-title" onClick={() => this.props.onClick(this.props.node.id, expanded)} style={this.props.style}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the id
mandatory now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, group id is mandatory, but is autogenerated in LayersUtils.getLayersByGroup
const getNode = (nodes, name) => { | ||
if (nodes && isArray(nodes)) { | ||
return nodes.reduce((previous, node) => { | ||
if (previous) { | ||
return previous; | ||
} | ||
if (node && node.name === name) { | ||
if (node && (node.name === name || node.id === name)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename name
parameter as id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
group = head(LayersUtils.getLayersByGroup([getNode(newLayers, node)])); | ||
// check for parent group if exist | ||
const parentGroup = groupId.split('.').reduce((tree, gName, idx) => { | ||
const gId = groupId.split(".", idx + 1).join('.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parentId
is more meaningful
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
parentGroup is the object parentGroup.id is the parentId
Should we use |
No description provided.