Browse Source

fix create collection

nameczz 4 years ago
parent
commit
3617d71640

+ 4 - 1
client/src/pages/collections/Create.tsx

@@ -160,13 +160,16 @@ const CreateCollection: FC<CollectionCreateProps> = ({ handleCreate }) => {
     const param: CollectionCreateParam = {
       ...form,
       fields: fields.map(v => {
-        return {
+        const data: any = {
           name: v.name,
           description: v.description,
           is_primary_key: v.is_primary_key,
           data_type: v.data_type,
           dimension: vectorType.includes(v.data_type) ? v.dimension : undefined,
         };
+
+        v.is_primary_key && (data.autoID = form.autoID);
+        return data;
       }),
     };
     handleCreate(param);

+ 1 - 6
client/src/pages/connect/Connect.tsx

@@ -4,12 +4,7 @@ import { ITextfieldConfig } from '../../components/customInput/Types';
 import icons from '../../components/icons/Icons';
 import ConnectContainer from './ConnectContainer';
 import CustomInput from '../../components/customInput/CustomInput';
-import {
-  useContext,
-  // useEffect,
-  useMemo,
-  useState,
-} from 'react';
+import { useContext, useMemo, useState } from 'react';
 import { formatForm } from '../../utils/Form';
 import { useFormValidation } from '../../hooks/Form';
 import CustomButton from '../../components/customButton/CustomButton';

+ 1 - 1
server/package.json

@@ -32,7 +32,7 @@
     "@nestjs/websockets": "^8.0.4",
     "@types/passport-jwt": "^3.0.5",
     "@types/passport-local": "^1.0.33",
-    "@zilliz/milvus2-sdk-node": "^1.0.3",
+    "@zilliz/milvus2-sdk-node": "^1.0.4",
     "body-parser": "^1.19.0",
     "cache-manager": "^3.4.4",
     "class-transformer": "^0.4.0",

+ 11 - 3
server/src/collections/collections.controller.ts

@@ -29,18 +29,26 @@ import { cacheKeys } from '../cache/config';
 @ApiTags('collections')
 @Controller('collections')
 export class CollectionsController {
-  constructor(private collectionsService: CollectionsService, @Inject(CACHE_MANAGER) private cacheManager: Cache) { }
+  constructor(
+    private collectionsService: CollectionsService,
+    @Inject(CACHE_MANAGER) private cacheManager: Cache,
+  ) {}
 
   // manually control cache if logic is complicated
   @Get()
   async getCollections(@Query() data?: ShowCollections) {
     if (Number(data.type) === 1) {
-      let loadedCollections = await this.cacheManager.get(cacheKeys.LOADEDCOLLECTIONS);
+      let loadedCollections = await this.cacheManager.get(
+        cacheKeys.LOADEDCOLLECTIONS,
+      );
       if (loadedCollections) {
         return loadedCollections;
       }
       loadedCollections = await this.collectionsService.getLoadedColletions();
-      await this.cacheManager.set(cacheKeys.LOADEDCOLLECTIONS, loadedCollections);
+      await this.cacheManager.set(
+        cacheKeys.LOADEDCOLLECTIONS,
+        loadedCollections,
+      );
       return loadedCollections;
     }
     let allCollections = await this.cacheManager.get(cacheKeys.ALLCOLLECTIONS);

+ 1 - 0
server/src/collections/collections.service.ts

@@ -118,6 +118,7 @@ export class CollectionsService {
           rowCount: findKeyValue(collectionStatistics.stats, ROW_COUNT),
           id: collectionInfo.collectionID,
           isLoaded: loadedCollections.collection_names.includes(name),
+          createdTime: collectionInfo.created_utc_timestamp,
         });
       }
     }

+ 4 - 4
server/yarn.lock

@@ -1337,10 +1337,10 @@
   resolved "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.2.tgz#d291c6a4e97989b5c61d9acf396ae4fe133a718d"
   integrity sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==
 
-"@zilliz/milvus2-sdk-node@^1.0.3":
-  version "1.0.3"
-  resolved "https://registry.yarnpkg.com/@zilliz/milvus2-sdk-node/-/milvus2-sdk-node-1.0.3.tgz#909f1b44f5a7dedcfc3d075180f0273e8ace90f1"
-  integrity sha512-jAc/l7siEyNcDJ/WJ5tvbD/9bPMKXNWXCXaeUgLWLTitSrmjRLquhHKkf66OUU+rbEiDQw0l408jQyyY3CIZwA==
+"@zilliz/milvus2-sdk-node@^1.0.4":
+  version "1.0.4"
+  resolved "https://registry.yarnpkg.com/@zilliz/milvus2-sdk-node/-/milvus2-sdk-node-1.0.4.tgz#3e32edb5338abbcb710ea7da8b4e2ba2603fcea5"
+  integrity sha512-67KTHnZP1pLAGDct15XPZfUIHJy/4RPGcUQ3rAMepEj/4BmxCAL8rpRqThFL+UPJz4QYcphoqL5HQDNK59IH0A==
   dependencies:
     "@grpc/grpc-js" "^1.2.12"
     "@grpc/proto-loader" "^0.6.0"