Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Trigger accounts/contracts search on search input change #2838

Merged
merged 8 commits into from
Oct 24, 2016

Conversation

ngotchac
Copy link
Contributor

Fixes #2766

Triggers the search in the Accounts/Contracts list views whenever the input changes
Adds a new token to the search with enter, space and comma
Re-styling of the search tokens

@ngotchac ngotchac added A0-pleasereview 🤓 Pull request needs code review. M5-ui labels Oct 24, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 86.169% when pulling 957b834 on ng-search-input-trigger into 8cf9934 on master.

@@ -27,6 +27,18 @@
width: 500px !important;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

For reference purposes: TeamWertarbyte/material-ui-chip-input#20 may be relevant.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right. In fact it's implemented, but not in the docs...

@@ -125,54 +125,56 @@ export default class ActionbarSearch extends Component {
handleTokenAdd = (value) => {
const { tokens } = this.props;

const newSearchValues = uniq([].concat(tokens, value));
const newSearchTokens = uniq([].concat(tokens, value));
Copy link
Contributor

Choose a reason for hiding this comment

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

tokens.concat(value)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's just in case tokens isn't really an Array, but I guess that's taken care of by the PropTypes Object

}

handleTokenDelete = (value) => {
const { tokens } = this.props;

const newSearchValues = []
const newSearchTokens = []
.concat(tokens)
.filter(v => v !== value);
Copy link
Contributor

Choose a reason for hiding this comment

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

newSearchTokens = tokens.filter((v) => v !== value)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as above

const newSearchValues = uniq([].concat(searchValues, token));
this.setState({ searchValues: newSearchValues });
const { searchTokens } = this.state;
const newSearchTokens = uniq([].concat(searchTokens, token));
Copy link
Contributor

Choose a reason for hiding this comment

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

searchValues.concat(token)?

const newSearchValues = uniq([].concat(searchValues, token));
this.setState({ searchValues: newSearchValues });
const { searchTokens } = this.state;
const newSearchTokens = uniq([].concat(searchTokens, token));
Copy link
Contributor

Choose a reason for hiding this comment

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

searchValues.concat(token)?

const newSearchValues = uniq([].concat(searchValues, token));
this.setState({ searchValues: newSearchValues });
const { searchTokens } = this.state;
const newSearchTokens = uniq([].concat(searchTokens, token));
Copy link
Contributor

Choose a reason for hiding this comment

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

searchValues.concat(token)?


const newSearchTokens = []
.concat(searchTokens || tokens)
.filter(v => v.length > 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

newSearchTokens = (searchTokens || tokens).filter(v => v.length > 0)?

@derhuerst
Copy link
Contributor

The behaviour (not having to press <Enter>) should be the same when adding tags in the "edit account" modal.

@derhuerst derhuerst added A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. and removed A0-pleasereview 🤓 Pull request needs code review. labels Oct 24, 2016
@ngotchac ngotchac added A0-pleasereview 🤓 Pull request needs code review. and removed A5-grumble 🔥 Pull request has minor issues that must be addressed before merging. labels Oct 24, 2016
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.02%) to 86.178% when pulling bc3319e on ng-search-input-trigger into 8cf9934 on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) to 86.148% when pulling bc3319e on ng-search-input-trigger into 8cf9934 on master.

@derhuerst derhuerst added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Oct 24, 2016
@gavofyork gavofyork merged commit 487da9c into master Oct 24, 2016
@gavofyork gavofyork deleted the ng-search-input-trigger branch October 24, 2016 14:35
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants