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

Edit wizard directly on dashboard #2508

Conversation

abbyhu2000
Copy link
Member

@abbyhu2000 abbyhu2000 commented Oct 5, 2022

Description

Edit wizard directly on dashboard following the steps:

  1. choose a dashboard
  2. click Edit button on the top nav bar of the dashboard
  3. select the setting button on the top right of a wizard on that dashboard
  4. click edit wizard

Screen Shot 2022-10-05 at 10 49 47 AM

When finish editing wizard, there are some different options for saving that wizard, this PR ensures the below five different flows for editing wizard all work as expected:

  1. Save and return button on top nav bar --> will save the original wizard and return back to the dashboard without displaying an additional save modal
  2. Save as button on top nav bar --> will open a save modal
    • save as new wizard toggle on + add to dashboard after saving toggle on + Save and return button
    • save as new wizard toggle on + add to dashboard after saving toggle off + Save button
    • save as new wizard toggle off + return to dashboard after saving toggle on + Save and return button
    • save as new wizard toggle off + return to dashboard after saving toggle off + Save button

Screen Shot 2022-10-05 at 10 58 12 AM

Screen Shot 2022-10-05 at 10 57 32 AM

Screen Shot 2022-10-05 at 10 57 20 AM

Issues Resolved

#2382

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

@abbyhu2000 abbyhu2000 force-pushed the edit_wizard_directly_on_dashboard branch from 6832821 to 3f9f9e0 Compare October 5, 2022 01:33
@abbyhu2000 abbyhu2000 self-assigned this Oct 5, 2022
@abbyhu2000 abbyhu2000 marked this pull request as ready for review October 5, 2022 01:36
@abbyhu2000 abbyhu2000 requested a review from a team as a code owner October 5, 2022 01:36
@codecov-commenter
Copy link

codecov-commenter commented Oct 5, 2022

Codecov Report

Merging #2508 (55bffea) into main (ac07159) will decrease coverage by 0.01%.
The diff coverage is 12.50%.

@@            Coverage Diff             @@
##             main    #2508      +/-   ##
==========================================
- Coverage   66.74%   66.72%   -0.02%     
==========================================
  Files        3201     3201              
  Lines       60948    60955       +7     
  Branches     9267     9271       +4     
==========================================
- Hits        40679    40675       -4     
- Misses      18052    18062      +10     
- Partials     2217     2218       +1     
Impacted Files Coverage Δ
...rd/public/application/utils/get_top_nav_config.tsx 56.52% <12.50%> (-10.15%) ⬇️
...ared/static/forms/hook_form_lib/hooks/use_field.ts 65.70% <0.00%> (-0.97%) ⬇️
...ic/application/models/sense_editor/sense_editor.ts 64.00% <0.00%> (-0.89%) ⬇️

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

@joshuarrrr
Copy link
Member

Now that we have some test coverage for saving and loading (thanks!), we should also include unit tests for this flow, particularly because there are five separate user flows that are a little confusing to mentally model.

@abbyhu2000
Copy link
Member Author

abbyhu2000 commented Oct 5, 2022

Now that we have some test coverage for saving and loading (thanks!), we should also include unit tests for this flow, particularly because there are five separate user flows that are a little confusing to mentally model.

@joshuarrrr Yea i agree. Do you think it is more appropriate to write functional tests for these flows? Since it involves with user clicking different button and toggle.

Also when i was writing the unit tests for get_top_nav_config() function, i included a unit test for the edit logic there.

test('edit an exising wizard from dashboard', async () => {

@ashwin-pc
Copy link
Member

@joshuarrrr yeah there is a functional test we plan on adding for this flow.

ashwin-pc
ashwin-pc previously approved these changes Oct 8, 2022
@ashwin-pc
Copy link
Member

Now that we have some test coverage for saving and loading (thanks!), we should also include unit tests for this flow, particularly because there are five separate user flows that are a little confusing to mentally model.

@joshuarrrr Yea i agree. Do you think it is more appropriate to write functional tests for these flows? Since it involves with user clicking different button and toggle.

Also when i was writing the unit tests for get_top_nav_config() function, i included a unit test for the edit logic there.

test('edit an exising wizard from dashboard', async () => {

@abbyhu2000 how was that test for the edit flow previously passing if the change is being made here?

@abbyhu2000
Copy link
Member Author

abbyhu2000 commented Oct 8, 2022

Now that we have some test coverage for saving and loading (thanks!), we should also include unit tests for this flow, particularly because there are five separate user flows that are a little confusing to mentally model.

@joshuarrrr Yea i agree. Do you think it is more appropriate to write functional tests for these flows? Since it involves with user clicking different button and toggle.
Also when i was writing the unit tests for get_top_nav_config() function, i included a unit test for the edit logic there.

test('edit an exising wizard from dashboard', async () => {

@abbyhu2000 how was that test for the edit flow previously passing if the change is being made here?

@ashwin-pc When i am writing my last PR(create wizard directly from dashboard), i include the editing logic in the onSave() function. So when i am writing unit tests for onSave(), i am able to mock the props of onSave and test that part of the logic. However, in order for editing wizard from dashboard to work, the logic that's needed inside the topNavConfig constant to call that onSave() function with the correct props are still missing, so this PR added those logics. Previously when we try to edit wizard directly from dashboard, the changes were not being saved after we click Save.

ananzh
ananzh previously approved these changes Oct 10, 2022
Copy link
Member

@ananzh ananzh left a comment

Choose a reason for hiding this comment

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

LGTM

@kavilla kavilla added the v2.4.0 'Issues and PRs related to version v2.4.0' label Oct 10, 2022
@abbyhu2000 abbyhu2000 dismissed stale reviews from ananzh and ashwin-pc via 55bffea October 10, 2022 18:50
defaultMessage: 'Finish editing wizard and return to the last app',
}
),
testId: 'wizardsaveAndReturnButton',
Copy link
Member

Choose a reason for hiding this comment

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

NIT: Casing is off on this one.

@abbyhu2000 abbyhu2000 merged commit d6197a7 into opensearch-project:main Oct 10, 2022
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-2508-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 d6197a7827cc6858fb31af98154f8e8324b80fe3
# Push it to GitHub
git push --set-upstream origin backport/backport-2508-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-2508-to-2.x.

abbyhu2000 added a commit to abbyhu2000/OpenSearch-Dashboards that referenced this pull request Oct 31, 2022
abbyhu2000 added a commit to abbyhu2000/OpenSearch-Dashboards that referenced this pull request Oct 31, 2022
abbyhu2000 added a commit that referenced this pull request Oct 31, 2022
Signed-off-by: abbyhu2000 <[email protected]>

Signed-off-by: abbyhu2000 <[email protected]>

Signed-off-by: abbyhu2000 <[email protected]>
@AMoo-Miki AMoo-Miki added the enhancement New feature or request label Nov 5, 2022
sipopo pushed a commit to sipopo/OpenSearch-Dashboards that referenced this pull request Dec 16, 2022
Signed-off-by: abbyhu2000 <[email protected]>

Signed-off-by: abbyhu2000 <[email protected]>
Signed-off-by: Sergey V. Osipov <[email protected]>
@abbyhu2000 abbyhu2000 deleted the edit_wizard_directly_on_dashboard branch June 30, 2023 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x enhancement New feature or request v2.4.0 'Issues and PRs related to version v2.4.0' vis builder
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants