aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0x85FB9C51 <77808164+0x85FB9C51@users.noreply.github.com>2021-07-21 16:10:04 -0400
committer0x85FB9C51 <77808164+0x85FB9C51@users.noreply.github.com>2021-07-21 16:10:04 -0400
commitee0e2c6c53db65c5524b67ed09369cc0e0e6f173 (patch)
treeb8ab0872ae17e05fef94e9798e21aef8b00b3ba3
parent02c5628bdaf43100a6e40baab781342bc27df464 (diff)
Fixed minor bugs
-rw-r--r--src/client/views/collections/collectionSchema/CollectionSchemaCells.tsx27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaCells.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaCells.tsx
index 8b7fb9be8..f7dfaaeb4 100644
--- a/src/client/views/collections/collectionSchema/CollectionSchemaCells.tsx
+++ b/src/client/views/collections/collectionSchema/CollectionSchemaCells.tsx
@@ -300,8 +300,16 @@ export class CollectionSchemaCell extends React.Component<CellProps> {
inputIsNum = false;
}
}
+
+ let contentsAreNum = true;
+ for (let s of contents) {
+ if (isNaN(parseInt(s)) && !(s == ".") && !(s == ",")) {
+ contentsAreNum = false;
+ }
+ }
// check if the input is a boolean
let inputIsBool: boolean = value == "false" || value == "true";
+ let contentsAreBool: boolean = contents == "false" || contents == "true";
if (type == undefined) {
// what to do in the case
@@ -317,12 +325,23 @@ export class CollectionSchemaCell extends React.Component<CellProps> {
} else if (inputIsBool) {
boolInput(value, retVal);
}
+ // if the cell type is a string
} else if (type == "string") {
stringInput(value, retVal);
- } else if (type == "number" && inputIsNum) {
- numberInput(value, retVal);
- } else if (type == "boolean" && inputIsBool) {
- boolInput(value, retVal);
+ // if the cell type is a number
+ } else if (type == "number") {
+ if (inputIsNum) {
+ numberInput(value, retVal);
+ } else if (!contentsAreNum) {
+ stringInput("", retVal);
+ }
+ // if the cell type is a boolean
+ } else if (type == "boolean") {
+ if (inputIsBool) {
+ boolInput(value, retVal);
+ } else if (!contentsAreBool) {
+ stringInput("", retVal);
+ }
}
}
if (retVal) {