Browse Source

fix UI error

Signed-off-by: ryjiang <jiangruiyi@gmail.com>
ryjiang 1 year ago
parent
commit
609769fd0c
2 changed files with 48 additions and 46 deletions
  1. 2 2
      client/src/components/grid/Table.tsx
  2. 46 44
      client/src/pages/collections/Collections.tsx

+ 2 - 2
client/src/components/grid/Table.tsx

@@ -146,7 +146,7 @@ const EnhancedTable: FC<TableType> = props => {
   const calculateRowCountAndPageSize = () => {
     if (containerRef.current && rowHeight > 0) {
       const containerHeight: number = containerRef.current.offsetHeight;
-      const rowCount = Math.floor(
+      const rowCount = Math.ceil(
         (containerHeight -
           tableHeaderHeight -
           (showPagination ? pagerHeight : 0)) /
@@ -269,7 +269,7 @@ const EnhancedTable: FC<TableType> = props => {
                             style={cellStyle}
                           >
                             <div className={classes.cellContainer}>
-                              {row[colDef.id] && (
+                              {typeof row[colDef.id] !== 'undefined' && (
                                 <>
                                   {colDef.onClick ? (
                                     <Button

+ 46 - 44
client/src/pages/collections/Collections.tsx

@@ -188,49 +188,6 @@ const Collections = () => {
             </Tooltip>
           </>
         ),
-        statusElement: (
-          <StatusAction
-            status={v.status}
-            onIndexCreate={fetchData}
-            percentage={v.loadedPercentage}
-            field={getVectorField(v)!}
-            collectionName={v.collectionName}
-            action={() => {
-              setDialog({
-                open: true,
-                type: 'custom',
-                params: {
-                  component:
-                    v.status === LOADING_STATE.UNLOADED ? (
-                      <LoadCollectionDialog
-                        collection={v.collectionName}
-                        onLoad={async () => {
-                          openSnackBar(
-                            successTrans('load', {
-                              name: collectionTrans('collection'),
-                            })
-                          );
-                          await fetchData();
-                        }}
-                      />
-                    ) : (
-                      <ReleaseCollectionDialog
-                        collection={v.collectionName}
-                        onRelease={async () => {
-                          openSnackBar(
-                            successTrans('release', {
-                              name: collectionTrans('collection'),
-                            })
-                          );
-                          await fetchData();
-                        }}
-                      />
-                    ),
-                },
-              });
-            }}
-          />
-        ),
         _aliasElement: (
           <Aliases
             aliases={v.aliases}
@@ -459,11 +416,56 @@ const Collections = () => {
       label: collectionTrans('name'),
     },
     {
-      id: 'statusElement',
+      id: 'status',
       align: 'left',
       disablePadding: false,
       sortBy: 'status',
       label: collectionTrans('status'),
+      formatter(v) {
+        return (
+          <StatusAction
+            status={v.status}
+            onIndexCreate={fetchData}
+            percentage={v.loadedPercentage}
+            field={getVectorField(v)!}
+            collectionName={v.collectionName}
+            action={() => {
+              setDialog({
+                open: true,
+                type: 'custom',
+                params: {
+                  component:
+                    v.status === LOADING_STATE.UNLOADED ? (
+                      <LoadCollectionDialog
+                        collection={v.collectionName}
+                        onLoad={async () => {
+                          openSnackBar(
+                            successTrans('load', {
+                              name: collectionTrans('collection'),
+                            })
+                          );
+                          await fetchData();
+                        }}
+                      />
+                    ) : (
+                      <ReleaseCollectionDialog
+                        collection={v.collectionName}
+                        onRelease={async () => {
+                          openSnackBar(
+                            successTrans('release', {
+                              name: collectionTrans('collection'),
+                            })
+                          );
+                          await fetchData();
+                        }}
+                      />
+                    ),
+                },
+              });
+            }}
+          />
+        );
+      },
     },
     {
       id: 'features',