diff options
| author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-05-14 16:25:36 -0400 |
|---|---|---|
| committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-05-14 16:25:36 -0400 |
| commit | 04b650dee835be1a4446a2499b8acd525b92daf9 (patch) | |
| tree | 68a13507d13b45c5059120663e78127c7a45c2b7 /src/client/views/collections/collectionSchema/CollectionSchemaView.tsx | |
| parent | b27056fc67c654dea72338f928cd69026a501c0f (diff) | |
removed logs; added some comments; added safeguard against duplicate fields
Diffstat (limited to 'src/client/views/collections/collectionSchema/CollectionSchemaView.tsx')
| -rw-r--r-- | src/client/views/collections/collectionSchema/CollectionSchemaView.tsx | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx index 2d181a772..3d7c7882e 100644 --- a/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx +++ b/src/client/views/collections/collectionSchema/CollectionSchemaView.tsx @@ -275,9 +275,7 @@ export class CollectionSchemaView extends CollectionSubView() { changeColumnKey = (index: number, newKey: string, defaultVal?: any) => { if (!this.documentKeys.includes(newKey)) { this.addNewKey(newKey, defaultVal); - console.log("added") } - console.log("changed " + index) const currKeys = this.columnKeys.slice(); // copy the column key array first, then change it. currKeys[index] = newKey; @@ -308,6 +306,7 @@ export class CollectionSchemaView extends CollectionSubView() { }); } + // parses a field from the "idToDoc(####)" format to DocumentId (d#) format for readability cleanupComputedField = (field: string) => { const idPattern = /idToDoc\((.*?)\)/g; let modField = field.slice(); @@ -403,7 +402,7 @@ export class CollectionSchemaView extends CollectionSubView() { }; findColDropIndex = (mouseX: number) => { - let xOffset: number = this._props.ScreenToLocalTransform().inverse().transformPoint(0,0)[0] + CollectionSchemaView._rowMenuWidth; + let xOffset: number = this._props.ScreenToLocalTransform().inverse().transformPoint(0,0)[0] + CollectionSchemaView._rowMenuWidth; let index: number | undefined; this.displayColumnWidths.reduce((total, curr, i) => { if (total <= mouseX && total + curr >= mouseX) { @@ -466,7 +465,7 @@ export class CollectionSchemaView extends CollectionSubView() { const edgeStyle = i === index ? `solid 2px ${Colors.MEDIUM_BLUE}` : ''; const cellEles = [ colRef, - ...this.childDocs // + ...this.childDocs .filter(doc => i !== this._selectedCol || !this._selectedDocs.includes(doc)) .map(doc => this._rowEles.get(doc).children[1].children[i]), ]; @@ -714,7 +713,11 @@ export class CollectionSchemaView extends CollectionSubView() { @action setKey = (key: string, defaultVal?: any, index?: number) => { - console.log("setKey called with" + key) + if (this.columnKeys.includes(key)){ + this._newFieldWarning = 'Field already exists'; + return; + } + if (this._makeNewColumn) { this.addColumn(key, defaultVal); this._makeNewColumn = false; @@ -724,12 +727,7 @@ export class CollectionSchemaView extends CollectionSubView() { this.closeColumnMenu(); }; - setColumnValue = () => { - - } - setCellValues = (key: string, value: string) => { - console.log("field: " + key + " vale: " + value); const selectedDocs: Doc[] = []; this.childDocs.forEach(doc => { const docIsSelected = this._selectedCells && !(this._selectedCells?.filter(d => d === doc).length === 0); |
