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

feat: workspace level ui settings #328

Merged
merged 6 commits into from
Apr 17, 2024

Conversation

ruanyl
Copy link
Owner

@ruanyl ruanyl commented Apr 12, 2024

When getting ui settings within a workspace, it will combine the workspace ui settings with the global ui settings and workspace ui settings have higher priority if the same setting was defined in both places

When updating ui settings within a workspace, it will update the workspace ui settings, the global ui settings will remain unchanged.

Description

Issues Resolved

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

Copy link
Collaborator

@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 and I think maybe we should create integration test for new wrapper.

Comment on lines 116 to 131
return {
...wrapperOptions.client,
get: getUiSettingsWithWorkspace,
update: updateUiSettingsWithWorkspace,
};
Copy link
Collaborator

@SuZhou-Joe SuZhou-Joe Apr 15, 2024

Choose a reason for hiding this comment

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

It seems some methods of client are inherited through prototype and spreading the methods here may make this missing inside the methods. Better to declare those methods explicitly in each wrapper, though I think it should be an issue for client wrapper.

);

core.savedObjects.addClientWrapper(
-3,
Copy link
Collaborator

@SuZhou-Joe SuZhou-Joe Apr 15, 2024

Choose a reason for hiding this comment

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

A meaningful variable to the magical priority number would help, I merged another backport PR and maybe you can try that pattern.

Copy link
Collaborator

@raintygao raintygao Apr 15, 2024

Choose a reason for hiding this comment

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

Should we declare the order sequence through a comment if there is?

Copy link
Owner Author

Choose a reason for hiding this comment

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

@raintygao right, I'll put a comment

@Hailong-am
Copy link
Collaborator

do we ever have a comparison of workspace level setting as a normal setting object with workspace information vs a property of workspace itself? Thinking of user level setting, this solution may not have enough flexibility.

@ruanyl
Copy link
Owner Author

ruanyl commented Apr 15, 2024

do we ever have a comparison of workspace level setting as a normal setting object with workspace information vs a property of workspace itself?

That's a very good point!
Yes, I've consider the option of making user level ui settings a standalone object associated with workspace. But I end up with the challenge to control the access of this object, because only workspace admin can update ui settings of the workspace. Having ui settings as a property of workspace object seems the most straight forward.

Thinking of user level setting, this solution may not have enough flexibility.

Actually I did think of this as well, I'd imagine user level ui settings is an object with ACL attached. Similar to how we handle workspace ui level in this PR, there could be another wrapper to handle user ui settings. What do you think?

Can you share more about your concerns? Don't know if I missed any corner cases.

@Hailong-am
Copy link
Collaborator

Hailong-am commented Apr 15, 2024

only workspace admin can update ui settings of the workspace

I see, that's the point. thanks for explanation.

Similar to how we handle workspace ui level in this PR, there could be another wrapper to handle user ui settings. What do you think?

As we don't have a user object in kibana index, to save user level setting, we either reuse existing setting object type and associate it with user information. Base on this assumption, i am thinking workspace level setting could do same way. However, permission control is a issue.

Can you share more about your concerns?

one thing is that is there a case user need to export/import this kind of setting? For now, workspace itself is not exportable.

@wanglam
Copy link
Collaborator

wanglam commented Apr 15, 2024

LGTM

ruanyl added 3 commits April 15, 2024 20:28
When getting ui settings within a workspace, it will combine the workspace ui settings with
the global ui settings and workspace ui settings have higher priority if the same setting
was defined in both places

When updating ui settings within a workspace, it will update the workspace ui settings,
the global ui settings will remain unchanged.

Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
@ruanyl ruanyl force-pushed the feature/workspace-ui-settings branch from 615ee00 to cf49d79 Compare April 15, 2024 12:28
ruanyl and others added 3 commits April 16, 2024 15:39
Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
…gs_client_wrapper.ts

Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
@ruanyl ruanyl merged commit 32fab61 into workspace-pr-integr Apr 17, 2024
76 checks passed
ruanyl added a commit that referenced this pull request Apr 17, 2024
When getting ui settings within a workspace, it will combine the workspace ui settings with
the global ui settings and workspace ui settings have higher priority if the same setting
was defined in both places

When updating ui settings within a workspace, it will update the workspace ui settings,
the global ui settings will remain unchanged.

Signed-off-by: Yulong Ruan <ruanyl@amazon.com>
ruanyl added a commit that referenced this pull request Apr 17, 2024
When getting ui settings within a workspace, it will combine the workspace ui settings with
the global ui settings and workspace ui settings have higher priority if the same setting
was defined in both places

When updating ui settings within a workspace, it will update the workspace ui settings,
the global ui settings will remain unchanged.

Signed-off-by: Yulong Ruan <ruanyl@amazon.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.

5 participants