implement "convert to boolean/number/string" in new data browser [axot: 71]#10734
Conversation
| <a onClick={() => this.coerceColumn('boolean')}> | ||
| Convert to boolean | ||
| </a> | ||
| </li> |
There was a problem hiding this comment.
i wonder if getDropdownMenu should instead just be its own react component?
There was a problem hiding this comment.
By having these functions defined in the onClick, we'll create a new function (or a bunch of new functions) every time we re-render. It might be more performant to instead call a method on the class (i.e. onClick={this.coerceColumnString}) tho it's also quite likely that this is an unnecessary performance optimization.
There was a problem hiding this comment.
Also, should we be using the ColumnType enum that gets defined elsewhere?
| if (val === false || val === 'false') { | ||
| return false; | ||
| } | ||
| throw new Error('Unable to convert to boolean'); |
There was a problem hiding this comment.
Might be worth a couple quick unit tests for these utils
| <a onClick={() => this.coerceColumn('boolean')}> | ||
| Convert to boolean | ||
| </a> | ||
| </li> |
There was a problem hiding this comment.
Also, should we be using the ColumnType enum that gets defined elsewhere?
Conflicts: apps/src/applab/dataBrowser/dataUtils.js
axosoft item: https://codeorg.axosoft.com/viewitem?id=71&type=features&force_use_number=true
pointer to dynamodb implementation:
https://github.com/code-dot-org/code-dot-org/blob/staging/shared/middleware/helpers/table_coerce.rb
screencast:
