2
0
Эх сурвалжийг харах

Merge pull request #183 from nameczz/main

add partition time and fix created time
ryjiang 3 жил өмнө
parent
commit
d8799cfc5e

+ 3 - 1
client/src/http/Collection.ts

@@ -129,8 +129,10 @@ export class CollectionHttp extends BaseModel implements CollectionView {
     }
   }
 
+  // Befor milvus-2.0-rc3  will return '0'.
+  // If milvus is stable, we can remote this condition/
   get _createdTime(): string {
-    return this.createdTime
+    return this.createdTime && this.createdTime !== '0'
       ? dayjs(Number(this.createdTime)).format('YYYY-MM-DD HH:mm:ss')
       : '';
   }

+ 10 - 1
client/src/http/Partition.ts

@@ -1,3 +1,4 @@
+import dayjs from 'dayjs';
 import { StatusEnum } from '../components/status/Types';
 import {
   PartitionManageParam,
@@ -11,7 +12,7 @@ export class PartitionHttp extends BaseModel implements PartitionData {
   private id!: string;
   private name!: string;
   private rowCount!: string;
-  private status!: StatusEnum;
+  private createdTime!: string;
 
   constructor(props: {}) {
     super(props);
@@ -83,4 +84,12 @@ export class PartitionHttp extends BaseModel implements PartitionData {
     // @TODO replace mock data
     return StatusEnum.unloaded;
   }
+
+  // Befor milvus-2.0-rc3  will return '0'.
+  // If milvus is stable, we can remote this condition/
+  get _createdTime(): string {
+    return this.createdTime && this.createdTime !== '0'
+      ? dayjs(Number(this.createdTime)).format('YYYY-MM-DD HH:mm:ss')
+      : '';
+  }
 }

+ 1 - 0
client/src/i18n/cn/partition.ts

@@ -6,6 +6,7 @@ const partitionTrans = {
 
   id: 'ID',
   name: 'Name',
+  createdTime: 'Created Time',
   status: 'Status',
   rowCount: 'Entity Count',
   tooltip: 'data in one entity',

+ 1 - 0
client/src/i18n/en/partition.ts

@@ -6,6 +6,7 @@ const partitionTrans = {
 
   id: 'ID',
   name: 'Name',
+  createdTime: 'Created Time',
   status: 'Status',
   rowCount: 'Entity Count',
   tooltip: 'data in one entity',

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

@@ -323,12 +323,6 @@ const Collections = () => {
   ];
 
   const colDefinitions: ColDefinitionsType[] = [
-    {
-      id: '_id',
-      align: 'left',
-      disablePadding: true,
-      label: collectionTrans('id'),
-    },
     {
       id: 'nameElement',
       align: 'left',

+ 5 - 5
client/src/pages/partitions/Partitions.tsx

@@ -301,16 +301,16 @@ const Partitions: FC<{
 
   const colDefinitions: ColDefinitionsType[] = [
     {
-      id: '_id',
+      id: '_nameElement',
       align: 'left',
-      disablePadding: true,
-      label: t('id'),
+      disablePadding: false,
+      label: t('name'),
     },
     {
-      id: '_nameElement',
+      id: '_createdTime',
       align: 'left',
       disablePadding: false,
-      label: t('name'),
+      label: t('createdTime'),
     },
     // {
     //   id: '_statusElement',

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

@@ -14,7 +14,7 @@ import { ROW_COUNT } from '../utils/Const';
 
 @Injectable()
 export class PartitionsService {
-  constructor(private milvusService: MilvusService) { }
+  constructor(private milvusService: MilvusService) {}
 
   get milvusClient() {
     return this.milvusService.milvusClientGetter;
@@ -33,6 +33,7 @@ export class PartitionsService {
           name,
           id: res.partitionIDs[index],
           rowCount: findKeyValue(statistics.stats, ROW_COUNT),
+          createdTime: res.created_utc_timestamps[index],
         });
       }
     }