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

[Workspace]Dismiss get started for search/essential/analytics overview page #8874

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Hailong-am
Copy link
Collaborator

@Hailong-am Hailong-am commented Nov 15, 2024

Description

Add setting button for search overview page to let user to dismiss get started section

Issues Resolved

Screenshot

Testing the changes

Changelog

  • feat: [Workspace] support dismiss get started for search overview page

Check List

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

Copy link
Contributor

❌ Empty Changelog Section

The Changelog section in your PR description is empty. Please add a valid changelog entry or entries. If you did add a changelog entry, check to make sure that it was not accidentally included inside the comment block in the Changelog section.

Copy link

codecov bot commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 98.46154% with 1 line in your changes missing coverage. Please review.

Project coverage is 61.04%. Comparing base (9b5ce68) to head (d417496).

Files with missing lines Patch % Lines
...lic/components/workspace_use_case_overview_app.tsx 96.87% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8874      +/-   ##
==========================================
+ Coverage   61.02%   61.04%   +0.01%     
==========================================
  Files        3813     3814       +1     
  Lines       91401    91472      +71     
  Branches    14443    14453      +10     
==========================================
+ Hits        55782    55842      +60     
- Misses      32056    32067      +11     
  Partials     3563     3563              
Flag Coverage Δ
Linux_1 29.12% <97.29%> (+0.04%) ⬆️
Linux_2 56.45% <ø> (ø)
Linux_3 38.03% <100.00%> (?)
Linux_4 29.06% <100.00%> (+0.03%) ⬆️
Windows_1 29.14% <97.29%> (+0.02%) ⬆️
Windows_2 56.40% <ø> (ø)
Windows_3 38.03% <100.00%> (+<0.01%) ⬆️
Windows_4 29.06% <100.00%> (+0.03%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Hailong-am Hailong-am force-pushed the dismiss-getstarted-card branch from d0d13a9 to 8b27d2d Compare November 29, 2024 07:44
@Hailong-am Hailong-am changed the title [Workspace]Dismiss get started for search overview page [Workspace]Dismiss get started for search/essential/analytics overview page Nov 29, 2024
} = useOpenSearchDashboards<CoreStart>();
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
const [isGetStartedDismissed, setIsGetStartedDismissed] = useState<boolean>(
!!uiSettings.get(SEARCH_WORKSPACE_DISMISS_GET_STARTED)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: I remember uiSettings has a get$ method that can return an observable, maybe we can use that and there is no need to have a state here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the state isGetStartedDismissed used for multiple place and we need a variable for

 const contextMenuItems = [
    {
      name: isGetStartedDismissed ? show : hide,
      icon: <EuiIcon type={isGetStartedDismissed ? 'eye' : 'eyeClosed'} />,
      onClick: async () => {
        await dismissGetStartCards(!isGetStartedDismissed);
        closePopover();
      },
    },
  ];

Copy link
Member

Choose a reason for hiding this comment

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

const isGetStartedDismissed = useObservable<boolean>(!!uiSettings.get$(SEARCH_WORKSPACE_DISMISS_GET_STARTED), may work as well and setIsGetStartedDismissed seems useless.

@@ -28,3 +29,14 @@ export const uiSettings: Record<string, UiSettingsParams> = {
requiresPageReload: true,
},
};

export const searchOverviewPageUISetting: Record<string, UiSettingsParams> = {
[SEARCH_WORKSPACE_DISMISS_GET_STARTED]: {
Copy link
Member

Choose a reason for hiding this comment

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

Instead of ui settings, shall we simply store it in local storage? I feel local storage makes more sense to me for a UI behavior

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we want to persist the settings and even if when they switch browser and devices.

}
}, [isGetStartedDismissed, page]);

const hide = i18n.translate('home.searchOverview.getStartedCard.setting.hide.label', {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: since show is just text, maybe name it like hideGetStartedLabel sound more appropriate?

defaultMessage: 'Hide Get started with Search',
});

const show = i18n.translate('home.searchOverview.getStartedCard.setting.show.label', {
Copy link
Member

Choose a reason for hiding this comment

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

Nit: the same here.

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.

3 participants