mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
Removing 'showNavLinks' config option and displaying Avatar menu for serverless (#162140)
## Summary Closes https://github.com/elastic/kibana/issues/160141 The avatar menu needs to be displayed for serverless. It was previously required to be hidden in serverless, so a config 'showNavLinks' was added. This config is no longer needed, so it has been removed. ## Testing Start KB with the `--serverless` flag and login as `elastic`. The Avatar should appear in the top right coner.
This commit is contained in:
parent
f98172291a
commit
7770ccc19f
11 changed files with 67 additions and 10 deletions
|
@ -1,6 +1,5 @@
|
|||
interactiveSetup.enabled: false
|
||||
newsfeed.enabled: false
|
||||
xpack.security.showNavLinks: false
|
||||
xpack.serverless.plugin.enabled: true
|
||||
# Fleet settings
|
||||
xpack.fleet.internal.fleetServerStandalone: true
|
||||
|
|
|
@ -248,7 +248,6 @@ export const ProjectHeader = ({
|
|||
<EuiHeaderSection side="right">
|
||||
<EuiHeaderSectionItem>
|
||||
<HeaderNavControls navControls$={observables.navControlsCenter$} />
|
||||
<HeaderNavControls navControls$={observables.navControlsRight$} />
|
||||
</EuiHeaderSectionItem>
|
||||
|
||||
<EuiHeaderSectionItem>
|
||||
|
@ -263,6 +262,10 @@ export const ProjectHeader = ({
|
|||
navigateToUrl={application.navigateToUrl}
|
||||
/>
|
||||
</EuiHeaderSectionItem>
|
||||
|
||||
<EuiHeaderSectionItem>
|
||||
<HeaderNavControls navControls$={observables.navControlsRight$} />
|
||||
</EuiHeaderSectionItem>
|
||||
</EuiHeaderSection>
|
||||
</EuiHeader>
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ export interface ConfigType {
|
|||
loginAssistanceMessage: string;
|
||||
showInsecureClusterWarning: boolean;
|
||||
sameSiteCookies: 'Strict' | 'Lax' | 'None' | undefined;
|
||||
showNavLinks: boolean;
|
||||
ui: {
|
||||
userManagementEnabled: boolean;
|
||||
roleManagementEnabled: boolean;
|
||||
|
|
|
@ -29,7 +29,6 @@ interface SetupDeps {
|
|||
securityLicense: SecurityLicense;
|
||||
logoutUrl: string;
|
||||
securityApiClients: SecurityApiClients;
|
||||
showNavLinks?: boolean;
|
||||
}
|
||||
|
||||
interface StartDeps {
|
||||
|
@ -55,18 +54,16 @@ export class SecurityNavControlService {
|
|||
private securityApiClients!: SecurityApiClients;
|
||||
|
||||
private navControlRegistered!: boolean;
|
||||
private showNavLinks!: boolean;
|
||||
|
||||
private securityFeaturesSubscription?: Subscription;
|
||||
|
||||
private readonly stop$ = new ReplaySubject<void>(1);
|
||||
private userMenuLinks$ = new BehaviorSubject<UserMenuLink[]>([]);
|
||||
|
||||
public setup({ securityLicense, logoutUrl, securityApiClients, showNavLinks = true }: SetupDeps) {
|
||||
public setup({ securityLicense, logoutUrl, securityApiClients }: SetupDeps) {
|
||||
this.securityLicense = securityLicense;
|
||||
this.logoutUrl = logoutUrl;
|
||||
this.securityApiClients = securityApiClients;
|
||||
this.showNavLinks = showNavLinks;
|
||||
}
|
||||
|
||||
public start({ core, authc }: StartDeps): SecurityNavControlServiceStart {
|
||||
|
@ -75,7 +72,7 @@ export class SecurityNavControlService {
|
|||
const isAnonymousPath = core.http.anonymousPaths.isAnonymous(window.location.pathname);
|
||||
|
||||
const shouldRegisterNavControl =
|
||||
this.showNavLinks && !isAnonymousPath && showLinks && !this.navControlRegistered;
|
||||
!isAnonymousPath && showLinks && !this.navControlRegistered;
|
||||
if (shouldRegisterNavControl) {
|
||||
this.registerSecurityNavControl(core, authc);
|
||||
}
|
||||
|
@ -121,8 +118,9 @@ export class SecurityNavControlService {
|
|||
|
||||
private registerSecurityNavControl(core: CoreStart, authc: AuthenticationServiceSetup) {
|
||||
const { theme$ } = core.theme;
|
||||
|
||||
core.chrome.navControls.registerRight({
|
||||
order: 2000,
|
||||
order: 4000,
|
||||
mount: (element: HTMLElement) => {
|
||||
ReactDOM.render(
|
||||
<Providers
|
||||
|
|
|
@ -109,7 +109,6 @@ export class SecurityPlugin
|
|||
securityLicense: license,
|
||||
logoutUrl: getLogoutUrl(core.http),
|
||||
securityApiClients: this.securityApiClients,
|
||||
showNavLinks: this.config.showNavLinks,
|
||||
});
|
||||
|
||||
this.analyticsService.setup({
|
||||
|
|
|
@ -231,6 +231,22 @@ describe('Config Deprecations', () => {
|
|||
`);
|
||||
});
|
||||
|
||||
it(`warns that 'xpack.security.showNavLinks' is unused`, () => {
|
||||
const config = {
|
||||
xpack: {
|
||||
security: {
|
||||
showNavLinks: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
const { messages } = applyConfigDeprecations(cloneDeep(config));
|
||||
expect(messages).toMatchInlineSnapshot(`
|
||||
Array [
|
||||
"You no longer need to configure \\"xpack.security.showNavLinks\\".",
|
||||
]
|
||||
`);
|
||||
});
|
||||
|
||||
it(`warns that 'xpack.security.authc.providers.saml.<provider-name>.maxRedirectURLSize' is unused`, () => {
|
||||
const config = {
|
||||
xpack: {
|
||||
|
|
|
@ -30,6 +30,7 @@ export const securityConfigDeprecationProvider: ConfigDeprecationProvider = ({
|
|||
|
||||
unused('authorization.legacyFallback.enabled', { level: 'warning' }),
|
||||
unused('authc.saml.maxRedirectURLSize', { level: 'warning' }),
|
||||
unused('showNavLinks', { level: 'warning' }),
|
||||
|
||||
// Deprecation warning for the old array-based format of `xpack.security.authc.providers`.
|
||||
(settings, _fromPath, addDeprecation, { branch }) => {
|
||||
|
|
|
@ -55,6 +55,7 @@ export class ServerlessPlugin
|
|||
const { currentType } = developer.projectSwitcher;
|
||||
|
||||
core.chrome.navControls.registerRight({
|
||||
order: 500,
|
||||
mount: (target) => this.mountProjectSwitcher(target, core, currentType),
|
||||
});
|
||||
}
|
||||
|
|
|
@ -14,5 +14,17 @@ export function SvlCommonPageProvider({ getService }: FtrProviderContext) {
|
|||
async assertProjectHeaderExists() {
|
||||
await testSubjects.existOrFail('kibanaProjectHeader');
|
||||
},
|
||||
|
||||
async clickUserAvatar() {
|
||||
testSubjects.click('userMenuAvatar');
|
||||
},
|
||||
|
||||
async assertUserAvatarExists() {
|
||||
await testSubjects.existOrFail('userMenuAvatar');
|
||||
},
|
||||
|
||||
async assertUserMenuExists() {
|
||||
await testSubjects.existOrFail('userMenu');
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -11,5 +11,8 @@ export default function ({ loadTestFile }: FtrProviderContext) {
|
|||
describe('serverless common UI', function () {
|
||||
loadTestFile(require.resolve('./home_page'));
|
||||
loadTestFile(require.resolve('./management'));
|
||||
|
||||
// platform security
|
||||
loadTestFile(require.resolve('./security/navigation/avatar_menu'));
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { FtrProviderContext } from '../../../../ftr_provider_context';
|
||||
|
||||
export default function ({ getPageObject, getService }: FtrProviderContext) {
|
||||
const svlCommonPage = getPageObject('svlCommonPage');
|
||||
const svlCommonNavigation = getService('svlCommonNavigation');
|
||||
|
||||
describe('Avatar menu', function () {
|
||||
it('is displayed', async () => {
|
||||
await svlCommonNavigation.navigateToKibanaHome();
|
||||
await svlCommonPage.assertUserAvatarExists();
|
||||
});
|
||||
|
||||
it('displays User Menu when clicked', async () => {
|
||||
await svlCommonNavigation.navigateToKibanaHome();
|
||||
await svlCommonPage.clickUserAvatar();
|
||||
await svlCommonPage.assertUserMenuExists();
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue