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 4 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 60.89%. Comparing base (9f23442) to head (1b996fa).
Report is 1 commits behind head on main.

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   60.87%   60.89%   +0.01%     
==========================================
  Files        3808     3809       +1     
  Lines       91209    91280      +71     
  Branches    14410    14420      +10     
==========================================
+ Hits        55526    55584      +58     
- Misses      32142    32154      +12     
- Partials     3541     3542       +1     
Flag Coverage Δ
Linux_1 29.06% <97.29%> (+0.04%) ⬆️
Linux_2 56.38% <ø> (ø)
Linux_3 37.93% <100.00%> (+<0.01%) ⬆️
Linux_4 29.05% <100.00%> (+0.03%) ⬆️
Windows_1 29.08% <97.29%> (+0.02%) ⬆️
Windows_2 56.34% <ø> (ø)
Windows_3 37.93% <100.00%> (-0.01%) ⬇️
Windows_4 29.05% <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();
      },
    },
  ];

const pageId = props.pageId;
const { pageId } = props;

const uiSettingsKeyMap: Record<string, string> = {
Copy link
Member

@SuZhou-Joe SuZhou-Joe Dec 2, 2024

Choose a reason for hiding this comment

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

I am thinking if we can make the dismiss button(including the popover) as a reuseable component, with the settingKey / text as its props.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that's good idea, need find out a shared place for this component.

@@ -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.

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