Skip to content

changing vis.API.events#25280

Merged
ppisljar merged 3 commits intoelastic:masterfrom
ppisljar:ref/filteringEmbeddable
Nov 16, 2018
Merged

changing vis.API.events#25280
ppisljar merged 3 commits intoelastic:masterfrom
ppisljar:ref/filteringEmbeddable

Conversation

@ppisljar
Copy link
Copy Markdown
Contributor

@ppisljar ppisljar commented Nov 7, 2018

Summary

Moves filtering functions out of Vis.

preparation for #23185

QA: no functional canges

Dev-Docs

filtering inside your visualization will need to be updated

vis.API.events.addFilter no longer exists, instead you should rather call vis.API.events.filter({ table, column, row, value })

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

@ppisljar ppisljar added the WIP Work in progress label Nov 7, 2018
@ppisljar ppisljar changed the title [WIP] moving filtering out of Vis [WIP] changing vis.API.events Nov 7, 2018
@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@ppisljar ppisljar force-pushed the ref/filteringEmbeddable branch from 76bd2dd to af833ed Compare November 7, 2018 13:15
@ppisljar ppisljar changed the title [WIP] changing vis.API.events changing vis.API.events Nov 7, 2018
@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine
Copy link
Copy Markdown
Contributor

💔 Build Failed

@ppisljar ppisljar force-pushed the ref/filteringEmbeddable branch from ed27206 to fa8dec9 Compare November 8, 2018 06:41
@ppisljar ppisljar added review v7.0.0 v6.6.0 Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// and removed WIP Work in progress labels Nov 8, 2018
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/kibana-app

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Copy link
Copy Markdown
Contributor

@markov00 markov00 left a comment

Choose a reason for hiding this comment

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

Code LGTM. Some minor comments.
Tested on chrome/osx using brushes and filters

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.

nit: Can we remove this visualization default? We already have a check on opts thats trows an exception if visualization is a falsy value.

What about checking if the visualization object has the required methods?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no idea why this shows as added code .... it was just indented

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.

nit: What about having the stage default as lab, so we don't accidentally create a production vis?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no idea why this shows as added code .... it was just indented

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.

nit: What about move these strings to an enum similar to:

const STAGE_TYPES = {
  LAB: 'lab',
  EXPERIMENTAL: 'experimental',
  PRODUCTION: 'production',
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

no idea why this shows as added code .... it was just indented

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.

q: do we enforce actions to be functions somewhere?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

we don't, we need to better type this

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.

I'm a bit confused what is the right one, this:

vis.API.events.addFilter no longer exists, instead you should rather call vis.API.events.filter({ table, column, row, value })

or

the filter method will be removed in the near feature you should rather use addFilter method below

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ha :) i need to remove that comment

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.

nit: Is there a reason to use arrow function here? can't we use named functions?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

is there a reason not to use arrow functions ?

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.

touché

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.

nit: can we get rid of lodash here? Object.keys(this.vis.type.events).forEach

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.

To naming this consistently it's better to rewrite this as:

filter: data => this.eventsSubject.next({ name: 'filterBucket', data }),
brush: data => this.eventsSubject.next({ name: 'brush', data }),

So your event is an object with {name, data} as it's used on the subscriptions

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

Copy link
Copy Markdown
Contributor

@lukeelmers lukeelmers left a comment

Choose a reason for hiding this comment

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

Code LGTM. Pulled down and tested, no apparent functional issues.

@ppisljar ppisljar force-pushed the ref/filteringEmbeddable branch from 4b1b834 to 88e6af8 Compare November 16, 2018 11:40
@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

@ppisljar ppisljar merged commit 6dd2c1c into elastic:master Nov 16, 2018
@ppisljar ppisljar deleted the ref/filteringEmbeddable branch November 16, 2018 14:00
ppisljar added a commit to ppisljar/kibana that referenced this pull request Nov 16, 2018
ppisljar added a commit that referenced this pull request Nov 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature:ExpressionLanguage Interpreter expression language (aka canvas pipeline) review Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v6.6.0 v7.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants