Skip to content

Add tooltip and disabled to panel item#9696

Merged
Hailong-am merged 13 commits intoopensearch-project:mainfrom
yyfamazon:addActionId
Apr 29, 2025
Merged

Add tooltip and disabled to panel item#9696
Hailong-am merged 13 commits intoopensearch-project:mainfrom
yyfamazon:addActionId

Conversation

@yyfamazon
Copy link
Copy Markdown
Contributor

@yyfamazon yyfamazon commented Apr 21, 2025

Description

Add tooltip and disabled to context. So the generate visualization button can be disabled when there is no results or there is error: https://github.com/opensearch-project/dashboards-assistant/pull/546/files

Issues Resolved

Screenshot

Testing the changes

Changelog

  • feat: ui action supports isDisabled and getTooltip

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

Signed-off-by: yyfamazon <yyf@amazon.com>
Signed-off-by: yyfamazon <yyf@amazon.com>
@github-actions
Copy link
Copy Markdown
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.

Comment thread src/plugins/ui_actions/public/context_menu/build_eui_context_menu_panels.tsx Outdated
@ruanyl
Copy link
Copy Markdown
Member

ruanyl commented Apr 25, 2025

@yyfamazon You also need to update the PR description and add a Changelog entry for it.

@yyfamazon yyfamazon changed the title Add action id to panel item Add action_id, tooltip and disabled to panel item Apr 25, 2025
@github-actions
Copy link
Copy Markdown
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.

Signed-off-by: yyfamazon <yyf@amazon.com>
@yyfamazon
Copy link
Copy Markdown
Contributor Author

@yyfamazon You also need to update the PR description and add a Changelog entry for it.

@ruanyl done, thanks!

@github-actions
Copy link
Copy Markdown
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.

Comment thread src/plugins/ui_actions/public/context_menu/build_eui_context_menu_panels.tsx Outdated
@yyfamazon yyfamazon changed the title Add action_id, tooltip and disabled to panel item Add tooltip and disabled to panel item Apr 27, 2025
@github-actions
Copy link
Copy Markdown
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.

1 similar comment
@github-actions
Copy link
Copy Markdown
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.

Signed-off-by: yyfamazon <yyf@amazon.com>
Comment on lines +220 to +226
if (typeof action?.getTooltip === 'function') {
contextItem.toolTipContent = action.getTooltip(context);
}
if (typeof action?.isDisabled === 'function') {
contextItem.disabled = action?.isDisabled(context);
}
panels[parentGroupId || 'mainMenu'].items!.push(contextItem);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

would like have a unit test for this

@Hailong-am
Copy link
Copy Markdown
Collaborator

failed test cases are not related this change, merge it

@Hailong-am Hailong-am merged commit a37c8ea into opensearch-project:main Apr 29, 2025
67 of 76 checks passed
Qxisylolo pushed a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request May 13, 2025
* add action id

Signed-off-by: yyfamazon <yyf@amazon.com>

* add change log

Signed-off-by: yyfamazon <yyf@amazon.com>

* add tooltip and disable to context

Signed-off-by: yyfamazon <yyf@amazon.com>

* fix test

Signed-off-by: yyfamazon <yyf@amazon.com>

* fix test

Signed-off-by: yyfamazon <yyf@amazon.com>

* resolve comment

Signed-off-by: yyfamazon <yyf@amazon.com>

* resolve comments

Signed-off-by: yyfamazon <yyf@amazon.com>

* Changeset file for PR opensearch-project#9696 created/updated

---------

Signed-off-by: yyfamazon <yyf@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Qxisylolo pushed a commit to Qxisylolo/OpenSearch-Dashboards that referenced this pull request Aug 3, 2025
* add action id

Signed-off-by: yyfamazon <yyf@amazon.com>

* add change log

Signed-off-by: yyfamazon <yyf@amazon.com>

* add tooltip and disable to context

Signed-off-by: yyfamazon <yyf@amazon.com>

* fix test

Signed-off-by: yyfamazon <yyf@amazon.com>

* fix test

Signed-off-by: yyfamazon <yyf@amazon.com>

* resolve comment

Signed-off-by: yyfamazon <yyf@amazon.com>

* resolve comments

Signed-off-by: yyfamazon <yyf@amazon.com>

* Changeset file for PR opensearch-project#9696 created/updated

---------

Signed-off-by: yyfamazon <yyf@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
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.

4 participants