NameableGraph is now a stateless component, with all its ephemeral state
held within Redux. This improves its testability, and two tests have
been added for the two needed Reducer cases.
Also, since NameableGraph's behavior is entirely controlled by its
props, the component itself can be tested, though this has not yet been
done.
Implicit returns are more concise here, and considered more idiomatic.
Also, async action creators have been collected together and moved
towards the end of the file for ease of navigation.
Previously, editing a cell name caused a PUT to the API for every
character typed by the user when renaming a cell. This was obviously not
ideal, but kept the initial implementation simple.
This limits PUTs to update cells to only when blur events happen on the
<input>. This is accomplished by maintaining the state of the input
field within the component and using a separate handler for the onBlur
to actually PUT the dashboard using a handler provided by the caller.
`l.name` was being copied from the cells provided by React Grid Layout,
which have no concept of name, which is why this was undefined. This
caused cells to be renamed '' whenever the layout changed or the page
was reloaded.
Cell renaming was previously done without using any of the existing
Redux logic. This goes against the ethos of the rest of the code used
for dashboards. This commit is an initial attempt to bring NameableGraph
into compliance with that.
This is an initial implementation of cell renaming on dashboards. It
maintains its state locally to the component and reuses the
onPositionChange handler provided by the DashboardPage container
component to persist changes to the cells.
Redux wasn't used in this implementation because it was something we
wanted to refactor into, which will happen in subsequent commits.
There is a known bug in this implementation where cell names are
overwritten with an empty string when the dashboard initially loads and
when the cell layout changes.