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

[Chore] Update timeline default expression #2720

Merged

Conversation

joshuarrrr
Copy link
Member

@joshuarrrr joshuarrrr commented Nov 1, 2022

Description

Update default expression from .es(*) to opensearch(*) in the timeline visualization. Both work, but we'd prefer the latter

Issues Resolved

#1631

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
    • yarn test:ftr
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@kavilla
Copy link
Member

kavilla commented Nov 1, 2022

Thank you so much for doing this!

Copy link
Member

@zhongnansu zhongnansu left a comment

Choose a reason for hiding this comment

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

@kavilla
Copy link
Member

kavilla commented Nov 2, 2022

for the cypress ones i would leave the same*, those are BWC tests so it's there to ensure that .es(*) still works.

@kavilla
Copy link
Member

kavilla commented Nov 2, 2022

Could we also add to this script to make the query .es https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/cypress/integration/without-security/helpers/generate_data.js#L59 (and do the with-security script as well? Sorry for the redundancy, I followed the format of the previously BWC tests for consistency but we should fix that).

But if we can add to the section to ensure that it updates the value to be .es because the BWC test is to verify end-users to migrated from the legacy application to OpenSearch Dashboards that their queries still work instead of having to change to .opensearch

@ananzh
Copy link
Member

ananzh commented Nov 3, 2022

I am a bit curious. Won't this cause backward compatibility issue? For example, if an saved expression is using .es(). So is this fix for 3.0.0?

@kavilla
Copy link
Member

kavilla commented Nov 3, 2022

I am a bit curious. Won't this cause backward compatibility issue? For example, if an saved expression is using .es(). So is this fix for 3.0.0?

It should only cause a failure in the test after generation existing timeline visualizations should still contain .es()

Update default expression from `.es(*)` to `opensearch(*)`.
Both work, but we'd prefer the latter

Signed-off-by: Josh Romero <rmerqg@amazon.com>
Signed-off-by: Josh Romero <rmerqg@amazon.com>
@joshuarrrr joshuarrrr force-pushed the chore/update-default-timeline-exp branch from a16af6b to 47303cf Compare November 18, 2022 23:22
To make sure we continue supporting the old format.

Signed-off-by: Josh Romero <rmerqg@amazon.com>
Signed-off-by: Josh Romero <rmerqg@amazon.com>
@joshuarrrr
Copy link
Member Author

Thanks @zhongnansu - I went ahead and updated all the other references, except for those in the BWC cypress tests as per @kavilla's note.

@joshuarrrr joshuarrrr added the v2.5.0 'Issues and PRs related to version v2.5.0' label Nov 22, 2022
zhongnansu
zhongnansu previously approved these changes Nov 22, 2022
@ashwin-pc
Copy link
Member

@joshuarrrr @kavilla is there anything pending for this PR?

kavilla
kavilla previously approved these changes Dec 1, 2022
Copy link
Member

@kavilla kavilla left a comment

Choose a reason for hiding this comment

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

Timeline BWC test is passing locally for me

@joshuarrrr
Copy link
Member Author

Timeline BWC test is passing locally for me

huh... that's surprising. Maybe I'll try re-running and hoping. 🤞

@joshuarrrr joshuarrrr marked this pull request as draft December 14, 2022 21:45
@joshuarrrr
Copy link
Member Author

converting to draft until I have some time to investigate/fix bwc tests

@joshuarrrr joshuarrrr dismissed stale reviews from kavilla and zhongnansu via fee215a December 28, 2022 21:24
@codecov-commenter
Copy link

codecov-commenter commented Dec 28, 2022

Codecov Report

Merging #2720 (6401ff4) into main (1e127b0) will decrease coverage by 0.02%.
The diff coverage is n/a.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##             main    #2720      +/-   ##
==========================================
- Coverage   66.41%   66.39%   -0.02%     
==========================================
  Files        3206     3209       +3     
  Lines       61597    61633      +36     
  Branches     9503     9507       +4     
==========================================
+ Hits        40909    40921      +12     
- Misses      18410    18426      +16     
- Partials     2278     2286       +8     
Flag Coverage Δ
Linux 66.39% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 38 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@abbyhu2000 abbyhu2000 added v2.6.0 and removed v2.5.0 'Issues and PRs related to version v2.5.0' labels Jan 6, 2023
@joshuarrrr joshuarrrr added v2.7.0 and removed v2.6.0 labels Feb 17, 2023
@ashwin-pc ashwin-pc marked this pull request as ready for review March 7, 2023 23:24
@@ -79,6 +79,10 @@ describe('Generating BWC test data with security', () => {
.find('[data-test-subj="newItemButton"]')
.click();
cy.get('[data-test-subj="visType-timelion"]').click();
// update default expression to use `.es(*)` instead of `.opensearch(*)` for bwc
Copy link
Member

Choose a reason for hiding this comment

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

NIT: do you think we could create a common function

Cypress.Commands.add('clearWithBackspaces', (selector, count) => {
  cy.get(selector).then($element => {
    const backspaces = '{backspace}'.repeat(count);
    $element.type(`{selectAll}${backspaces}`);
  });
});

So this could simplifies to

cy.clearWithBackspaces('[class="view-line"]', 15).type('.es(*)');

and this function could also be imported in other tests. I see there are 2 more tests using similar function. maybe put it in a until or common folder?

Also curious why we need these many backspaces

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I meant to call this out in a comment. For some reason, the {selectAll} cypress sequence doesn't work in this field the way it's supposed to (or at least the way I understand that it's supposed to work). Previously, when the default expression was .es(*), there were 6 total characters - you'll see that some tests "cleared" the input by repeating five backspaces (and reusing the .). Now that we've made the default expression opensearch(*), there are 14 total characters that need deleting, if you delete them one by one. I didn't try .clear() either, but because it's supposed to just alias type({selectAll}{backspace}), I suspect it won't work either.

I do like the simplification idea, although I don't think we need a common function for 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.

See if you like my latest approach better! I sure do 😁

Copy link
Member

Choose a reason for hiding this comment

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

kk I like it

Signed-off-by: Josh Romero <rmerqg@amazon.com>
Signed-off-by: Josh Romero <rmerqg@amazon.com>
ananzh
ananzh previously approved these changes Mar 24, 2023
kavilla
kavilla previously approved these changes Mar 24, 2023
Signed-off-by: Josh Romero <rmerqg@amazon.com>
@joshuarrrr joshuarrrr dismissed stale reviews from kavilla and ananzh via 6401ff4 March 24, 2023 21:36
@joshuarrrr joshuarrrr merged commit 7efc231 into opensearch-project:main Mar 27, 2023
opensearch-trigger-bot bot pushed a commit that referenced this pull request Mar 27, 2023
* [Chore] Update other timeline `es()` examples and test usage to make sure we continue supporting the old format.
* [Chore] Update BWC data generation to use es(*)
* [Test] Add better programmatic text clearing for monaco editor
* [Test] Wait for loader to finish after clicking update

Update default expression from `.es(*)` to `opensearch(*)`.
Both work, but we'd prefer the latter

Signed-off-by: Josh Romero <rmerqg@amazon.com>

---------

Signed-off-by: Josh Romero <rmerqg@amazon.com>
(cherry picked from commit 7efc231)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md
@joshuarrrr joshuarrrr deleted the chore/update-default-timeline-exp branch March 27, 2023 17:24
joshuarrrr added a commit that referenced this pull request Mar 28, 2023
* [Chore] Update timeline default expression (#2720)

* [Chore] Update other timeline `es()` examples and test usage to make sure we continue supporting the old format.
* [Chore] Update BWC data generation to use es(*)
* [Test] Add better programmatic text clearing for monaco editor
* [Test] Wait for loader to finish after clicking update

Update default expression from `.es(*)` to `opensearch(*)`.
Both work, but we'd prefer the latter

Signed-off-by: Josh Romero <rmerqg@amazon.com>

---------

Signed-off-by: Josh Romero <rmerqg@amazon.com>
(cherry picked from commit 7efc231)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

# Conflicts:
#	CHANGELOG.md

* add changelog

Signed-off-by: Josh Romero <rmerqg@amazon.com>

---------

Signed-off-by: Josh Romero <rmerqg@amazon.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Josh Romero <rmerqg@amazon.com>
sikhote pushed a commit to sikhote/OpenSearch-Dashboards that referenced this pull request Apr 24, 2023
* [Chore] Update other timeline `es()` examples and test usage to make sure we continue supporting the old format.
* [Chore] Update BWC data generation to use es(*)
* [Test] Add better programmatic text clearing for monaco editor
* [Test] Wait for loader to finish after clicking update

Update default expression from `.es(*)` to `opensearch(*)`.
Both work, but we'd prefer the latter

Signed-off-by: Josh Romero <rmerqg@amazon.com>

---------

Signed-off-by: Josh Romero <rmerqg@amazon.com>
Signed-off-by: David Sinclair <david@sinclair.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Timeline expression initialization is still using "es" as function name
7 participants