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

Remove Space Selector from Serverless Top Navigation #164461

Merged

Conversation

SiddharthMantri
Copy link
Contributor

@SiddharthMantri SiddharthMantri commented Aug 22, 2023

Closes #163024

Summary

For Serverless projects, there will be only a single default space, with no way to create/select additional spaces. For this reason, the spaces navigation control has been removed for serverless only

Changes Made

  • Added isServerless boolean flag to depend on the plugin context buildFlavor in the Serverless plugin
  • Based on the flag
    • Disabled rendering of spaces nav control
    • Disabled the space management route
    • Disabled adding spaces to feature catalogue
  • Updated plugin tests to check for serverless or traditional build flavors

UI Changes

Before After
image image

Release Notes

Security
Removed the space selector from the Serverless UI. #163024

@SiddharthMantri
Copy link
Contributor Author

@azasypkin @thomheymann I wonder if it's better to do it the way i've done in this PR or pass a isSpaceSelectorDisabled prop to this function

export function initSpacesNavControl(spacesManager: SpacesManager, core: CoreStart) {

@SiddharthMantri SiddharthMantri marked this pull request as ready for review August 23, 2023 11:47
@SiddharthMantri SiddharthMantri requested a review from a team as a code owner August 23, 2023 11:47
@kc13greiner kc13greiner self-requested a review August 24, 2023 19:57
Copy link
Contributor

@kc13greiner kc13greiner left a comment

Choose a reason for hiding this comment

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

Looking good - just a few questions, don't hesitate to reach out if my comments aren't clear 😅

x-pack/plugins/spaces/public/plugin.test.ts Outdated Show resolved Hide resolved
x-pack/plugins/spaces/public/plugin.test.ts Outdated Show resolved Hide resolved
x-pack/plugins/spaces/public/plugin.test.ts Outdated Show resolved Hide resolved
plugins.home.featureCatalogue.register(createSpacesFeatureCatalogueEntry());
}

if (plugins.management) {
if (plugins.management && !this.isServerless) {
Copy link
Contributor

Choose a reason for hiding this comment

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

questions: Should the spaceSelectorApp.create(...) call below also be in a !isServerless block?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kc13greiner I think you're right. I added the check just below this

Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome! Let's double check w/ @thomheymann

One additional nit: could the !isServerless check be pulled out into a top level if statement that wraps these blocks/statements?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kc13greiner Absolutely! Just updated!

Copy link
Contributor

Choose a reason for hiding this comment

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

The spaces selector app exposes a route that can be accessed to view all spaces and to select a different space.

This is only linked to from the space selector and when deleting the current space as far as I can see so I think this can be safely disabled on serverless.

@SiddharthMantri SiddharthMantri requested a review from a team as a code owner August 29, 2023 08:42
@SiddharthMantri SiddharthMantri added the Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! label Aug 29, 2023
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-security (Team:Security)

@SiddharthMantri SiddharthMantri added the backport:skip This commit does not require backporting label Aug 29, 2023
Copy link
Contributor

@kc13greiner kc13greiner left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@jeramysoucy jeramysoucy left a comment

Choose a reason for hiding this comment

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

Overall looks great. Just two things.

  1. I was confused about the tests regarding the spaces API. Don't these test just check whether the space selector application is registered?

2. I think we should augment the serverless test suite to confirm the UI layout does not include the space selector. Maybe in x-pack/test_serverless/functional/page_objects/svl_common_page.ts As discussed in our sync, we don't really need this - too short term, and does not add value. Sorry about that.

@@ -33,7 +37,23 @@ describe('Spaces plugin', () => {
);
});

it('should register the management and feature catalogue sections when the management and home plugins are both available', () => {
it('should not register the spaces API and the space selector app when buildFlavor is serverless', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is meant by spaces API here? Doesn't this test confirm only the space selector app registration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jeramysoucy You're right! I changed the label to make it clear. It should say spaces routes and not API.

Copy link
Contributor

@jeramysoucy jeramysoucy Aug 29, 2023

Choose a reason for hiding this comment

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

@SiddharthMantri The same wording is used on line 20.

@SiddharthMantri SiddharthMantri added release_note:skip Skip the PR/issue when compiling release notes and removed release_note:enhancement labels Aug 29, 2023
const createPluginInitializerContextMock = (config: unknown = {}) => {
const createPluginInitializerContextMock = (
config: unknown = {},
{ buildFlavor = 'serverless' }: { buildFlavor?: BuildFlavor } = {}
Copy link
Contributor

@TinaHeiligers TinaHeiligers Aug 29, 2023

Choose a reason for hiding this comment

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

For UI-only changes, using the config should be ok although core now has an elasticsearch capabilities API that gets info from the cluster directly.

The new API is better than using a config flag because KIbana's sometimes run against a stateful ES instance. @pgayvallet is the capabilities API meant to be used instead?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yea, this is fine.

@TinaHeiligers TinaHeiligers self-requested a review August 29, 2023 19:41
Copy link
Contributor

@TinaHeiligers TinaHeiligers left a comment

Choose a reason for hiding this comment

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

LGTM

const createPluginInitializerContextMock = (config: unknown = {}) => {
const createPluginInitializerContextMock = (
config: unknown = {},
{ buildFlavor = 'serverless' }: { buildFlavor?: BuildFlavor } = {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Yea, this is fine.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/core-plugins-browser-mocks 6 7 +1

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
spaces 24.3KB 24.4KB +157.0B
Unknown metric groups

API count

id before after diff
@kbn/core-plugins-browser-mocks 6 7 +1

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@SiddharthMantri SiddharthMantri merged commit 0c3d38b into elastic:main Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Security/Spaces Platform Security - Spaces feature release_note:skip Skip the PR/issue when compiling release notes Team:Security Team focused on: Auth, Users, Roles, Spaces, Audit Logging, and more! v8.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove Space Selector from Serverless Top Navigation
10 participants