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

[TSVB] Fields dropdowns are not populated if one of the indices is missing #77363

Merged
merged 10 commits into from
Sep 22, 2020

Conversation

DianaDerevyankina
Copy link
Contributor

@DianaDerevyankina DianaDerevyankina commented Sep 14, 2020

Closes #73987

Summary

It's a fix for the issue of not populated dropdown fields when comma-separated index patterns contain a missing index

If one or some of the index patterns are missing, the time field dropdown shows fields for the other existent index patterns

image

Visualization with the time field chosen:

image

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@DianaDerevyankina DianaDerevyankina added Feature:TSVB TSVB (Time Series Visual Builder) v8.0.0 release_note:skip Skip the PR/issue when compiling release notes v7.10.0 labels Sep 14, 2020
@DianaDerevyankina DianaDerevyankina self-assigned this Sep 14, 2020
@DianaDerevyankina DianaDerevyankina changed the title Fields dropdowns are not populated if one of the indices is missing [TSVB] Fields dropdowns are not populated if one of the indices is missing Sep 14, 2020
let indexPatternString = indexPattern;

if (!indexPatternString) {
const index = await reqFacade.getUiSettingsService().get('defaultIndex');
Copy link
Contributor

Choose a reason for hiding this comment

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

This will return a default index id, e.x. ff959d40-b880-11e8-a6d9-e546fe2bba5f.
To receive an index title, you should get an actual index via saveObjectsClient service as in getIndexPatternObject helper

You could literally go with

  if (!indexPatternString) {
    const object = await getIndexPatternObject(reqFacade, indexPattern);
    indexPatternString = object.indexPatternString;
  }

or you could use the data plugin indexPatternsService, where there are getDefaut function to retrieve the default index directly. I think this is a better variant.

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.

Tested and works well! LGTM
Left a comment about translation.
Could you please add more PR description ?

@@ -43,6 +43,10 @@ export function Visualization(props) {
const { visData, model } = props;
// Show the error panel
const error = _.get(visData, `${model.id}.error`);
if (_.get(error, 'error.type') === 'index_not_found_exception') {
const index = _.get(error, 'error.index');
error.message = `Index "${index}" is missing`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be great to use translations here:

Suggested change
error.message = `Index "${index}" is missing`;
error.message = i18n.translate('visTypeTimeseries.error.missingIndexErrorMessage', {
defaultMessage: 'Index {index} is missing',
values: { index }
});

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, updated the PR and its description

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 in chrome

@sulemanof sulemanof marked this pull request as ready for review September 18, 2020 10:43
@sulemanof sulemanof requested a review from a team September 18, 2020 10:43
@sulemanof sulemanof requested a review from a team as a code owner September 18, 2020 10:43
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.

Tested again after resolving the merge conflict. LGTM 👍

@DianaDerevyankina DianaDerevyankina added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Sep 18, 2020
@elasticmachine
Copy link
Contributor

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

@DianaDerevyankina
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Build metrics

✅ unchanged

History

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

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.

Reviewed again, LGTM

Copy link
Contributor

@alexwizp alexwizp left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you

Copy link
Contributor

@lizozom lizozom left a comment

Choose a reason for hiding this comment

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

LGTM

Linking the docs on allow_no_indices for reference on what this parameter does.

@DianaDerevyankina DianaDerevyankina merged commit ed7a630 into elastic:master Sep 22, 2020
DianaDerevyankina added a commit to DianaDerevyankina/kibana that referenced this pull request Sep 22, 2020
…ssing (elastic#77363)

* Fields dropdowns are not populated if one of the indices is missing

* Fix tests and accept api changes

* Add indexPatternsService to get default index pattern

* Replace simple error message string with i18n translation

* Remove unnecessary displaying error code

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
DianaDerevyankina added a commit that referenced this pull request Sep 22, 2020
…ssing (#77363) (#78123)

* Fields dropdowns are not populated if one of the indices is missing

* Fix tests and accept api changes

* Add indexPatternsService to get default index pattern

* Replace simple error message string with i18n translation

* Remove unnecessary displaying error code

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Sep 22, 2020
* master: (45 commits)
  [CSM] Use stacked chart for page views (elastic#78042)
  [Enterprise Search] Fix various plugin states when app has error connecting to Enterprise Search (elastic#78091)
  Remove service map beta badge (elastic#78039)
  [Enterprise Search] Rename "telemetry" to "stats" (elastic#78124)
  [Alerting] optimize calculation of unmuted alert instances (elastic#78021)
  call .destroy on ace when react component unmounts (elastic#78132)
  [Ingest Manager] Fix agent action acknowledgement (elastic#78089)
  [Upgrade Assistant] Rename "telemetry" to "stats" (elastic#78127)
  [Security Solution] Refactor Hosts Kpi to use Search Strategy (elastic#77606)
  Bump backport to 5.6.0 (elastic#78097)
  [Actions] adds a Test Connector tab in the Connectors list (elastic#77365)
  [Uptime] Improve ping chart axis (elastic#77992)
  [TSVB] Fields dropdowns are not populated if one of the indices is missing (elastic#77363)
  [UiActions] Remove duplicate apply filter action  (elastic#77485)
  [APM] Use transaction metrics for transaction error rate (elastic#78009)
  [ES-ARCHIVER] Fix bug when query flag is empty (elastic#77983)
  Edit UI text strings in Integrations and Fleet tabs (elastic#75837)
  [baseline capture] switch to large workers (elastic#78109)
  [SECURITY_SOLUTION] list UI is backwards compatible (elastic#77956)
  [Mappings editor] Add support for point field type (elastic#77543)
  ...
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:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.10.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[TSVB] When comma seperated index patterns contain a missing index, the fields dropdowns are not populated.
7 participants