Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove flow #2028

Merged
merged 7 commits into from
Dec 5, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'master' into remove-flow
  • Loading branch information
emmatown authored Dec 3, 2019
commit 43fcb2edb01af7528385b6820c185a87049585db
21 changes: 13 additions & 8 deletions packages/fields/src/types/Integer/views/Controller.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import FieldController from '../../../Controller';

export default class TextController extends FieldController {
getFilterGraphQL = ({ type, value }) => {
const key = type === 'is' ? `${this.path}` : `${this.path}_${type}`;
return `${key}: ${value}`;
export default class IntegerController extends FieldController {
getFilterGraphQL = ({ path, type, value }) => {
const key = type === 'is' ? path : `${path}_${type}`;
let arg = value.replace(/\s/g, '');
if (['in', 'not_in'].includes(type)) {
arg = `[${arg}]`;
}
return `${key}: ${arg}`;
};
getFilterLabel = ({ label }) => {
return `${this.label} ${label.toLowerCase()}`;
getFilterLabel = ({ label, type }) => {
const suffix = ['in', 'not_in'].includes(type) ? ' (comma separated)' : '';
return `${this.label} ${label.toLowerCase()}${suffix}`;
};
formatFilter = ({ label, value }) => {
return `${this.getFilterLabel({ label })}: "${value}"`;
formatFilter = ({ label, type, value }) => {
return `${this.getFilterLabel({ label, type })}: "${value.replace(/\s/g, '')}"`;
};
serialize = data => {
const value = data[this.path];
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.