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] Chart with override index pattern and last_value are migrated with entire_time_range from 7.13+ #115041

Merged
merged 6 commits into from
Oct 21, 2021
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ export class VisEditor extends Component<TimeseriesEditorProps, TimeseriesEditor
? TIME_RANGE_DATA_MODES.LAST_VALUE
: TIME_RANGE_DATA_MODES.ENTIRE_TIME_RANGE,
...this.props.vis.params,
series: this.props.vis.params.series.map((val) => ({
Copy link
Contributor

Choose a reason for hiding this comment

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

@stratoula @VladLasitsa maybe it should go into migration script?

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good point but we should add a migration in 7.16 about a previous version (7.13) and I think we are trying to avoid it. This seems to me as a not very common case but I would like @flash1293 feedback here!

Copy link
Contributor

Choose a reason for hiding this comment

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

Is this within the editor or is it also used on the dashboard?
I think we should do this:

  • Make sure this fix also works if the user never opens the editor
  • Move it to the migrations if possible - it doesn't matter if a bug introduced in 7.13 is only fixed in 7.16; if we are confident enough to put this logic in the code showing the visualization we can be confident enough putting it into the migration script running for the next version.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes Joe, it works for the dashboard panels but I agree with your point. Let's also add a migration script :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stratoula Could you please describe for which version we should add migration script and in this case we should remove this part of code, right?

Copy link
Contributor

@flash1293 flash1293 Oct 20, 2021

Choose a reason for hiding this comment

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

When we create new vis and don't change time range mode, we don't provide it to model

Is there a reason why we are not storing it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@flash1293 When we create new tsvb we have only default state of time range mode which provide in model only my part of code. without this code we can see on UI right time range mode but in model we don't have it while we select another mode in combobox.

Copy link
Contributor

Choose a reason for hiding this comment

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

No Joe, I guess this also follows the logic "This is the default, do not store it :/". And now we changed the default and this is the reason we have this kind of bugs.
@VladLasitsa I got confused tbh by Alexey's comment about the migration. So if your fix works for all cases, then yes no migration script is needed. It is either a migration script or the fix. If we can't provide a migration script, the fix seems fine to me.

Copy link
Contributor Author

@VladLasitsa VladLasitsa Oct 20, 2021

Choose a reason for hiding this comment

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

@flash1293, you don't mind to leave only fix without migration script?

Copy link
Contributor

Choose a reason for hiding this comment

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

@VladLasitsa sounds good, your reasoning makes sense to me.

[TIME_RANGE_MODE_KEY]:
this.props.vis.title &&
this.props.vis.params.type !== 'timeseries' &&
val.override_index_pattern
? TIME_RANGE_DATA_MODES.LAST_VALUE
: TIME_RANGE_DATA_MODES.ENTIRE_TIME_RANGE,
...val,
})),
},
extractedIndexPatterns: [''],
};
Expand Down