Skip to content

Commit

Permalink
Added loading message to spaces navigation.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeramysoucy committed Jul 25, 2022
1 parent f52def9 commit 9c5dad1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
12 changes: 11 additions & 1 deletion x-pack/plugins/spaces/public/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,20 @@ export const getSpacesFeatureDescription = () => {
'Organize your dashboards and other saved objects into meaningful categories.',
});
}

return spacesFeatureDescription;
};

let spacesLoadingMessage: string;

export const getSpacesLoadingMessage = () => {
if (!spacesLoadingMessage) {
spacesLoadingMessage = i18n.translate('xpack.spaces.loadingMessage', {
defaultMessage: 'Loading...',
});
}
return spacesLoadingMessage;
};

export const DEFAULT_OBJECT_NOUN = i18n.translate('xpack.spaces.shareToSpace.objectNoun', {
defaultMessage: 'object',
});
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ import React from 'react';

import type { ApplicationStart, Capabilities } from '@kbn/core/public';

import { getSpacesFeatureDescription } from '../../constants';
import { getSpacesFeatureDescription, getSpacesLoadingMessage } from '../../constants';
import { ManageSpacesButton } from './manage_spaces_button';

interface Props {
id: string;
isLoading: boolean;
toggleSpaceSelector: () => void;
capabilities: Capabilities;
navigateToApp: ApplicationStart['navigateToApp'];
Expand All @@ -33,7 +34,7 @@ export const SpacesDescription: FC<Props> = (props: Props) => {
return (
<EuiContextMenuPanel {...panelProps}>
<EuiText className="spcDescription__text">
<p>{getSpacesFeatureDescription()}</p>
<p>{props.isLoading ? getSpacesLoadingMessage() : getSpacesFeatureDescription()}</p>
</EuiText>
<div key="manageSpacesButton" className="spcDescription__manageButtonWrapper">
<ManageSpacesButton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export class NavControlPopover extends Component<Props, State> {
element = (
<SpacesDescription
id={popoutContentId}
isLoading={this.state.loading}
toggleSpaceSelector={this.toggleSpaceSelector}
capabilities={this.props.capabilities}
navigateToApp={this.props.navigateToApp}
Expand Down

0 comments on commit 9c5dad1

Please sign in to comment.