Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoindex & zilliz cloud #187

Merged
merged 8 commits into from
May 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ jobs:
with:
node-version: 14

- name: Run server tests
run: |
cd server
yarn install
yarn test:cov
# - name: Run server tests
# run: |
# cd server
# yarn install
# yarn test:cov

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
# public repo needn't pass token
# token: ${{ secrets.CODECOV_TOKEN }}
# only upload server test coverage
flags: server
# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v2
# with:
# # public repo needn't pass token
# # token: ${{ secrets.CODECOV_TOKEN }}
# # only upload server test coverage
# flags: server

- name: Login to DockerHub
uses: docker/login-action@v1
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

[![typescript](https://badges.aleen42.com/src/typescript.svg)](https://badges.aleen42.com/src/typescript.svg)
[![downloads](https://img.shields.io/docker/pulls/zilliz/attu)](https://img.shields.io/docker/pulls/zilliz/attu)
[![codecov](https://codecov.io/gh/zilliztech/attu/branch/main/graph/badge.svg?token=jvIEVF9IwW)](https://codecov.io/gh/zilliztech/attu)

Attu is an all-in-one milvus administration tool. With Attu, you can dramatically reduce the cost of managing milvus.

Expand Down
12 changes: 7 additions & 5 deletions client/src/consts/Milvus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ export type searchKeywordsType =
| 'ef'
| 'search_k'
| 'search_length'
| 'round_decimal';
| 'round_decimal'
| 'level';

export type indexConfigType = {
[x: string]: {
Expand Down Expand Up @@ -97,10 +98,10 @@ export const FLOAT_INDEX_CONFIG: indexConfigType = {
create: ['n_trees'],
search: ['search_k'],
},
// AUTOINDEX: {
// create: [],
// search: [],
// },
AUTOINDEX: {
create: [],
search: ['level'],
},
// RNSG: {
// create: ['out_degree', 'candidate_pool_size', 'search_length', 'knng'],
// search: ['search_length'],
Expand Down Expand Up @@ -208,6 +209,7 @@ export const DEFAULT_SEARCH_PARAM_VALUE_MAP: {
// range: [10, 300]
search_length: 10,
round_decimal: -1,
level: 1,
};

export const DEFAULT_NLIST_VALUE = 1024;
Expand Down
11 changes: 10 additions & 1 deletion client/src/context/Auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { AuthContextType } from './Types';
export const authContext = createContext<AuthContextType>({
isAuth: false,
address: '',
isManaged: false,
setAddress: () => {},
setIsAuth: () => {},
});
Expand Down Expand Up @@ -46,7 +47,15 @@ export const AuthProvider = (props: { children: React.ReactNode }) => {
}, [address]);

return (
<Provider value={{ isAuth, address, setAddress, setIsAuth }}>
<Provider
value={{
isAuth,
address,
setAddress,
setIsAuth,
isManaged: address.includes('vectordb.zillizcloud.com'),
}}
>
{props.children}
</Provider>
);
Expand Down
1 change: 1 addition & 0 deletions client/src/context/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export type OpenSnackBarType = (
export type AuthContextType = {
isAuth: boolean;
address: string;
isManaged: boolean;
setAddress: Dispatch<SetStateAction<string>>;
setIsAuth: Dispatch<SetStateAction<boolean>>;
};
Expand Down
6 changes: 3 additions & 3 deletions client/src/http/Collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import {
CollectionView,
DeleteEntitiesReq,
InsertDataParam,
LoadSampleParam,
LoadRelicaReq,
LoadReplicaReq,
Replica,
} from '../pages/collections/Types';
import { LoadSampleParam } from '../pages/dialogs/Types';
import { Field } from '../pages/schema/Types';
import { VectorSearchParam } from '../types/SearchTypes';
import { QueryParam } from '../pages/query/Types';
Expand Down Expand Up @@ -70,7 +70,7 @@ export class CollectionHttp extends BaseModel implements CollectionView {
return super.delete({ path: `${this.COLLECTIONS_URL}/${collectionName}` });
}

static loadCollection(collectionName: string, param?: LoadRelicaReq) {
static loadCollection(collectionName: string, param?: LoadReplicaReq) {
return super.update({
path: `${this.COLLECTIONS_URL}/${collectionName}/load`,
data: param,
Expand Down
9 changes: 8 additions & 1 deletion client/src/pages/collections/Collection.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useMemo } from 'react';
import { useMemo, useContext } from 'react';
import { useNavigate, useLocation, useParams } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { makeStyles, Theme } from '@material-ui/core';
import { authContext } from '../../context/Auth';
import { useNavigationHook } from '../../hooks/Navigation';
import { ALL_ROUTER_TYPES } from '../../router/Types';
import CustomTabList from '../../components/customTabList/CustomTabList';
Expand Down Expand Up @@ -34,6 +35,7 @@ const useStyles = makeStyles((theme: Theme) => ({

const Collection = () => {
const classes = useStyles();
const { isManaged } = useContext(authContext);

const { collectionName = '' } = useParams<{
collectionName: string;
Expand Down Expand Up @@ -77,6 +79,11 @@ const Collection = () => {
},
];

// exclude parititon on cloud
if (isManaged) {
tabs.splice(1, 1);
}

return (
<section className={`page-wrapper ${classes.wrapper}`}>
<CustomTabList
Expand Down
35 changes: 21 additions & 14 deletions client/src/pages/collections/Collections.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
import { Link, useSearchParams } from 'react-router-dom';
import { makeStyles, Theme } from '@material-ui/core';
import { useTranslation } from 'react-i18next';
import { authContext } from '../../context/Auth';
import { useNavigationHook } from '../../hooks/Navigation';
import { ALL_ROUTER_TYPES } from '../../router/Types';
import AttuGrid from '../../components/grid/Grid';
Expand Down Expand Up @@ -57,6 +58,8 @@ const useStyles = makeStyles((theme: Theme) => ({

const Collections = () => {
useNavigationHook(ALL_ROUTER_TYPES.COLLECTIONS);
const { isManaged } = useContext(authContext);

const [searchParams] = useSearchParams();
const [search, setSearch] = useState<string>(
(searchParams.get('search') as string) || ''
Expand Down Expand Up @@ -160,7 +163,7 @@ const Collections = () => {
fieldData: any[]
): Promise<{ result: boolean; msg: string }> => {
const param: InsertDataParam = {
partition_names: [partitionName],
partition_name: partitionName,
fields_data: fieldData,
};
try {
Expand Down Expand Up @@ -357,19 +360,7 @@ const Collections = () => {
</span>
),
},
{
id: '_aliasElement',
align: 'left',
disablePadding: false,
label: (
<span className="flex-center">
{collectionTrans('alias')}
<CustomToolTip title={collectionTrans('aliasInfo')}>
<InfoIcon classes={{ root: classes.icon }} />
</CustomToolTip>
</span>
),
},

{
id: 'consistency_level',
align: 'left',
Expand Down Expand Up @@ -475,6 +466,22 @@ const Collections = () => {
},
];

if (!isManaged) {
colDefinitions.splice(3, 0, {
id: '_aliasElement',
align: 'left',
disablePadding: false,
label: (
<span className="flex-center">
{collectionTrans('alias')}
<CustomToolTip title={collectionTrans('aliasInfo')}>
<InfoIcon classes={{ root: classes.icon }} />
</CustomToolTip>
</span>
),
});
}

const handleSelectChange = (value: any) => {
setSelectedCollections(value);
};
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/collections/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export interface AliasesProps {
onDelete?: Function;
}

export interface LoadRelicaReq {
export interface LoadReplicaReq {
replica_number: number;
}

Expand Down
5 changes: 4 additions & 1 deletion client/src/pages/dialogs/LoadCollectionDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
FormControlLabel,
} from '@material-ui/core';
import { useTranslation } from 'react-i18next';
import { authContext } from '../../context/Auth';
import { CollectionHttp } from '../../http/Collection';
import { rootContext } from '../../context/Root';
import { useFormValidation } from '../../hooks/Form';
Expand Down Expand Up @@ -49,6 +50,8 @@ const LoadCollectionDialog = (props: any) => {
const [form, setForm] = useState({
replica: 1,
});
const { isManaged } = useContext(authContext);

const [enableRelica, setEnableRelica] = useState(false);
const [replicaToggle, setReplicaToggle] = useState(false);
const [maxQueryNode, setMaxQueryNode] = useState(1);
Expand Down Expand Up @@ -77,7 +80,7 @@ const LoadCollectionDialog = (props: any) => {
MILVUS_DEPLOY_MODE.DISTRIBUTED;

// only show replica toggle in distributed mode && query node > 1
if (enableRelica && queryNodes.length > 1) {
if (enableRelica && queryNodes.length > 1 && !isManaged) {
setMaxQueryNode(queryNodes.length);
setEnableRelica(enableRelica);
}
Expand Down
35 changes: 19 additions & 16 deletions client/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const useStyles = makeStyles((theme: Theme) =>

function Index() {
const navigate = useNavigate();
const { isAuth } = useContext(authContext);
const { isAuth, isManaged } = useContext(authContext);
const { isPrometheusReady } = useContext(prometheusContext);
const { versionInfo } = useContext(rootContext);
const { t: navTrans } = useTranslation('nav');
Expand Down Expand Up @@ -90,23 +90,26 @@ function Index() {
iconActiveClass: 'normal',
iconNormalClass: 'active',
},
{
icon: icons.navSystem,
label: navTrans('system'),
onClick: () =>
isPrometheusReady
? navigate('/system_healthy')
: navigate('/system'),
iconActiveClass: 'normal',
iconNormalClass: 'active',
},
{
icon: icons.navPerson,
label: navTrans('user'),
onClick: () => navigate('/users'),
},
];

if (!isManaged) {
menuItems.push(
{
icon: icons.navSystem,
label: navTrans('system'),
onClick: () =>
isPrometheusReady ? navigate('/system_healthy') : navigate('/system'),
iconActiveClass: 'normal',
iconNormalClass: 'active',
},
{
icon: icons.navPerson,
label: navTrans('user'),
onClick: () => navigate('/users'),
}
);
}

// check if is connected
if (!isAuth) {
return <Navigate to="/connect" />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ const CollectionCard: FC<CollectionCardProps> = ({
<RightArrowIcon classes={{ root: classes.icon }} />
</Link>
<ul className={classes.content}>
{_replicas.length > 1 ? (
{_replicas && _replicas.length > 1 ? (
<li>
<Typography>{collectionTrans('replicaNum')}</Typography>:
<Typography className={classes.rowCount}>
Expand Down
4 changes: 3 additions & 1 deletion client/src/pages/schema/Types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { MetricType } from '../../consts/Milvus';
import { DataTypeStringEnum } from '../collections/Types';

export enum INDEX_TYPES_ENUM {
AUTO_INDEX = 'AUTO_INDEX',
IVF_FLAT = 'IVF_FLAT',
IVF_PQ = 'IVF_PQ',
IVF_SQ8 = 'IVF_SQ8',
Expand Down Expand Up @@ -68,7 +69,8 @@ export type IndexType =
| INDEX_TYPES_ENUM.BIN_IVF_FLAT
| INDEX_TYPES_ENUM.BIN_FLAT
| INDEX_TYPES_ENUM.MARISA_TRIE
| INDEX_TYPES_ENUM.SORT;
| INDEX_TYPES_ENUM.SORT
| INDEX_TYPES_ENUM.AUTO_INDEX;

export interface IndexManageParam {
collection_name: string;
Expand Down
11 changes: 11 additions & 0 deletions client/src/pages/search/SearchParams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,17 @@ const SearchParams: FC<SearchParamsProps> = ({
handleInputChange('ef', Number(value));
},
},
level: {
label: 'level',
key: 'level',
value: searchParamsForm['level'] || '',
min: 1,
max: 3,
isInt: true,
handleChange: value => {
handleInputChange('level', Number(value));
},
},
search_k: {
label: 'search_k',
key: 'search_k',
Expand Down
Loading