Skip to content

Commit 456fa90

Browse files
authored
Replace axios with qdrant client in graph visualisation (#243)
* replace an axios request with usage of the js client for searching martix pairs * fix defaultProps deprication warning
1 parent b017060 commit 456fa90

File tree

7 files changed

+6684
-11576
lines changed

7 files changed

+6684
-11576
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"@mui/icons-material": "^5.11.11",
1313
"@mui/material": "^5.11.15",
1414
"@mui/x-data-grid": "^6.0.4",
15-
"@qdrant/js-client-rest": "^1.10.0",
15+
"@qdrant/js-client-rest": "^1.12.0",
1616
"@saehrimnir/druidjs": "^0.6.3",
1717
"@testing-library/jest-dom": "^5.16.5",
1818
"@testing-library/react": "^13.4.0",

src/components/Collections/CollectionCluster/ClusterInfo.jsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import ClusterInfoHead from './ClusterInfoHead';
66
import ClusterShardRow from './ClusterShardRow';
77
import { bigIntJSON } from '../../../common/bigIntJSON';
88

9-
const ClusterInfo = ({ collectionCluster, ...other }) => {
9+
const ClusterInfo = ({ collectionCluster = { result: {} }, ...other }) => {
1010
const shards = [
1111
...(collectionCluster.result?.local_shards || []),
1212
...(collectionCluster.result?.remote_shards || []),
@@ -38,12 +38,6 @@ const ClusterInfo = ({ collectionCluster, ...other }) => {
3838
);
3939
};
4040

41-
ClusterInfo.defaultProps = {
42-
collectionCluster: {
43-
result: {},
44-
},
45-
};
46-
4741
ClusterInfo.propTypes = {
4842
collectionCluster: PropTypes.shape({
4943
result: PropTypes.shape({

src/components/Common/CopyButton.jsx

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ import { CopyAll } from '@mui/icons-material';
55
import { useSnackbar } from 'notistack';
66
import { getSnackbarOptions } from './utils/snackbarOptions';
77

8-
export const CopyButton = ({ text, tooltip, tooltipPlacement, successMessage }) => {
8+
export const CopyButton = ({
9+
text,
10+
tooltip = 'Copy to clipboard',
11+
tooltipPlacement = 'left',
12+
successMessage = 'Copied to clipboard',
13+
}) => {
914
const { enqueueSnackbar, closeSnackbar } = useSnackbar();
1015
const successSnackbarOptions = getSnackbarOptions('success', closeSnackbar, 1000);
1116
const errorSnackbarOptions = getSnackbarOptions('error', closeSnackbar);
@@ -31,12 +36,6 @@ export const CopyButton = ({ text, tooltip, tooltipPlacement, successMessage })
3136
);
3237
};
3338

34-
CopyButton.defaultProps = {
35-
tooltip: 'Copy to clipboard',
36-
tooltipPlacement: 'left',
37-
successMessage: 'Copied to clipboard',
38-
};
39-
4039
CopyButton.propTypes = {
4140
text: PropTypes.string.isRequired,
4241
tooltip: PropTypes.string,

src/components/Points/DataGridList.jsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,6 @@ export const DataGridList = function ({ data = {}, specialCases = {}, onConditio
102102
});
103103
};
104104

105-
DataGridList.defaultProps = {
106-
data: {},
107-
specialCases: {},
108-
};
109-
110105
DataGridList.propTypes = {
111106
data: PropTypes.object.isRequired,
112107
specialCases: PropTypes.shape({

src/lib/graph-visualization-helpers.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { axiosInstance } from '../common/axios';
2-
31
export const initGraph = async (
42
qdrantClient,
53
{ collectionName, initNode, limit, filter, using, sampleLinks, tree = false }
@@ -79,21 +77,15 @@ const getPointsWithPayload = async (qdrantClient, { collectionName, pointIds })
7977
return points;
8078
};
8179

82-
export const getSamplePoints = async ({ collectionName, filter, sample, using, limit }) => {
83-
// ToDo: replace it with qdrantClient when it will be implemented
84-
85-
const response = await axiosInstance({
86-
method: 'POST',
87-
url: `collections/${collectionName}/points/search/matrix/pairs`,
88-
data: {
89-
filter,
90-
sample,
91-
using,
92-
limit,
93-
},
80+
export const getSamplePoints = async (qdrantClient, { collectionName, filter, sample, using, limit }) => {
81+
const response = await qdrantClient.searchMatrixPairs(collectionName, {
82+
filter,
83+
sample,
84+
using,
85+
limit,
9486
});
9587

96-
return response.data.result.pairs;
88+
return response.pairs;
9789
};
9890

9991
export const deduplicatePoints = (existingPoints, foundPoints) => {

src/pages/Graph.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function Graph() {
9898
// scroll
9999
try {
100100
if (data.sample) {
101-
const sampleLinks = await getSamplePoints({
101+
const sampleLinks = await getSamplePoints(qdrantClient, {
102102
collectionName: collectionName,
103103
...data,
104104
});

0 commit comments

Comments
 (0)