aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/collectionSchema/SchemaTable.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2021-10-04 21:21:55 -0400
committerbobzel <zzzman@gmail.com>2021-10-04 21:21:55 -0400
commitfc679d849ae8afa3ef66e4e0b2b2b816e1fb41d4 (patch)
treee7822c582049252c99c372f1fda8e4b31fa0303b /src/client/views/collections/collectionSchema/SchemaTable.tsx
parent76b833efe198a672795f61ee7a4b8d8cd6d5dd49 (diff)
fixed how filters work in Schema View. made filtering the default for clicking in title area.
Diffstat (limited to 'src/client/views/collections/collectionSchema/SchemaTable.tsx')
-rw-r--r--src/client/views/collections/collectionSchema/SchemaTable.tsx14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/client/views/collections/collectionSchema/SchemaTable.tsx b/src/client/views/collections/collectionSchema/SchemaTable.tsx
index d157832d9..bc5a9559f 100644
--- a/src/client/views/collections/collectionSchema/SchemaTable.tsx
+++ b/src/client/views/collections/collectionSchema/SchemaTable.tsx
@@ -1,7 +1,7 @@
import React = require("react");
import { IconProp } from '@fortawesome/fontawesome-svg-core';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
-import { action, computed, observable } from "mobx";
+import { action, computed, observable, trace } from "mobx";
import { observer } from "mobx-react";
import ReactTable, { CellInfo, Column, ComponentPropsGetterR, Resize, SortingRule } from "react-table";
import "react-table/react-table.css";
@@ -386,13 +386,13 @@ export class SchemaTable extends React.Component<SchemaTableProps> {
@undoBatch
@action
createColumn = () => {
- let index = 0;
- let found = this.props.columns.findIndex(col => col.heading.toUpperCase() === "New field".toUpperCase()) > -1;
- while (found) {
- index++;
- found = this.props.columns.findIndex(col => col.heading.toUpperCase() === ("New field (" + index + ")").toUpperCase()) > -1;
+ const newFieldName = (index: number) => `New field${index ? ` (${index})` : ""}`;
+ for (let index = 0; index < 100; index++) {
+ if (this.props.columns.findIndex(col => col.heading === newFieldName(index)) === -1) {
+ this.props.columns.push(new SchemaHeaderField(newFieldName(index), "#f1efeb"));
+ break;
+ }
}
- this.props.columns.push(new SchemaHeaderField(`New field ${index ? "(" + index + ")" : ""}`, "#f1efeb"));
}
@action