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

Fix the display and jump logic for recent assets #8136

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

Conversation

Kapian1234
Copy link
Contributor

Description

  1. Filter out global objects in recently viewed assets when workspace is enabled.
  2. In recently accessed, when workspace disabled, it should jump to the global visualization/dashboard page (ignore the workspace of the current saved object).

Issues Resolved

Screenshot

Testing the changes

Changelog

  • fix: Fix the display and jump logic for recent assets

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

… to the global for workspace objects hwen workspace disabled

Signed-off-by: Kapian1234 <[email protected]>
Copy link

codecov bot commented Sep 11, 2024

Codecov Report

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

Project coverage is 60.98%. Comparing base (87011f7) to head (bef66a3).
Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
...ome/recently_accessed/recently_accessed_service.ts 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8136      +/-   ##
==========================================
+ Coverage   60.90%   60.98%   +0.07%     
==========================================
  Files        3808     3812       +4     
  Lines       91196    91389     +193     
  Branches    14400    14439      +39     
==========================================
+ Hits        55547    55731     +184     
- Misses      32096    32098       +2     
- Partials     3553     3560       +7     
Flag Coverage Δ
Linux_1 29.07% <0.00%> (+0.07%) ⬆️
Linux_2 56.45% <85.71%> (+0.06%) ⬆️
Linux_3 37.97% <0.00%> (-0.05%) ⬇️
Linux_4 29.03% <12.50%> (+0.01%) ⬆️
Windows_1 29.09% <0.00%> (+0.07%) ⬆️
Windows_2 56.40% <85.71%> (+0.06%) ⬆️
Windows_3 37.97% <0.00%> (-0.05%) ⬇️
Windows_4 29.03% <12.50%> (+0.01%) ⬆️

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.

get$: () => {
return history.get$().pipe(
map((items) => {
return items.filter((item) => (workspaceEnabled ? !!item.workspaceId : true));
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add some UT to test this filtering logic?

withoutClientBasePath: true,
})
basePath.prepend(
formatUrlWithWorkspaceId(link, workspaceEnabled ? workspaceId || '' : '', basePath),
Copy link
Contributor

Choose a reason for hiding this comment

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

This logic looks a little bit strange to me, I think we don't need to call formatUrlWithWorkspaceId if workspaceEnabled equal false. How about refactor with below code?

Suggested change
formatUrlWithWorkspaceId(link, workspaceEnabled ? workspaceId || '' : '', basePath),
workspaceEnabled ? formatUrlWithWorkspaceId(link, workspaceId || '', basePath) : link,

By the way, can we add some unit tests about it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

@@ -81,10 +84,16 @@ export class RecentlyAccessedService {
},

/** Gets the current array of history items. */
get: () => history.get(),
get: () => history.get().filter((item) => !!item.workspaceId),
Copy link
Collaborator

Choose a reason for hiding this comment

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

will this impact workspace disabled case? I think we should check workspaceEnabled flag

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes I forgot it here, thx for reminding!

Signed-off-by: Kapian1234 <[email protected]>
@ananzh
Copy link
Member

ananzh commented Oct 30, 2024

@Kapian1234 thanks for the contribution. Could you check and fix the comment? I think we could release this for 2.19. Will leave @SuZhou-Joe and @ruanyl to make the call.

@Kapian1234
Copy link
Contributor Author

@Kapian1234 thanks for the contribution. Could you check and fix the comment? I think we could release this for 2.19. Will leave @SuZhou-Joe and @ruanyl to make the call.

ok

SuZhou-Joe
SuZhou-Joe previously approved these changes Dec 24, 2024
@SuZhou-Joe SuZhou-Joe dismissed their stale review December 24, 2024 08:13

UT failed

@SuZhou-Joe
Copy link
Member

@Kapian1234 , bootstrap failed, could you please take a look?

@Kapian1234
Copy link
Contributor Author

@Kapian1234 , bootstrap failed, could you please take a look?

ok

SuZhou-Joe
SuZhou-Joe previously approved these changes Dec 30, 2024
@@ -103,6 +103,6 @@ describe('createRecentNavLink', () => {
mockedNavigateToUrl
);

expect(recentLink.href).toEqual('http://localhost/test/w/foo/app/foo');
expect(recentLink.href).toEqual('http://localhost/test/app/foo');
Copy link
Contributor

Choose a reason for hiding this comment

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

Shall we need to add test case for workspace disabled?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added

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.

7 participants