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

removes vis dependency from response handlers #22583

Merged
merged 9 commits into from
Sep 17, 2018

Conversation

ppisljar
Copy link
Member

@ppisljar ppisljar commented Aug 31, 2018

  • removes vis dependency from response handlers
  • makes tabify the output of courier request handler

preparation for #19813

qa: nothing should change functionally

@ppisljar ppisljar added WIP Work in progress Feature:Visualizations Generic visualization features (in case no more specific feature label is available) v7.0.0 v6.5.0 labels Aug 31, 2018
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@ppisljar ppisljar removed the WIP Work in progress label Sep 14, 2018
@ppisljar ppisljar added the WIP Work in progress label Sep 14, 2018
@elasticmachine
Copy link
Contributor

💔 Build Failed

@@ -100,6 +98,6 @@ export default function HistogramVisType(Private) {
])
},
hierarchicalData: true,
responseConverter: buildHierarchicalData,
responseHandler: 'vislib_slices',
Copy link
Member Author

Choose a reason for hiding this comment

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

vislib now registers two response handlers: vislib_slices and vislib_series ....
responseConverter was removed

import expect from 'expect.js';
import ngMock from 'ng_mock';
import { LegacyResponseHandlerProvider } from 'ui/vis/response_handlers/legacy';
import { VisProvider } from 'ui/vis';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import { AppStateProvider } from 'ui/state_management/app_state';
import { tabifyAggResponse } from '../../../../ui/public/agg_response/tabify';
Copy link
Member Author

Choose a reason for hiding this comment

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

in tests we used elasticsearch stubbed responses before, now we need to tabify them first.
this is far from ideal, but should be ok short term solution, as we plan to migrate our tests to the pipeline as soon as that is available.

Copy link
Member

Choose a reason for hiding this comment

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

can't we write this import as import { tabifyAggResponse } from 'ui/agg_response/tabify';?


return function (vis, esResponse) {
if (lastEsResponse === esResponse) {
Copy link
Member Author

Choose a reason for hiding this comment

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

this is handled on visualize_data_loader level, response handler (any) will not be called if input data did not change

@@ -155,20 +155,26 @@ const CourierRequestHandlerProvider = function () {

searchSource.finalResponse = resp;

searchSource.tabifiedResponse = tabifyAggResponse(aggs, resp, {
Copy link
Member Author

Choose a reason for hiding this comment

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

courier now returns tabified data

const LegacyResponseHandlerProvider = function () {

return {
name: 'legacy',
handler: function (vis, response) {
handler: function (table) {
Copy link
Member Author

Choose a reason for hiding this comment

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

response handlers accept only tabified data as an argument

Copy link
Contributor

Choose a reason for hiding this comment

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

You should also fix the typing in response_handler.d.ts to remove the vis param from it.

Copy link
Member Author

Choose a reason for hiding this comment

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

its already removed right ?

@elasticmachine
Copy link
Contributor

💔 Build Failed

@ppisljar ppisljar added the release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. label Sep 14, 2018
Copy link
Member

@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. nits: about the imports: sometimes absolute paths are more readable than relative paths specially if you are importing things from different separated modules.

import expect from 'expect.js';
import ngMock from 'ng_mock';
import { LegacyResponseHandlerProvider } from 'ui/vis/response_handlers/legacy';
import { VisProvider } from 'ui/vis';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import { AppStateProvider } from 'ui/state_management/app_state';
import { tabifyAggResponse } from '../../../../ui/public/agg_response/tabify';
Copy link
Member

Choose a reason for hiding this comment

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

can't we write this import as import { tabifyAggResponse } from 'ui/agg_response/tabify';?

lastGeoJsonResponse = convertToGeoJson(tabifiedResponse);

return lastGeoJsonResponse;
return convertToGeoJson(table);
Copy link
Member

Choose a reason for hiding this comment

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

what about rewriting this like

export function makeGeoJsonResponseHandler() {
  return convertToGeoJson;
}

@@ -24,13 +24,35 @@ import fixtures from 'fixtures/fake_hierarchical_data';
import { LegacyResponseHandlerProvider } from '../../vis/response_handlers/legacy';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import { VisProvider } from '../../vis';
import { tabifyAggResponse } from '../../agg_response/tabify';
Copy link
Member

Choose a reason for hiding this comment

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

can we use also here absolute paths from 'ui/agg_response/tabify?

Copy link
Member Author

Choose a reason for hiding this comment

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

nope, should use absolute paths inside the same module

@@ -26,6 +26,8 @@ import sinon from 'sinon';
import { LegacyResponseHandlerProvider } from '../../vis/response_handlers/legacy';
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
import { VisProvider } from '../../vis';
import { tabifyAggResponse } from '../../agg_response/tabify';
Copy link
Member

Choose a reason for hiding this comment

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

Same as comment above

@ppisljar ppisljar removed the WIP Work in progress label Sep 14, 2018
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💔 Build Failed

@ppisljar
Copy link
Member Author

retest

@elasticmachine
Copy link
Contributor

💔 Build Failed

@ppisljar
Copy link
Member Author

retest

@elasticmachine
Copy link
Contributor

💔 Build Failed

@ppisljar
Copy link
Member Author

retest

@elasticmachine
Copy link
Contributor

💔 Build Failed

@ppisljar ppisljar added review and removed WIP Work in progress labels Sep 17, 2018
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@timroes timroes 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 assumign tests pass. We already should cleanup courier request handler to build the isnpector response on top of tabify, but not in this PR

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@ppisljar ppisljar merged commit de345de into elastic:master Sep 17, 2018
@ppisljar ppisljar deleted the fix/courierTabifyJoin branch September 17, 2018 17:44
ppisljar added a commit to ppisljar/kibana that referenced this pull request Sep 17, 2018
@ppisljar ppisljar restored the fix/courierTabifyJoin branch September 26, 2018 10:02
@timroes timroes removed the release_note:plugin_api_changes Contains a Plugin API changes section for the breaking plugin API changes section. label Oct 23, 2018
@elasticmachine
Copy link
Contributor

💔 Build Failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Visualizations Generic visualization features (in case no more specific feature label is available) review v6.5.0 v7.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants