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] Disable copy all button when there is no saved objects in assets page #8581

Merged
merged 4 commits into from
Oct 15, 2024

Conversation

yubonluo
Copy link
Contributor

@yubonluo yubonluo commented Oct 14, 2024

Description

Page crashed after click "Copy assets to ..." button in workspace assets page when assets table is empty
image

image (5)

Issues Resolved

Screenshot

image

Testing the changes

Changelog

  • fix: Disable cope all button when there is no saved objects in assets 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

Signed-off-by: yubonluo <yubonluo@amazon.com>
SuZhou-Joe
SuZhou-Joe previously approved these changes Oct 14, 2024
@SuZhou-Joe
Copy link
Member

It seems we only disable the button instead of fixing the root cause. Can we fix the place giving the error?

@@ -91,7 +91,7 @@ export class DuplicateResultFlyout extends React.Component<DuplicateResultFlyout
{copiedCount && (
<EuiFlexItem grow={false}>
<EuiTitle size="xs">
<h4 className="savedObjectsManagementImportSummary__copiedCountCount">
<h4 className="savedObjectsManagementImportSummary__createdCount">
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: This change does not seem related to the copy issue, was it made intentionally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When user copy saved objects successfully, we should show the correct color:
image
The previous classname is wrong and shows black.

Copy link
Contributor

@wanglam wanglam left a comment

Choose a reason for hiding this comment

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

Great fix. After testing, it looks good on my local environment.

Copy link

codecov bot commented Oct 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 60.89%. Comparing base (8332e09) to head (d0c2de4).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8581      +/-   ##
==========================================
- Coverage   60.92%   60.89%   -0.03%     
==========================================
  Files        3777     3786       +9     
  Lines       89847    90120     +273     
  Branches    14083    14128      +45     
==========================================
+ Hits        54738    54883     +145     
- Misses      31673    31794     +121     
- Partials     3436     3443       +7     
Flag Coverage Δ
Linux_1 29.15% <ø> (+0.02%) ⬆️
Linux_2 56.35% <ø> (+0.07%) ⬆️
Linux_3 37.72% <ø> (-0.08%) ⬇️
Linux_4 29.91% <ø> (-0.04%) ⬇️
Windows_1 29.17% <ø> (+0.02%) ⬆️
Windows_2 56.30% <ø> (+0.07%) ⬆️
Windows_3 37.73% <ø> (-0.08%) ⬇️
Windows_4 29.91% <ø> (-0.04%) ⬇️

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.

Signed-off-by: yubonluo <yubonluo@amazon.com>
@yubonluo
Copy link
Contributor Author

It seems we only disable the button instead of fixing the root cause. Can we fix the place giving the error?

Sure, the root cause is when selectedObjectCount is 0, we can not get the objectName: allSelectedObjects[0].meta.title,. After updating the code, it should be objectName: allSelectedObjects[0]?.meta.title,

@SuZhou-Joe SuZhou-Joe changed the title [Workspace] Disable cope all button when there is no saved objects in assets page [Workspace] Disable copy all button when there is no saved objects in assets page Oct 14, 2024
@Hailong-am Hailong-am merged commit 4334ecf into opensearch-project:main Oct 15, 2024
69 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Oct 15, 2024
… assets page (#8581)

* fix copy issue

Signed-off-by: yubonluo <yubonluo@amazon.com>

* Changeset file for PR #8581 created/updated

* optimize the code

Signed-off-by: yubonluo <yubonluo@amazon.com>

---------

Signed-off-by: yubonluo <yubonluo@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 4334ecf)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
SuZhou-Joe pushed a commit that referenced this pull request Oct 15, 2024
… assets page (#8581) (#8590)

* fix copy issue



* Changeset file for PR #8581 created/updated

* optimize the code



---------



(cherry picked from commit 4334ecf)

Signed-off-by: yubonluo <yubonluo@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
sejli pushed a commit to sejli/OpenSearch-Dashboards that referenced this pull request Oct 21, 2024
… assets page (opensearch-project#8581)

* fix copy issue

Signed-off-by: yubonluo <yubonluo@amazon.com>

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

* optimize the code

Signed-off-by: yubonluo <yubonluo@amazon.com>

---------

Signed-off-by: yubonluo <yubonluo@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 Oct 30, 2024
… assets page (opensearch-project#8581)

* fix copy issue

Signed-off-by: yubonluo <yubonluo@amazon.com>

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

* optimize the code

Signed-off-by: yubonluo <yubonluo@amazon.com>

---------

Signed-off-by: yubonluo <yubonluo@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