From c14fd88a0b2127c880e9f29bce494d1d4b29fdf9 Mon Sep 17 00:00:00 2001 From: kartik-gupta-ij Date: Tue, 3 Dec 2024 22:37:04 +0530 Subject: [PATCH 1/2] fix[visualize-tab] : disable visalize tab for sparse and multi vector on collections and view-point page --- .../Collections/CollectionsList.jsx | 17 +++++++++-- src/pages/Collection.jsx | 29 +++++++++++++++++-- 2 files changed, 41 insertions(+), 5 deletions(-) diff --git a/src/components/Collections/CollectionsList.jsx b/src/components/Collections/CollectionsList.jsx index 54033c04f..65c3b6465 100644 --- a/src/components/Collections/CollectionsList.jsx +++ b/src/components/Collections/CollectionsList.jsx @@ -20,6 +20,15 @@ const StyledLink = styled(Link)` const CollectionTableRow = ({ collection, getCollectionsCall }) => { const [openDeleteDialog, setOpenDeleteDialog] = useState(false); const theme = useTheme(); + const isDenseView = (vectors) => { + if (vectors && vectors.size && vectors.distance && !vectors.multivector_config) { + return true; + } + const vectorNames = Object.keys(vectors); + return vectorNames.some((vectorName) => { + return vectors[vectorName].size && vectors[vectorName].distance && !vectors[vectorName].multivector_config; + }); + }; return ( @@ -57,9 +66,11 @@ const CollectionTableRow = ({ collection, getCollectionsCall }) => { Take Snapshot - - Visualize - + {isDenseView(collection.config.params.vectors) ? ( + + Visualize + + ) : null} Graph diff --git a/src/pages/Collection.jsx b/src/pages/Collection.jsx index 70edaa44c..5545bf737 100644 --- a/src/pages/Collection.jsx +++ b/src/pages/Collection.jsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import { Link, useLocation, useNavigate, useParams } from 'react-router-dom'; import { Typography, Grid, Tabs, Tab } from '@mui/material'; import { CenteredFrame } from '../components/Common/CenteredFrame'; @@ -7,12 +7,32 @@ import { SnapshotsTab } from '../components/Snapshots/SnapshotsTab'; import CollectionInfo from '../components/Collections/CollectionInfo'; import PointsTabs from '../components/Points/PointsTabs'; import SearchQuality from '../components/Collections/SearchQuality/SearchQuality'; +import { useClient } from '../context/client-context'; function Collection() { const { collectionName } = useParams(); + const { client: qdrantClient } = useClient(); const navigate = useNavigate(); const location = useLocation(); const [currentTab, setCurrentTab] = useState(location.hash.slice(1) || 'points'); + const [isDense, setIsDense] = useState(false); + + useEffect(() => { + const checkDenseView = async () => { + const collectionData = await qdrantClient.getCollection(collectionName); + const vectors = collectionData.config.params.vectors; + if (vectors && vectors.size && vectors.distance && !vectors.multivector_config) { + setIsDense(true); + return; + } + const vectorNames = Object.keys(vectors); + const dense = vectorNames.some((vectorName) => { + return vectors[vectorName].size && vectors[vectorName].distance && !vectors[vectorName].multivector_config; + }); + setIsDense(dense); + }; + checkDenseView(); + }, [collectionName, qdrantClient]); const handleTabChange = (event, newValue) => { if (typeof newValue !== 'string') { @@ -36,7 +56,12 @@ function Collection() { - + From f063c43c0475e28d70d810f7323851b565dfec90 Mon Sep 17 00:00:00 2001 From: kartik-gupta-ij Date: Tue, 3 Dec 2024 22:40:38 +0530 Subject: [PATCH 2/2] fmt --- package-lock.json | 6 +++--- src/pages/Collection.jsx | 7 +------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index f4d31f6e7..aeb6dedea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3598,9 +3598,9 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "dependencies": { "path-key": "^3.1.0", diff --git a/src/pages/Collection.jsx b/src/pages/Collection.jsx index 5545bf737..94da1ae06 100644 --- a/src/pages/Collection.jsx +++ b/src/pages/Collection.jsx @@ -56,12 +56,7 @@ function Collection() { - +