Browse Source

fix: align max input value with biggest size option in ImportSampleDialog

Signed-off-by: ryjiang <jiangruiyi@gmail.com>
ryjiang 2 weeks ago
parent
commit
3d33ff80b9
1 changed files with 6 additions and 3 deletions
  1. 6 3
      client/src/pages/dialogs/ImportSampleDialog.tsx

+ 6 - 3
client/src/pages/dialogs/ImportSampleDialog.tsx

@@ -195,7 +195,10 @@ const ImportSampleDialog: FC<{
               value={size}
               value={size}
               onChange={(event: any, newValue: string | null) => {
               onChange={(event: any, newValue: string | null) => {
                 if (newValue && /^\d+$/.test(newValue)) {
                 if (newValue && /^\d+$/.test(newValue)) {
-                  const val = Math.min(Number(newValue), biggestSize).toString();
+                  const val = Math.min(
+                    Number(newValue),
+                    biggestSize
+                  ).toString();
                   setSize(val);
                   setSize(val);
                   setCsvFileName(
                   setCsvFileName(
                     `${collection.collection_name}.sample.${val}.csv`
                     `${collection.collection_name}.sample.${val}.csv`
@@ -229,13 +232,13 @@ const ImportSampleDialog: FC<{
                     ...params.inputProps,
                     ...params.inputProps,
                     inputMode: 'numeric',
                     inputMode: 'numeric',
                     pattern: '[0-9]*',
                     pattern: '[0-9]*',
-                    max: 10000,
+                    max: biggestSize,
                   }}
                   }}
                   onInput={e => {
                   onInput={e => {
                     const input = e.target as HTMLInputElement;
                     const input = e.target as HTMLInputElement;
                     let val = input.value.replace(/[^0-9]/g, '');
                     let val = input.value.replace(/[^0-9]/g, '');
                     if (val) {
                     if (val) {
-                      val = Math.min(Number(val), 10000).toString();
+                      val = Math.min(Number(val), biggestSize).toString();
                     }
                     }
                     input.value = val;
                     input.value = val;
                   }}
                   }}