-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Changes from 15 commits
607cee4
54eb873
a5532f9
1ab5558
ba0a842
65f4017
2f4df52
41f5fa1
fd7e40e
56a3fd0
ec9e5d3
6698bb8
7c1f14e
ade6b03
8ea4765
4cedff5
d07844e
0f82e23
28c6bb6
45655b1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,10 +17,14 @@ import { SpacesPlugin } from './plugin'; | |
|
||
describe('Spaces plugin', () => { | ||
describe('#setup', () => { | ||
it('should register the spaces API and the space selector app', () => { | ||
it('should register the spaces API and the space selector app when buildFlavor is traditional', () => { | ||
SiddharthMantri marked this conversation as resolved.
Show resolved
Hide resolved
|
||
const coreSetup = coreMock.createSetup(); | ||
const mockInitializerContext = coreMock.createPluginInitializerContext( | ||
{}, | ||
{ buildFlavor: 'traditional' } | ||
); | ||
|
||
const plugin = new SpacesPlugin(coreMock.createPluginInitializerContext()); | ||
const plugin = new SpacesPlugin(mockInitializerContext); | ||
plugin.setup(coreSetup, {}); | ||
|
||
expect(coreSetup.application.register).toHaveBeenCalledWith( | ||
|
@@ -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', () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @SiddharthMantri The same wording is used on line 20. |
||
const coreSetup = coreMock.createSetup(); | ||
|
||
const plugin = new SpacesPlugin(coreMock.createPluginInitializerContext()); | ||
plugin.setup(coreSetup, {}); | ||
|
||
expect(coreSetup.application.register).not.toHaveBeenCalledWith( | ||
expect.objectContaining({ | ||
id: 'space_selector', | ||
chromeless: true, | ||
appRoute: '/spaces/space_selector', | ||
mount: expect.any(Function), | ||
}) | ||
); | ||
}); | ||
|
||
it('should register the management and feature catalogue sections when the management and home plugins are both available when buildFlavor is traditional', () => { | ||
const coreSetup = coreMock.createSetup(); | ||
const home = homePluginMock.createSetupContract(); | ||
|
||
|
@@ -43,7 +63,12 @@ describe('Spaces plugin', () => { | |
|
||
management.sections.section.kibana = mockSection; | ||
|
||
const plugin = new SpacesPlugin(coreMock.createPluginInitializerContext()); | ||
const mockInitializerContext = coreMock.createPluginInitializerContext( | ||
{}, | ||
{ buildFlavor: 'traditional' } | ||
); | ||
|
||
const plugin = new SpacesPlugin(mockInitializerContext); | ||
plugin.setup(coreSetup, { | ||
management, | ||
home, | ||
|
@@ -62,19 +87,66 @@ describe('Spaces plugin', () => { | |
}) | ||
); | ||
}); | ||
|
||
it('should not register spaces in the management plugin or the feature catalog when the management and home plugins are both available when buildFlavor is serverless', () => { | ||
const coreSetup = coreMock.createSetup(); | ||
const home = homePluginMock.createSetupContract(); | ||
|
||
const management = managementPluginMock.createSetupContract(); | ||
const mockSection = createManagementSectionMock(); | ||
mockSection.registerApp = jest.fn(); | ||
|
||
management.sections.section.kibana = mockSection; | ||
|
||
const plugin = new SpacesPlugin(coreMock.createPluginInitializerContext()); | ||
plugin.setup(coreSetup, { | ||
management, | ||
home, | ||
}); | ||
|
||
expect(mockSection.registerApp).not.toHaveBeenCalledWith( | ||
expect.objectContaining({ id: 'spaces' }) | ||
); | ||
|
||
expect(home.featureCatalogue.register).not.toHaveBeenCalledWith( | ||
expect.objectContaining({ | ||
category: 'admin', | ||
icon: 'spacesApp', | ||
id: 'spaces', | ||
showOnHomePage: false, | ||
}) | ||
); | ||
}); | ||
}); | ||
|
||
describe('#start', () => { | ||
it('should register the spaces nav control', () => { | ||
it('should register the spaces nav control when buildFlavor is traditional', () => { | ||
const coreSetup = coreMock.createSetup(); | ||
const coreStart = coreMock.createStart(); | ||
|
||
const plugin = new SpacesPlugin(coreMock.createPluginInitializerContext()); | ||
const mockInitializerContext = coreMock.createPluginInitializerContext( | ||
{}, | ||
{ buildFlavor: 'traditional' } | ||
); | ||
|
||
const plugin = new SpacesPlugin(mockInitializerContext); | ||
plugin.setup(coreSetup, {}); | ||
|
||
plugin.start(coreStart); | ||
|
||
expect(coreStart.chrome.navControls.registerLeft).toHaveBeenCalled(); | ||
}); | ||
|
||
it('should not register the spaces nav control when buildFlavor is serverless', () => { | ||
const coreSetup = coreMock.createSetup(); | ||
const coreStart = coreMock.createStart(); | ||
|
||
const plugin = new SpacesPlugin(coreMock.createPluginInitializerContext()); | ||
plugin.setup(coreSetup, {}); | ||
|
||
plugin.start(coreStart); | ||
|
||
expect(coreStart.chrome.navControls.registerLeft).not.toHaveBeenCalled(); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, this is fine.