mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Fixes #24135 This PR closes the space selector popover after clicking the Manage Spaces button. Previously, the popover would stay open, which is confusing and annoying
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
/*
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
* or more contributor license agreements. Licensed under the Elastic License;
|
|
* you may not use this file except in compliance with the Elastic License.
|
|
*/
|
|
|
|
import { EuiButton } from '@elastic/eui';
|
|
import React, { Component, CSSProperties } from 'react';
|
|
import { UserProfile } from '../../../xpack_main/public/services/user_profile';
|
|
import { MANAGE_SPACES_URL } from '../lib/constants';
|
|
|
|
interface Props {
|
|
isDisabled?: boolean;
|
|
size?: 's' | 'l';
|
|
style?: CSSProperties;
|
|
userProfile: UserProfile;
|
|
onClick?: () => void;
|
|
}
|
|
|
|
export class ManageSpacesButton extends Component<Props, {}> {
|
|
public render() {
|
|
if (!this.props.userProfile.hasCapability('manageSpaces')) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<EuiButton
|
|
size={this.props.size || 's'}
|
|
className="manage-spaces-button"
|
|
isDisabled={this.props.isDisabled}
|
|
onClick={this.navigateToManageSpaces}
|
|
style={this.props.style}
|
|
>
|
|
Manage spaces
|
|
</EuiButton>
|
|
);
|
|
}
|
|
|
|
private navigateToManageSpaces = () => {
|
|
if (this.props.onClick) {
|
|
this.props.onClick();
|
|
}
|
|
window.location.replace(MANAGE_SPACES_URL);
|
|
};
|
|
}
|