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] fix apps are missing when updating a workspace #6459

Merged

Conversation

ruanyl
Copy link
Member

@ruanyl ruanyl commented Apr 15, 2024

This is caused by #6234 which marked apps as inaccessible when the apps are not configured into the current workspace. However, inaccessible apps are filter out on workspace update page, this is unexpected as such apps can be configured into the current workspace again though they are not configured into the workspace at the moment.

Description

Issues Resolved

#6481

Changelog

  • skip

Screenshot

Testing the changes

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

This is caused by opensearch-project#6234 which marked apps as inaccessible when the apps
are not configured into the current workspace. However, inaccessible
apps can not be configured into a workspace.

Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
SuZhou-Joe
SuZhou-Joe previously approved these changes Apr 16, 2024
Copy link
Member

@SuZhou-Joe SuZhou-Joe left a comment

Choose a reason for hiding this comment

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

No much concern but maybe we should consider using capabilities service to filter out apps in workspace in the future.

* Restrict apps are apps that can be configured into a workspace, but restrict to access
* because the current workspace didn't have the apps configured, such apps should NOT filter out
*/
if (restrictedApps && restrictedApps.has(id)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

In order to keep the same source in workspace create, update and list page, can we use restrictedApps for all customized features for workspaces. We can remove the check below.

  return (
        navLinkStatus !== AppNavLinkStatus.hidden &&
        !chromeless &&
        !DEFAULT_SELECTED_FEATURES_IDS.includes(id) &&
        category?.id !== DEFAULT_APP_CATEGORIES.management.id
    );

@SuZhou-Joe SuZhou-Joe added the Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry label Apr 16, 2024
variable

Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
Copy link

codecov bot commented Apr 16, 2024

Codecov Report

Attention: Patch coverage is 77.77778% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 32.95%. Comparing base (d2d410b) to head (e4b5b5a).
Report is 2 commits behind head on main.

❗ Current head e4b5b5a differs from pull request most recent head 7d84f03. Consider uploading reports for the commit 7d84f03 to get more accurate results

Files Patch % Lines
src/plugins/workspace/public/plugin.ts 76.92% 3 Missing ⚠️
src/plugins/workspace/public/utils.ts 60.00% 2 Missing ⚠️
...components/workspace_updater/workspace_updater.tsx 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6459      +/-   ##
==========================================
+ Coverage   32.93%   32.95%   +0.01%     
==========================================
  Files        2260     2260              
  Lines       45769    45788      +19     
  Branches     7200     7203       +3     
==========================================
+ Hits        15075    15089      +14     
- Misses      29984    29988       +4     
- Partials      710      711       +1     
Flag Coverage Δ
Linux_1 32.95% <77.77%> (+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.

Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
SuZhou-Joe
SuZhou-Joe previously approved these changes Apr 16, 2024
Copy link
Member

@SuZhou-Joe SuZhou-Joe left a comment

Choose a reason for hiding this comment

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

LGTM

@ZilongX
Copy link
Collaborator

ZilongX commented Apr 16, 2024

picked up latest main and re-running all checks now

ZilongX
ZilongX previously approved these changes Apr 17, 2024
@ruanyl ruanyl dismissed stale reviews from ZilongX and SuZhou-Joe via 72baa1d April 17, 2024 03:03
@ruanyl ruanyl changed the title fix(workspace): apps are missing when updating a workspace [Workspace] fix apps are missing when updating a workspace Apr 17, 2024
Copy link
Contributor

❌ Invalid Changelog Heading

The '## Changelog' heading in your PR description is either missing or malformed. Please make sure that your PR description includes a '## Changelog' heading with proper spelling, capitalization, spacing, and Markdown syntax.

@github-actions github-actions bot added failed changeset and removed Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry labels Apr 17, 2024
@SuZhou-Joe SuZhou-Joe added the Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry label Apr 17, 2024
Copy link
Contributor

❌ Changelog Entry Missing Hyphen

Changelog entries must begin with a hyphen (-).

@github-actions github-actions bot removed the Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry label Apr 17, 2024
@@ -65,23 +61,14 @@ export const convertApplicationsToFeaturesOrGroups = (
) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems the applications only need id, title and category. Can we remove navLinkStatus and chromeless?

selectedFeatures: string[];
onChange: (newFeatures: string[]) => void;
workspaceConfigurableApps?: PublicAppInfo[];
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems we only need id, title and category for workspaceConfigurableApps here. Could we change to Pick<PublicAppInfo, 'id' | 'title' | 'category'>?

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually I don't see a strong need to turn it into Pick<PublicAppInfo, 'id' | 'title' | 'category'> in this case. I understood that passing minimum set of data to child components is a best practice, but the application which type is PublicAppInfo is provided by the core module, the components expect PublicAppInfo type of data sounds reasonable to me as well.

I'm not holding a strong opinion, what else concerns do you have?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not a big issue. We can keep current implementation.


export const filterWorkspaceConfigurableApps = (applications: PublicAppInfo[]) => {
const visibleApplications = applications.filter(({ navLinkStatus, chromeless, category, id }) => {
return (
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 add some unit tests here to cover this line?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, there will be a followup PR from @yubonluo to cover this.

Copy link
Contributor

❌ Invalid Prefix For Manual Changeset Creation

Invalid description prefix. Found "Fixed applications not displayed in workspace update page ([#6481](https". Only "skip" entry option is permitted for manual commit of changeset files.

If you were trying to skip the changelog entry, please use the "skip" entry option in the ##Changelog section of your PR description.

@github-actions github-actions bot added Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry and removed failed changeset labels Apr 17, 2024
@ZilongX ZilongX self-requested a review April 17, 2024 16:19
@ZilongX
Copy link
Collaborator

ZilongX commented Apr 17, 2024

pick up latest main and re-running all checks now

@ZilongX ZilongX merged commit 4746f43 into opensearch-project:main Apr 17, 2024
65 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Apr 23, 2024
* fix(workspace): apps are missing when updating a workspace

This is caused by #6234 which marked apps as inaccessible when the apps
are not configured into the current workspace. However, inaccessible
apps can not be configured into a workspace.

Signed-off-by: Yulong Ruan <ruanyl@amazon.com>

* refactor(workspace): store workspace configurable apps in a global
variable

Signed-off-by: Yulong Ruan <ruanyl@amazon.com>

* fix linter

Signed-off-by: Yulong Ruan <ruanyl@amazon.com>

---------

Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
Co-authored-by: ZilongX <99905560+ZilongX@users.noreply.github.com>
(cherry picked from commit 4746f43)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
SuZhou-Joe pushed a commit that referenced this pull request Apr 23, 2024
…6606)

* fix(workspace): apps are missing when updating a workspace

This is caused by #6234 which marked apps as inaccessible when the apps
are not configured into the current workspace. However, inaccessible
apps can not be configured into a workspace.



* refactor(workspace): store workspace configurable apps in a global
variable



* fix linter



---------



(cherry picked from commit 4746f43)

Signed-off-by: Yulong Ruan <ruanyl@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: ZilongX <99905560+ZilongX@users.noreply.github.com>
@SuZhou-Joe SuZhou-Joe added the bug Something isn't working label Apr 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x bug Something isn't working in-next repeat-contributor Skip-Changelog PRs that are too trivial to warrant a changelog or release notes entry v2.14.0 workspace
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants