Skip to content

Commit

Permalink
feat: Add Separate Panel for Points View to Mirror Graph Layout (#222)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
3 people authored Sep 19, 2024
1 parent 230842b commit 4827e5d
Show file tree
Hide file tree
Showing 14 changed files with 503 additions and 582 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const PointPreview = ({ point }) => {
const [loading] = React.useState(false);
const conditions = [];
const payloadSchema = {};
const onConditionChange = () => {};

if (!point) {
return null;
Expand Down Expand Up @@ -48,7 +47,6 @@ const PointPreview = ({ point }) => {
<Grid item xs={12} my={1}>
<DataGridList
data={{ id: point.id, ...point.payload }}
onConditionChange={onConditionChange}
conditions={conditions}
payloadSchema={payloadSchema}
/>
Expand All @@ -67,7 +65,7 @@ const PointPreview = ({ point }) => {
}}
/>
<CardContent>
<Vectors point={point} onConditionChange={onConditionChange} />
<Vectors point={point} />
</CardContent>
</>
)}
Expand Down
165 changes: 0 additions & 165 deletions src/components/FilterEditorWindow/config/RequestFromCode.js

This file was deleted.

16 changes: 15 additions & 1 deletion src/components/FilterEditorWindow/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useClient } from '../../context/client-context';
import { useTheme } from '@mui/material/styles';
import { autocomplete } from './config/Autocomplete';
import { useSnackbar } from 'notistack';
import { codeParse } from './config/RequestFromCode';
import { bigIntJSON } from '../../common/bigIntJSON';
import './editor.css';
import EditorCommon from '../EditorCommon';

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

function codeParse(codeText) {
// Parse JSON
if (codeText) {
try {
return bigIntJSON.parse(codeText);
} catch (e) {
return {
reqBody: codeText,
error: 'Fix the position brackets to run & check the json',
};
}
}
}

function onRun(codeText) {
const data = codeParse(codeText);
if (data.error) {
Expand Down
4 changes: 3 additions & 1 deletion src/components/Points/DataGridList.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ export const DataGridList = function ({ data = {}, specialCases = {}, onConditio
if (conditions.find((c) => c.key === filter.key && c.value === filter.value)) {
return;
}
onConditionChange([...conditions, filter]);
if (typeof onConditionChange === 'function') {
onConditionChange([...conditions, filter]);
}
}}
>
<FilterAltIcon />
Expand Down
21 changes: 13 additions & 8 deletions src/components/Points/PointVectors.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const Vectors = memo(function Vectors({ point, onConditionChange }) {

return (
<Box pt={2}>
Vectors:
{Object.keys(vectors).map((key) => {
return (
<Grid key={key} container spacing={2}>
Expand Down Expand Up @@ -81,13 +82,17 @@ const Vectors = memo(function Vectors({ point, onConditionChange }) {
<Button variant="outlined" size="small" onClick={() => handleNavigate(key)}>
Open graph
</Button>
<Button
variant="outlined"
size="small"
onClick={() => onConditionChange([{ key: 'id', type: 'id', value: point.id }], key === '' ? null : key)}
>
Find Similar
</Button>
{typeof onConditionChange !== 'function' ? null : (
<Button
variant="outlined"
size="small"
onClick={() =>
onConditionChange([{ key: 'id', type: 'id', value: point.id }], key === '' ? null : key)
}
>
Find Similar
</Button>
)}
</Grid>
</Grid>
);
Expand All @@ -98,7 +103,7 @@ const Vectors = memo(function Vectors({ point, onConditionChange }) {

Vectors.propTypes = {
point: PropTypes.object.isRequired,
onConditionChange: PropTypes.func.isRequired,
onConditionChange: PropTypes.func,
};

export default Vectors;
Loading

0 comments on commit 4827e5d

Please sign in to comment.