grafana/public/app/features/logs/components/log-context/LoadingIndicator.tsx
Gábor Farkas 9ca888527b
Logs: Implement "infinite" scrolling in log context (#69459)
* logs: context: allow "infinite" scroll

* Log Context: Add visual changes to infinite scrolling (#70461)

* remove text showing how many log lines are loaded

* better positioning of loading indicators

* add border

* fix import

* better loading states

* improve corner cases

* increase page size 10 => 50

* updated unit test, simplified code

* fixed tests

* updated tests

* removed unused code

* fixed test

* improved refid-handling in loki

* removed unnecessary code

* better variable name

* refactor

* refactor

---------

Co-authored-by: Sven Grossmann <sven.grossmann@grafana.com>
2023-06-28 11:51:16 +03:00

30 lines
631 B
TypeScript

import { css } from '@emotion/css';
import React from 'react';
import { Spinner } from '@grafana/ui';
import { Place } from './types';
// ideally we'd use `@grafana/ui/LoadingPlaceholder`, but that
// one has a large margin-bottom.
type Props = {
place: Place;
};
export const LoadingIndicator = ({ place }: Props) => {
const text = place === 'above' ? 'Loading newer logs...' : 'Loading older logs...';
return (
<div className={loadingIndicatorStyles}>
<div>
{text} <Spinner inline />
</div>
</div>
);
};
const loadingIndicatorStyles = css`
display: flex;
justify-content: center;
`;