Skip to content

implement add / rename / delete column in data browser [axot: 51]#9685

Merged
davidsbailey merged 12 commits into
stagingfrom
data-column-mutations
Jul 26, 2016
Merged

implement add / rename / delete column in data browser [axot: 51]#9685
davidsbailey merged 12 commits into
stagingfrom
data-column-mutations

Conversation

@davidsbailey

@davidsbailey davidsbailey commented Jul 24, 2016

Copy link
Copy Markdown
Member

@davidsbailey davidsbailey force-pushed the data-column-mutations branch 5 times, most recently from 037fa4d to 2fc6257 Compare July 25, 2016 19:20
@davidsbailey davidsbailey force-pushed the data-column-mutations branch from 2fc6257 to cecb83a Compare July 25, 2016 19:22
@davidsbailey davidsbailey changed the title wip - Data column mutations implement add / rename / delete column in data browser Jul 25, 2016
@davidsbailey

Copy link
Copy Markdown
Member Author

Hey @islemaster , would you mind taking a look at some of the latest data browser changes? I'm happy to give you an overview before you dive in if that would be helpful.

@davidsbailey davidsbailey force-pushed the data-column-mutations branch from 713dfe5 to 5ac6ca8 Compare July 25, 2016 22:19
@davidsbailey davidsbailey changed the title implement add / rename / delete column in data browser implement add / rename / delete column in data browser [axot 51] Jul 25, 2016
@davidsbailey davidsbailey changed the title implement add / rename / delete column in data browser [axot 51] implement add / rename / delete column in data browser [axot: 51] Jul 25, 2016
@davidsbailey davidsbailey force-pushed the data-column-mutations branch from 5ac6ca8 to 6af308e Compare July 25, 2016 22:24
);
}
});
export default Radium(AddColumnButton);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we expect this add button to change much? If not, I think there's a more idiomatic way to define it. You're not actually using Radium or redux, the whole thing is stateless, etc. Any reason it shouldn't just be expressed this way?

import React from 'react';
import {button as buttonStyle} from './dataStyles';

const containerStyle = {
  float: 'right',
  paddingTop: 10,
  paddingLeft: 10,
  paddingBottom: 10,
  paddingRight: 0
};

export default function AddColumnButton(props) {
  return (
    <div style={containerStyle}>
      <button className="btn" onClick={props.addColumn} style={dataStyles.button}>
        Add column
      </button>
    </div>
  );
}

AddColumnButton.propTypes = {
  addColumn: React.PropTypes.func.isRequired
};

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Brad, I agree that this react class is a little light right now. However, the next feature on my plate is to add Import, Export and Delete buttons to this same row, and I had secretly been planning to rename this class to contain the entire top row of buttons (import, export, add column, delete table):
screen shot 2016-07-25 at 4 04 57 pm

I've renamed the file and removed some cruft.


componentDidMount() {
if (this.props.isEditing) {
ReactDOM.findDOMNode(this.refs.input).select();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this.refs.input is a DOM component and not a composite component, ReactDOM.findDOMNode isn't necessary here (as of React 0.14.0).

Also, string refs are considered legacy; our styleguide hasn't deprecated them yet, but did you consider callback refs?

@islemaster

Copy link
Copy Markdown
Contributor

This looks great Dave! Nice clean implementation.

It looks like you're way past this being useful, but it might be good reference: I'm trying to use Reactabular.js for the NetSim Log Table. Even so I'm wrestling with some layout stuff; maybe you can review it when it's ready?

The stateful editing stuff in ColumnHeader might be complex enough to merit a unit test.

Overall LGTM though. Nice work!

@davidsbailey

Copy link
Copy Markdown
Member Author

Thanks for the detailed review, Brad! It's great to learn about some of these best practices. I've addressed all feedback in code unless noted otherwise comments here.

I'd be happy to review the Reactabular change -- I haven't invested too much in HTML tables here, so it'll be a good way to get a sense of whether it'll be useful for me here when I go to implement sorting and such.

@davidsbailey

Copy link
Copy Markdown
Member Author

Agreed the column header state needs tests -- noted in https://codeorg.axosoft.com/viewitem?id=59&type=features&force_use_number=true .

@davidsbailey davidsbailey merged commit 75e13ed into staging Jul 26, 2016
@davidsbailey davidsbailey deleted the data-column-mutations branch July 26, 2016 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants