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

script field support, fix field formatters #33910

Conversation

tsullivan
Copy link
Member

@tsullivan tsullivan commented Mar 27, 2019

This adds support for CSV data columns that are represented by scripted fields in Kibana.

BEFORE:
image

AFTER:
image

It also leverages field formatters, which previously were in the code but not working.

@tsullivan tsullivan closed this Mar 27, 2019
@tsullivan tsullivan reopened this Mar 27, 2019
@tsullivan
Copy link
Member Author

Oops, meant to create this as a draft PR. Looks like you really can't do that after the PR is created.

@tsullivan tsullivan force-pushed the feature/reporting/csv-export-panel-action-script-fields-for-pr branch from 6abfd3f to 3e77cf5 Compare March 27, 2019 21:56
@tsullivan tsullivan changed the title Feature/reporting/csv export panel action script fields for pr script field support, fix field formatters Mar 27, 2019
@joelgriffith joelgriffith force-pushed the feature/reporting/csv-export-panel-action branch from f43ad9f to 34677f2 Compare March 28, 2019 20:10
@tsullivan tsullivan force-pushed the feature/reporting/csv-export-panel-action-script-fields-for-pr branch from d5656e8 to 4145f0d Compare March 28, 2019 20:34
@tsullivan tsullivan requested a review from joelgriffith March 28, 2019 20:37
@tsullivan tsullivan added review (Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead labels Mar 28, 2019
@elastic elastic deleted a comment from elasticmachine Mar 28, 2019
@elastic elastic deleted a comment from elasticmachine Mar 28, 2019
@elastic elastic deleted a comment from elasticmachine Mar 28, 2019
@elastic elastic deleted a comment from elasticmachine Mar 28, 2019
[key: string]: { id: string; params: { pattern: string } };
attributes: {
fieldFormatMap: string;
fields: string;
Copy link
Member Author

Choose a reason for hiding this comment

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

There was some structure tweaks to this type made, after realizing that buildEsQuery and getFieldFormatMap both require an index pattern object, but expect different structure :\

@@ -47,3 +46,5 @@ export default async function ({ readConfigFile }) {
esTestCluster: xPackFunctionalTestsConfig.get('esTestCluster'),
};
}

export default getApiIntegrationConfig;
Copy link
Member Author

Choose a reason for hiding this comment

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

Just a little trick I saw in another test file to get my test config to "extend" this one in an easier way.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@@ -6,6 +6,7 @@

import _ from 'lodash';

// FIXME shouldn't this really use a service provided by @kbn-es-query? The logic here can part from Discover
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: The logic here can part from Discover, for some reason I have a hard time reading this. Does this mean that the logic here can be separated from Discover? IE right now it's closely coupled to 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.

I'll fix the comment, but this is meaning that the logic can part ways with Discover, even though they do much of the same thing. That becomes the cause of bugs like #25068

Copy link
Contributor

@joelgriffith joelgriffith left a comment

Choose a reason for hiding this comment

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

Small nitpicks, otherwise looks good

@@ -132,6 +147,19 @@ export async function generateCsvSearch(
const esQueryConfig = await getEsQueryConfig(uiConfig);
const [sortField, sortOrder] = savedSearchObjectAttr.sort;

const scriptFields = indexPatternSavedObject.fields
.filter((f: IndexPatternField) => f.scripted === true)
Copy link
Contributor

Choose a reason for hiding this comment

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

.filter((f: IndexPatternField) => f.scripted)

@@ -42,19 +42,16 @@ export async function getDataSource(
}
}
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice cleanup here.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@joelgriffith
Copy link
Contributor

LGTM!

@tsullivan tsullivan merged commit 36ca761 into elastic:feature/reporting/csv-export-panel-action Apr 3, 2019
@tsullivan tsullivan deleted the feature/reporting/csv-export-panel-action-script-fields-for-pr branch April 3, 2019 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
(Deprecated) Feature:Reporting Use Reporting:Screenshot, Reporting:CSV, or Reporting:Framework instead review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants