Skip to content

Commit

Permalink
Add loading spinner
Browse files Browse the repository at this point in the history
  • Loading branch information
smith committed Sep 28, 2020
1 parent 218dd34 commit cdd8752
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions x-pack/plugins/apm/public/components/app/ServiceMap/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
import { EuiFlexGroup, EuiFlexItem, EuiLoadingSpinner } from '@elastic/eui';
import React, { ReactNode } from 'react';
import { useTrackPageview } from '../../../../../observability/public';
import {
Expand Down Expand Up @@ -47,6 +47,15 @@ function PromptContainer({ children }: { children: ReactNode }) {
);
}

function LoadingSpinner() {
return (
<EuiLoadingSpinner
size="xl"
style={{ position: 'absolute', top: '50%', left: '50%' }}
/>
);
}

export function ServiceMap({ serviceName }: ServiceMapProps) {
const theme = useTheme();
const license = useLicense();
Expand Down Expand Up @@ -109,13 +118,14 @@ export function ServiceMap({ serviceName }: ServiceMapProps) {
ref={ref}
>
<Cytoscape
elements={data?.elements ?? []}
elements={data.elements}
height={height}
serviceName={serviceName}
style={getCytoscapeDivStyle(theme)}
>
<Controls />
{serviceName && <EmptyBanner />}
{status === FETCH_STATUS.LOADING && <LoadingSpinner />}
<Popover focusedServiceName={serviceName} />
</Cytoscape>
</div>
Expand Down

0 comments on commit cdd8752

Please sign in to comment.