Browse Source

add the consistenvy level column in collections list

iynewz 3 years ago
parent
commit
c9543d5639

+ 5 - 0
client/src/http/Collection.ts

@@ -18,6 +18,7 @@ export class CollectionHttp extends BaseModel implements CollectionView {
   private autoID!: string;
   private collection_name!: string;
   private description!: string;
+  private consistency_level!: string;
   private rowCount!: string;
   private index_status!: string;
   private id!: string;
@@ -151,6 +152,10 @@ export class CollectionHttp extends BaseModel implements CollectionView {
     // return LOADING_STATE.LOADING
   }
 
+  get _consistencyLevel() {
+    return this.consistency_level;
+  }
+
   get _fields() {
     return this.schema.fields.map(f => new FieldHttp(f));
   }

+ 12 - 6
client/src/pages/collections/Collections.tsx

@@ -190,12 +190,12 @@ const Collections = () => {
     data.fields = data.fields.map(v =>
       vectorType.includes(v.data_type)
         ? {
-          ...v,
-          type_params: {
-            // if data type is vector, dimension must exist.
-            dim: v.dimension!,
-          },
-        }
+            ...v,
+            type_params: {
+              // if data type is vector, dimension must exist.
+              dim: v.dimension!,
+            },
+          }
         : v
     );
 
@@ -362,6 +362,12 @@ const Collections = () => {
       sortBy: '_status',
       label: collectionTrans('status'),
     },
+    {
+      id: 'consistency_level',
+      align: 'left',
+      disablePadding: false,
+      label: collectionTrans('consistencyLevel'),
+    },
     {
       id: '_rowCount',
       align: 'left',

+ 1 - 0
client/src/pages/collections/Types.ts

@@ -12,6 +12,7 @@ export interface CollectionData {
   _desc: string;
   _indexState: ChildrenStatusType;
   _fields?: FieldData[];
+  _consistencyLevel?: string;
 }
 
 export interface CollectionView extends CollectionData {

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

@@ -140,7 +140,7 @@ export class CollectionsService {
 
   /**
    * Get all collections meta data
-   * @returns {id:string, collection_name:string, schema:Field[], autoID:boolean, rowCount: string}
+   * @returns {id:string, collection_name:string, schema:Field[], autoID:boolean, rowCount: string, consistency_level:string}
    */
   async getAllCollections() {
     const data = [];
@@ -185,6 +185,7 @@ export class CollectionsService {
           loadedPercentage,
           createdTime: parseInt(collectionInfo.created_utc_timestamp, 10),
           index_status: indexRes.state,
+          consistency_level: collectionInfo.consistency_level,
         });
       }
     }