Skip to content

Commit 4827e5d

Browse files
kartik-gupta-ijgeneralltrean
authored
feat: Add Separate Panel for Points View to Mirror Graph Layout (#222)
* feat: Add Separate Panel for Points View to Mirror Graph Layout * fmt * audit fix * Review for visualization preview (#233) * fix * wip * WIP: hover colloring of the scatterplot * WIP: hover colloring of the scatterplot * WIP: hover colloring of the scatterplot * color addaptation of the pallete * wip: refactor requests * simplify color-by requests * minor fixes --------- Co-authored-by: trean <[email protected]> * audit fix --------- Co-authored-by: Andrey Vasnetsov <[email protected]> Co-authored-by: trean <[email protected]>
1 parent 230842b commit 4827e5d

File tree

14 files changed

+503
-582
lines changed

14 files changed

+503
-582
lines changed

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/GraphVisualisation/PointPreview.jsx renamed to src/components/Common/PointPreview.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const PointPreview = ({ point }) => {
1111
const [loading] = React.useState(false);
1212
const conditions = [];
1313
const payloadSchema = {};
14-
const onConditionChange = () => {};
1514

1615
if (!point) {
1716
return null;
@@ -48,7 +47,6 @@ const PointPreview = ({ point }) => {
4847
<Grid item xs={12} my={1}>
4948
<DataGridList
5049
data={{ id: point.id, ...point.payload }}
51-
onConditionChange={onConditionChange}
5250
conditions={conditions}
5351
payloadSchema={payloadSchema}
5452
/>
@@ -67,7 +65,7 @@ const PointPreview = ({ point }) => {
6765
}}
6866
/>
6967
<CardContent>
70-
<Vectors point={point} onConditionChange={onConditionChange} />
68+
<Vectors point={point} />
7169
</CardContent>
7270
</>
7371
)}

src/components/FilterEditorWindow/config/RequestFromCode.js

Lines changed: 0 additions & 165 deletions
This file was deleted.

src/components/FilterEditorWindow/index.jsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useClient } from '../../context/client-context';
66
import { useTheme } from '@mui/material/styles';
77
import { autocomplete } from './config/Autocomplete';
88
import { useSnackbar } from 'notistack';
9-
import { codeParse } from './config/RequestFromCode';
9+
import { bigIntJSON } from '../../common/bigIntJSON';
1010
import './editor.css';
1111
import EditorCommon from '../EditorCommon';
1212

@@ -30,6 +30,20 @@ const CodeEditorWindow = ({ onChange, code, onChangeResult, customRequestSchema,
3030
[]
3131
);
3232

33+
function codeParse(codeText) {
34+
// Parse JSON
35+
if (codeText) {
36+
try {
37+
return bigIntJSON.parse(codeText);
38+
} catch (e) {
39+
return {
40+
reqBody: codeText,
41+
error: 'Fix the position brackets to run & check the json',
42+
};
43+
}
44+
}
45+
}
46+
3347
function onRun(codeText) {
3448
const data = codeParse(codeText);
3549
if (data.error) {

src/components/Points/DataGridList.jsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ export const DataGridList = function ({ data = {}, specialCases = {}, onConditio
8585
if (conditions.find((c) => c.key === filter.key && c.value === filter.value)) {
8686
return;
8787
}
88-
onConditionChange([...conditions, filter]);
88+
if (typeof onConditionChange === 'function') {
89+
onConditionChange([...conditions, filter]);
90+
}
8991
}}
9092
>
9193
<FilterAltIcon />

src/components/Points/PointVectors.jsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const Vectors = memo(function Vectors({ point, onConditionChange }) {
3434

3535
return (
3636
<Box pt={2}>
37+
Vectors:
3738
{Object.keys(vectors).map((key) => {
3839
return (
3940
<Grid key={key} container spacing={2}>
@@ -81,13 +82,17 @@ const Vectors = memo(function Vectors({ point, onConditionChange }) {
8182
<Button variant="outlined" size="small" onClick={() => handleNavigate(key)}>
8283
Open graph
8384
</Button>
84-
<Button
85-
variant="outlined"
86-
size="small"
87-
onClick={() => onConditionChange([{ key: 'id', type: 'id', value: point.id }], key === '' ? null : key)}
88-
>
89-
Find Similar
90-
</Button>
85+
{typeof onConditionChange !== 'function' ? null : (
86+
<Button
87+
variant="outlined"
88+
size="small"
89+
onClick={() =>
90+
onConditionChange([{ key: 'id', type: 'id', value: point.id }], key === '' ? null : key)
91+
}
92+
>
93+
Find Similar
94+
</Button>
95+
)}
9196
</Grid>
9297
</Grid>
9398
);
@@ -98,7 +103,7 @@ const Vectors = memo(function Vectors({ point, onConditionChange }) {
98103

99104
Vectors.propTypes = {
100105
point: PropTypes.object.isRequired,
101-
onConditionChange: PropTypes.func.isRequired,
106+
onConditionChange: PropTypes.func,
102107
};
103108

104109
export default Vectors;

0 commit comments

Comments
 (0)