|
@@ -1,5 +1,6 @@
|
|
|
-import { StatusEnum } from '../components/status/Types';
|
|
|
+import { ChildrenStatusType, StatusEnum } from '../components/status/Types';
|
|
|
import { CollectionView } from '../pages/collections/Types';
|
|
|
+import { IndexState } from '../types/Milvus';
|
|
|
import BaseModel from './BaseModel';
|
|
|
|
|
|
export class CollectionHttp extends BaseModel implements CollectionView {
|
|
@@ -7,8 +8,11 @@ export class CollectionHttp extends BaseModel implements CollectionView {
|
|
|
private collection_name!: string;
|
|
|
private description!: string;
|
|
|
private rowCount!: string;
|
|
|
+ private index_status!: string;
|
|
|
|
|
|
static COLLECTIONS_URL = '/collections';
|
|
|
+ static COLLECTIONS_INDEX_STATUS_URL = '/collections/indexes/status';
|
|
|
+
|
|
|
static CHECK_URL = '/milvus/check';
|
|
|
|
|
|
constructor(props: CollectionView) {
|
|
@@ -20,6 +24,13 @@ export class CollectionHttp extends BaseModel implements CollectionView {
|
|
|
return super.findAll({ path: this.COLLECTIONS_URL, params: {} });
|
|
|
}
|
|
|
|
|
|
+ static getCollectionsIndexState(): Promise<CollectionHttp[]> {
|
|
|
+ return super.findAll({
|
|
|
+ path: this.COLLECTIONS_INDEX_STATUS_URL,
|
|
|
+ params: {},
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
get _autoId() {
|
|
|
return this.autoID;
|
|
|
}
|
|
@@ -43,4 +54,15 @@ export class CollectionHttp extends BaseModel implements CollectionView {
|
|
|
get _status() {
|
|
|
return StatusEnum.loaded;
|
|
|
}
|
|
|
+
|
|
|
+ get _indexState() {
|
|
|
+ switch (this.index_status) {
|
|
|
+ case IndexState.InProgress:
|
|
|
+ return ChildrenStatusType.CREATING;
|
|
|
+ case IndexState.Failed:
|
|
|
+ return ChildrenStatusType.ERROR;
|
|
|
+ default:
|
|
|
+ return ChildrenStatusType.FINISH;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|