Skip to content

Conversation

@alexwizp
Copy link
Contributor

@alexwizp alexwizp commented Dec 1, 2020

Closes: #84336

Summary

Describe the feature:
In #70039 we have started to use custom label for fields in Discovery plugin. The same functionality needs to be implemented for TSVB too.

⚠️ Since TSVB allows you to work with multiple indexes + non-Kibana index patterns (eg Elastic indexes, Rollup indexes), we should only enable this feature if the user is using one Kibana Index Pattern for their visualization!

For those who will test this PR

Below you can find all places where lists with fields can be used:

  1. We should be able to select Field for Metric Aggregations: Average, Cardinality, Counter Rate, Max, Min, Percentile, Percentile Rank, Std. Deviation, Sum, Sum of squares, Top Hit, Value Count, Variance
    image
    image

  2. We should be able to select Field for PanelOptions -> Time Field:
    image
    Placeholder for Time Field must also support custom labels:
    image

  3. Custom label should be applied when there is no label for aggregation (valid for each tabs)
    image

  4. We should be able to select Field for Table tab -> Group by field Label should be applied also in table Header!
    image

  5. We should be able to select Field for TimeSeries -> Annotations
    image

  6. For Top Hit Aggregation we should be able for select Field for Order By
    image

  7. Group By -> By
    image

  8. Markdown Tab
    image

  9. Panel Options -> Override index Pattern
    image

Checklist

@alexwizp
Copy link
Contributor Author

alexwizp commented Dec 1, 2020

@elasticmachine merge upstream

@alexwizp alexwizp requested review from stratoula and timroes December 2, 2020 11:08
@alexwizp alexwizp added v7.11.0 v8.0.0 Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// Feature:TSVB TSVB (Time Series Visual Builder) release_note:enhancement labels Dec 2, 2020
@alexwizp alexwizp marked this pull request as ready for review December 2, 2020 14:47
@alexwizp alexwizp requested a review from a team December 2, 2020 14:47
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@alexwizp
Copy link
Contributor Author

alexwizp commented Dec 3, 2020

@elasticmachine merge upstream

@alexwizp
Copy link
Contributor Author

alexwizp commented Dec 4, 2020

@elasticmachine merge upstream

@alexwizp
Copy link
Contributor Author

alexwizp commented Dec 7, 2020

@elasticmachine merge upstream

@alexwizp alexwizp changed the title [WIP][TSVB] Allow custom label for fields via index pattern field management [TSVB] Allow custom label for fields via index pattern field management Jan 6, 2021
@alexwizp alexwizp removed the WIP Work in progress label Jan 6, 2021
@alexwizp
Copy link
Contributor Author

alexwizp commented Jan 6, 2021

@elasticmachine merge upstream

@alexwizp
Copy link
Contributor Author

@elasticmachine merge upstream

@alexwizp
Copy link
Contributor Author

@elasticmachine merge upstream

}
});

if (type === METRIC_TYPES.COUNT) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it would be a good idea to move this check in the beginning of the component. As it returns null for this type. no need to run the rest of the code, right?

Copy link
Contributor Author

@alexwizp alexwizp Jan 11, 2021

Choose a reason for hiding this comment

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

I think this component should be refactored to use useEffect instead. But agree as a fast enhancement we can move that if up

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree but let's do this for now ❤️

@stratoula stratoula self-requested a review January 11, 2021 10:55
Copy link
Contributor

@stratoula stratoula left a comment

Choose a reason for hiding this comment

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

LGTM, tested on Safari and seems to work fine.

Copy link
Contributor

@sulemanof sulemanof left a comment

Choose a reason for hiding this comment

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

LGTM 👍
Tested in Chrome, works perfect 💕

@alexwizp
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
visTypeTimeseries 1.8MB 1.7MB -24.5KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
visTypeTimeseries 143.6KB 136.8KB -6.8KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@alexwizp alexwizp merged commit 0b7e83f into elastic:master Jan 12, 2021
alexwizp added a commit to alexwizp/kibana that referenced this pull request Jan 12, 2021
…nt (elastic#84612)

* [TSVB] Allow custom label for fields via index pattern field management

Closes: elastic#84336

* replace saveObject, elasticsearch client to new one

* fix CI

* update schema

* fix Top Hit

* some changes

* partially move getting fields into client side

* fix PR comments

* fix issue with getting fields

* move SanitizedFieldType to common types

* fix issue on changing index pattern

* fix issue

* fix regression

* some work

* remove extractFieldName, createCustomLabelSelectHandler

* request/response processors should be async

* some work

* remove tests for createCustomLabelSelectHandler

* fix table

* fix placeholder

* some work

* fix jest

* fix CI

* fix label for table view

* test: visualize app visual builder switch index patterns should be able to switch between index patterns

* fix functional tests

* fix sorting

* fix labels for entire timerange mode

* add createFieldsFetcher method

* table view - fix pivot label

* fix PR comments

* fix issue with selecting buckets scripts

* fix types

* Update create_select_handler.test.ts

* fix PR comments

Co-authored-by: Kibana Machine <[email protected]>
alexwizp added a commit that referenced this pull request Jan 13, 2021
…nt (#84612) (#88074)

* [TSVB] Allow custom label for fields via index pattern field management

Closes: #84336

* replace saveObject, elasticsearch client to new one

* fix CI

* update schema

* fix Top Hit

* some changes

* partially move getting fields into client side

* fix PR comments

* fix issue with getting fields

* move SanitizedFieldType to common types

* fix issue on changing index pattern

* fix issue

* fix regression

* some work

* remove extractFieldName, createCustomLabelSelectHandler

* request/response processors should be async

* some work

* remove tests for createCustomLabelSelectHandler

* fix table

* fix placeholder

* some work

* fix jest

* fix CI

* fix label for table view

* test: visualize app visual builder switch index patterns should be able to switch between index patterns

* fix functional tests

* fix sorting

* fix labels for entire timerange mode

* add createFieldsFetcher method

* table view - fix pivot label

* fix PR comments

* fix issue with selecting buckets scripts

* fix types

* Update create_select_handler.test.ts

* fix PR comments

Co-authored-by: Kibana Machine <[email protected]>

Co-authored-by: Kibana Machine <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature:TSVB TSVB (Time Series Visual Builder) release_note:enhancement Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v7.12.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TSVB] Allow custom label for fields via index pattern field management

5 participants