Skip to content

Commit a6dc79c

Browse files
committed
Fixed footer for graph viz cards
1 parent 99051a7 commit a6dc79c

File tree

3 files changed

+26
-12
lines changed

3 files changed

+26
-12
lines changed

public/style.css

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ code {
9595
margin-right: 15px;
9696
}
9797
.leaflet-marker-icon {
98+
margin-left: -13px !important;
9899
width: 25px !important;
99100
height: 30px !important;
100101
}
@@ -103,7 +104,7 @@ code {
103104
}
104105
.leaflet-marker-icon .material-icons {
105106
font-size: 34px;
106-
margin-left: 33px;
107+
margin-left: -4px;
107108
margin-top: -6px;
108109
-webkit-text-stroke-width: 1.5px;
109110
-webkit-text-stroke-color: #666;
@@ -159,8 +160,8 @@ code {
159160
margin-bottom: 150px;
160161
}
161162
.card-action {
163+
clip: rect(-2000px 2000px 150px 5px);
162164
max-height: 150px;
163-
overflow-y: scroll;
164165
}
165166
.btn-center-align :hover {
166167
opacity: 0.7;
@@ -348,6 +349,7 @@ nav textarea:disabled {
348349

349350
.card-action .select-wrapper {
350351
width: 120px;
352+
351353
}
352354
.tabs .tab a {
353355
padding: 0px;

src/card/NeoCard.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,7 @@ export class NeoCard extends React.Component {
402402
data={this.state.data}
403403
stateChanged={this.stateChanged}
404404
refresh={this.state.refresh}/>
405-
this.state.action = emptyAction;
406-
// <NeoMapFooter page={this.state.page} key={0} data={this.state.data} onChange={this.stateChanged}/>
405+
this.state.action = <NeoMapFooter page={this.state.page} key={0} data={this.state.data} onChange={this.stateChanged}/>
407406
}
408407

409408
/**

src/card/report/NeoMapReport.js

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {MapContainer, Polyline, Popup, TileLayer} from "react-leaflet";
44
import Marker from 'react-leaflet-enhanced-marker';
55
import Icon from "react-materialize/lib/Icon";
66

7-
class NeoTestReport extends NeoReport {
7+
class NeoMapReport extends NeoReport {
88
// Per pixel, scaling factors for the latitude/longitude mapping function.
99
widthScale = 3.35;
1010
heightScale = 6.7;
@@ -27,12 +27,25 @@ class NeoTestReport extends NeoReport {
2727
if (this.state.data) {
2828
this.state.data.forEach(record => {
2929
Object.values(record).forEach(v => {
30-
if (v.identity && v.properties) {
31-
console.log(v)
30+
if (v.identity && v.properties && v.properties.latitude && v.properties.longitude ) {
31+
let lat = parseFloat(v.properties.latitude);
32+
let long = parseFloat(v.properties.longitude);
33+
if (!isNaN(lat) && !isNaN(long)){
34+
this.state.nodesAndPositions.push({pos: [lat, long], node: v})
35+
}
36+
}else if (v.identity && v.properties && v.properties.lat && v.properties.long ) {
37+
let lat = parseFloat(v.properties.lat);
38+
let long = parseFloat(v.properties.long);
39+
if (!isNaN(lat) && !isNaN(long)){
40+
this.state.nodesAndPositions.push({pos: [lat, long], node: v})
41+
}
42+
}else if (v.identity && v.properties) {
3243
Object.values(v.properties).forEach(p => {
44+
// We found a property that holds a Neo4j point object
3345
if (p.srid && p.x && p.y) {
34-
console.log([p.x, p.y])
35-
this.state.nodesAndPositions.push({pos: [p.y, p.x], node: v.properties})
46+
if (!isNaN(p.x) && !isNaN(p.y)) {
47+
this.state.nodesAndPositions.push({pos: [p.y, p.x], node: v})
48+
}
3649
}
3750
})
3851
}
@@ -80,8 +93,8 @@ class NeoTestReport extends NeoReport {
8093
this.state.nodesAndPositions.map(i =>
8194
<Marker position={i.pos}
8295
icon={<div style={{color: colors[0]}}><Icon className="close">place</Icon></div>}>
83-
<Popup><code>{Object.keys(i.node).map(key =>
84-
<pre>{key + ": " + i.node[key] + "\n"}</pre>)}</code></Popup>
96+
<Popup><h6>{i.node.labels.map(b => b + " ")}</h6><code>{Object.keys(i.node.properties).map(key =>
97+
<pre>{key + ": " + i.node.properties[key] + "\n"}</pre>)}</code></Popup>
8598
</Marker>) : <div></div>
8699
let lines = <div></div>// [<Polyline key={0} positions={[this.state.pos1, this.state.pos2]} color={colors[0]}/>];
87100

@@ -116,4 +129,4 @@ class NeoTestReport extends NeoReport {
116129
}
117130
}
118131

119-
export default (NeoTestReport);
132+
export default (NeoMapReport);

0 commit comments

Comments
 (0)