Skip to content

Commit 2c890ee

Browse files
authored
Merge branch 'develop' into task/fixDarkThemeMore
2 parents bcc5000 + e3e4f14 commit 2c890ee

File tree

12 files changed

+70
-24
lines changed

12 files changed

+70
-24
lines changed

docs/modules/ROOT/pages/quickstart.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ https://neodash.graphapp.io.
88
App Gallery].
99
. Using Docker:
1010
```
11-
docker pull neo4jlabs/neodash:latest
11+
docker pull neo4jlabs/neodash:latest
1212
docker run -it --rm -p 5005:5005 neo4jlabs/neodash
1313
```
1414

public/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
</head>
3131

3232
<body>
33+
<div id="overlay"></div>
3334
<div id="root"></div>
3435
<noscript>Please enable JavaScript to view this site.</noscript>
3536
<script src="bundle.js"></script>

public/style.css

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,4 +228,11 @@
228228
transform: scale(0.95);
229229
box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
230230
}
231-
}
231+
}
232+
233+
/* Workaround for Needle not handling menu placement of dropdowns on modals */
234+
#overlay {
235+
z-index: 99 !important;
236+
position: absolute;
237+
}
238+
/* End workaround */

src/application/ApplicationThunks.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export const createConnectionThunk =
124124
query,
125125
parameters,
126126
1,
127-
() => {},
127+
() => { },
128128
(records) => validateConnection(records)
129129
);
130130
} catch (e) {
@@ -254,7 +254,7 @@ export const handleSharedDashboardsThunk = () => (dispatch: any) => {
254254
dispatch(onConfirmLoadSharedDashboardThunk());
255255
}
256256

257-
window.history.pushState({}, document.title, '/');
257+
window.history.pushState({}, document.title, window.location.pathname);
258258
} else {
259259
dispatch(setConnectionModalOpen(false));
260260
// dispatch(setWelcomeScreenOpen(false));
@@ -273,7 +273,7 @@ export const handleSharedDashboardsThunk = () => (dispatch: any) => {
273273
false
274274
)
275275
);
276-
window.history.pushState({}, document.title, '/');
276+
window.history.pushState({}, document.title, window.location.pathname);
277277
}
278278
} else {
279279
// dispatch(resetShareDetails());

src/card/settings/CardSettingsContent.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ const NeoCardSettingsContent = ({
111111
label: report?.label || '',
112112
value: report?.label || '',
113113
},
114-
menuPortalTarget: document.querySelector('body'),
114+
menuPortalTarget: document.querySelector('#overlay'),
115115
}}
116116
fluid
117117
style={{ marginLeft: '0px', marginRight: '10px', width: '47%', maxWidth: '200px', display: 'inline-block' }}
@@ -133,7 +133,7 @@ const NeoCardSettingsContent = ({
133133
value: database,
134134
})),
135135
value: { label: databaseText, value: databaseText },
136-
menuPortalTarget: document.querySelector('body'),
136+
menuPortalTarget: document.querySelector('#overlay'),
137137
}}
138138
fluid
139139
style={{ marginLeft: '0px', marginRight: '10px', width: '47%', maxWidth: '200px', display: 'inline-block' }}

src/card/view/CardViewFooter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ const NeoCardViewFooter = ({
121121
: { label: selection[selectable], value: selection[selectable] },
122122
isMulti: selectableFields[selectable].multiple,
123123
isClearable: false,
124-
menuPortalTarget: document.querySelector('body'),
124+
menuPortalTarget: document.querySelector('#overlay'),
125125
}}
126126
fluid
127127
style={{

src/chart/bar/BarChart.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const NeoBarChart = (props: ChartProps) => {
2828

2929
const { records, selection } = props;
3030

31-
const [keys, setKeys] = React.useState({});
31+
const [keys, setKeys] = React.useState<string[]>([]);
3232
const [data, setData] = React.useState<Record<string, any>[]>([]);
3333

3434
useEffect(() => {
@@ -72,7 +72,7 @@ const NeoBarChart = (props: ChartProps) => {
7272
return row;
7373
});
7474

75-
setKeys(newKeys);
75+
setKeys(Object.keys(newKeys));
7676
setData(newData);
7777
}, [selection]);
7878

@@ -114,8 +114,8 @@ const NeoBarChart = (props: ChartProps) => {
114114
const chartColorsByScheme = getD3ColorsByScheme(colorScheme);
115115
// Compute bar color based on rules - overrides default color scheme completely.
116116
const getBarColor = (bar) => {
117-
let { data, id } = bar;
118-
let colorIndex = Object.keys(data).indexOf(id);
117+
let { id } = bar;
118+
let colorIndex = keys.indexOf(id);
119119
if (colorIndex >= chartColorsByScheme.length) {
120120
colorIndex %= chartColorsByScheme.length;
121121
}
@@ -218,7 +218,7 @@ const NeoBarChart = (props: ChartProps) => {
218218
layout={layout}
219219
groupMode={groupMode == 'stacked' ? 'stacked' : 'grouped'}
220220
enableLabel={enableLabel}
221-
keys={Object.keys(keys)}
221+
keys={keys}
222222
indexBy='index'
223223
margin={{
224224
top: marginTop,

src/chart/graph/component/GraphChartInspectModal.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ export const NeoGraphChartInspectModal = (props: GraphChartVisualizationProps) =
1717
aria-labelledby='form-dialog-title'
1818
>
1919
<Dialog.Header id='form-dialog-title'>
20-
{props.interactivity.selectedEntity ? getEntityHeader(props.interactivity.selectedEntity) : ''}
20+
{props.interactivity.selectedEntity
21+
? getEntityHeader(props.interactivity.selectedEntity, props.engine.selection)
22+
: ''}
2123
</Dialog.Header>
2224
<Dialog.Content>
2325
<GraphEntityInspectionTable entity={props.interactivity.selectedEntity}></GraphEntityInspectionTable>

src/chart/graph/util/NodeUtils.ts

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,26 @@ export const parseNodeIconConfig = (iconStyle) => {
2424
}
2525
};
2626

27-
export const getEntityHeader = (entity) => {
28-
return (entity.labels && entity.labels.join(', ')) || entity.type;
27+
const getSelectedNodeProperty = (entity: any, sourceOrTarget: string, propertySelections: any) => {
28+
const selection = propertySelections[entity[sourceOrTarget]?.mainLabel];
29+
switch (selection) {
30+
case '(label)':
31+
return entity[sourceOrTarget]?.mainLabel;
32+
case '(id)':
33+
return entity[sourceOrTarget]?.id;
34+
default:
35+
return entity[sourceOrTarget]?.properties[selection];
36+
}
37+
};
38+
39+
const getRelPatternString = (entity: any, selection: any) => {
40+
const sourceTitle = getSelectedNodeProperty(entity, 'source', selection);
41+
const targetTitle = getSelectedNodeProperty(entity, 'target', selection);
42+
return `(${sourceTitle ? sourceTitle : '[no value]'} --> ${targetTitle ? targetTitle : '[no value]'})`;
43+
};
44+
45+
export const getEntityHeader = (entity: any, selection: any) => {
46+
return entity.labels?.join(', ') || `${entity.type} ${getRelPatternString(entity, selection)}`;
2947
};
3048

3149
export const drawDataURIOnCanvas = (node, strDataURI, canvas, defaultNodeSize) => {

src/chart/graph/util/RecordUtils.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,12 @@ function extractGraphEntitiesFromField(
122122
}
123123
}
124124

125+
const isValidLink = (link, nodes) => {
126+
if (nodes[link.source] == null || nodes[link.target] == null) {
127+
return false;
128+
}
129+
return true;
130+
};
125131
export function buildGraphVisualizationObjectFromRecords(
126132
records: any[], // Neo4jRecord[],
127133
nodes: Record<string, any>[],
@@ -162,6 +168,7 @@ export function buildGraphVisualizationObjectFromRecords(
162168
);
163169
});
164170
});
171+
165172
// Assign proper curvatures and colors to relationships.
166173
// Assigning curvature is needed for pairs of nodes that have multiple relationships between them, or self-loops.
167174
const linksList = Object.values(links).map((linkArray) => {
@@ -176,6 +183,12 @@ export function buildGraphVisualizationObjectFromRecords(
176183
});
177184
});
178185

186+
linksList.forEach((link, idx, object) => {
187+
if (!isValidLink(link[0], nodes)) {
188+
object.splice(idx, 1);
189+
}
190+
});
191+
179192
// Assign proper colors to nodes.
180193
const totalColors = colorScheme ? colorScheme.length : 0;
181194
const nodeLabelsList = fields.map((e) => e[0]);

0 commit comments

Comments
 (0)