Skip to content

Commit

Permalink
Merge pull request regione-piemonte#868 from valeria-foco/FixTree
Browse files Browse the repository at this point in the history
Fix tree
  • Loading branch information
diegosanmartino authored Mar 16, 2021
2 parents f31f0b3 + 7ddbf79 commit 2b07bc6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -941,3 +941,6 @@ header.navbar h1 a span {
.rc-tree-bottom_docu + span > span.rc-tree-title {
cursor: pointer;
}
.rc-tree-center_docu + span > span.rc-tree-title {
cursor: pointer;
}
2 changes: 1 addition & 1 deletion frontend/assets/css/sira.css
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ overflow-y: auto;
.scheda-tree {
z-index: 1025;
width: 550px;
min-height: 400px;
min-height: 370px;
position: fixed;
overflow-x:hidden;
box-shadow: 0 0 5px 1px rgba(94,94,94,1);
Expand Down
2 changes: 1 addition & 1 deletion frontend/assets/viaFaseProcedimentale.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"geometryType": "Polygon",
"card": {
"featurePath": "/wfs:FeatureCollection/wfs:member/decsiraogc_sivia:FaseProcedura",
"geometryPath": "decsiraogc_sivia:geometria/gml:Polygon/gml:exterior/gml:LinearRing/gml:posList/text()",
"geometryPath": "decsiraogc_sivia:geometria/gml:MultiSurface/gml:surfaceMember/gml:Polygon/gml:exterior/gml:LinearRing/gml:posList/text()",
"pdfname": "Scheda_FaseProcedimentale_{{/wfs:FeatureCollection/wfs:member/decsiraogc_sivia:FaseProcedura/decsiraogc_sivia:idProgetto/text()}}.pdf",
"template": "assets/cardTemplateFaseProcedimentale.jsxt",
"service": {
Expand Down
25 changes: 8 additions & 17 deletions frontend/js/components/tree/TreeData.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,19 @@ class TreeData extends React.Component {
}

componentWillReceiveProps(newProps) {
/*
if (this.props.featureId !== newProps.featureId) {
this.loadDataForTree(newProps);
} else {
this.props.treeDataLoading(false);
}*/

if (this.props.treeData !== null && this.props.treeData !== undefined && this.props.loading) {
this.loadDataForTree(newProps);
this.props.treeDataLoading(false);
}
}


onSelect = (selectedKeys, info) => {
let selectedData = this.searchKey(this.props.treeData[0], info.node.props.eventKey);
if (selectedKeys && selectedData && selectedData.linkToDetail) {
Expand All @@ -89,7 +94,7 @@ class TreeData extends React.Component {
info
};
this.props.setWaitingForConfig(waitingForConfig);
this.props.loadFeatureTypeConfig(null, {authkey: this.authParams && this.authParams.authkey ? this.authParams.authkey : ''}, featureType, false, false, null, false, null, false, (detailsConfig = {})=>{
this.props.loadFeatureTypeConfig(null, { authkey: this.authParams && this.authParams.authkey ? this.authParams.authkey : '' }, featureType, false, false, null, false, null, false, (detailsConfig = {}) => {
this.loadCardTemplate(detailsConfig, cqlFilter);
});
}
Expand Down Expand Up @@ -138,24 +143,10 @@ class TreeData extends React.Component {
};
const treeNodes = this.props.treeData ? loop(this.props.treeData) : [];

const getKeys = (data) => {
return data.reduce(function(acc, o) {
let ret = acc;
if (o.key) {
ret.push(o.key);
}
if (o.children) {
ret = ret.concat(getKeys(o.children));
}
return ret;
}, []);
};
const expandedKeys = this.props.treeData ? getKeys(this.props.treeData) : [];

return (
<Tree showLine
showIcon={false}
defaultExpandedKeys={expandedKeys}
defaultExpandAll
onSelect={this.onSelect}>
{treeNodes}
</Tree>);
Expand Down

0 comments on commit 2b07bc6

Please sign in to comment.