Browse Source

Merge pull request #35 from Tumao727/feature/release-partition

Add release partition
nameczz 4 years ago
parent
commit
e577adc8d2

+ 12 - 0
client/src/http/Partition.ts

@@ -51,6 +51,18 @@ export class PartitionHttp extends BaseModel implements PartitionView {
     });
   }
 
+  static releasePartition(param: PartitionParam) {
+    const { collectionName, partitionNames } = param;
+    const path = `${this.URL_BASE}/release`;
+    return super.update({
+      path,
+      data: {
+        collection_name: collectionName,
+        partition_names: partitionNames,
+      },
+    });
+  }
+
   get _id() {
     return this.id;
   }

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

@@ -93,7 +93,7 @@ const CreateCollection: FC<CollectionCreateProps> = ({ handleCreate }) => {
   const generalInfoConfigs: ITextfieldConfig[] = [
     {
       label: t('name'),
-      key: 'name',
+      key: 'collection_name',
       value: form.collection_name,
       onChange: (value: string) => handleInputChange('collection_name', value),
       variant: 'filled',

+ 10 - 1
client/src/pages/partitions/partitions.tsx

@@ -88,7 +88,16 @@ const Partitions: FC<{
     handleCloseDialog();
   };
 
-  const handleRelease = async (data: PartitionView) => {};
+  const handleRelease = async (data: PartitionView) => {
+    const param: PartitionParam = {
+      collectionName,
+      partitionNames: [data._name],
+    };
+    const res = await PartitionHttp.releasePartition(param);
+    openSnackBar(successTrans('release', { name: t('partition') }));
+    fetchPartitions(collectionName);
+    return res;
+  };
 
   const handleLoad = async (data: PartitionView) => {
     const param: PartitionParam = {