mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-18 07:56:56 +00:00
* refactor: initial setup for list view logs * feat: done with basic functionality panel view logs * feat: added panel view * fix: discard and edit issue * refactor: removed not required params from uselogdata * feat: trace list view * fix: loader * refactor: traces table component css update * refactor: added open san font and udpated css * fix: full view traces issue and search column css update * refactor: remove consoles * refactor: removed commented code and updated logic * chore: build failure * refactor: icons change for apdd panels * refactor: rebased to develop * refactor: added support for light mode * refactor: fix tsc * fix: query select issue * chore: table column to lower case * refactor: updated styling for both log and traces tables * chore: removed comment code * chore: remove the resizable block from table header traces * refactor: log table header and body stayling updated * fix: query range on every column add * refactor: styling updates * fix: query range log respect global time * refactor: css update log table header * refactor: removed unnecessary code * refactor: log query range respect globaltime * refactor: dropdown support to qb * refactor: remove creating alert for list view * refactor: fix the height of column select dropdown * fix: dropdown suggestion for orderby * refactor: remove the commented code * refactor: full view respect global time * refactor: css updates * refactor: should fire query range on variable change * refactor: css updates for log list view * refactor: removed the unused changes * refactor: handle error state for exploere columns * refactor: handle error state for explorer columns * chore: generate yarn lock file * refactor: pagination for order by timestamp * fix: full text body contain issue * refactor: inverted the operator for next and previous button config * refactor: rename variable handle light mode * fix: no log issue * chore: renamed variables --------- Co-authored-by: Vikrant Gupta <vikrant.thomso@gmail.com>
92 lines
2.3 KiB
TypeScript
92 lines
2.3 KiB
TypeScript
import { LeftOutlined, RightOutlined } from '@ant-design/icons';
|
|
import { Button, Select } from 'antd';
|
|
import { DEFAULT_PER_PAGE_OPTIONS, Pagination } from 'hooks/queryPagination';
|
|
import { memo, useMemo } from 'react';
|
|
import { popupContainer } from 'utils/selectPopupContainer';
|
|
|
|
import { defaultSelectStyle } from './config';
|
|
import { Container } from './styles';
|
|
|
|
function Controls({
|
|
offset = 0,
|
|
perPageOptions = DEFAULT_PER_PAGE_OPTIONS,
|
|
isLoading,
|
|
totalCount,
|
|
countPerPage,
|
|
handleNavigatePrevious,
|
|
handleNavigateNext,
|
|
handleCountItemsPerPageChange,
|
|
isLogPanel = false,
|
|
}: ControlsProps): JSX.Element | null {
|
|
const isNextAndPreviousDisabled = useMemo(
|
|
() => isLoading || countPerPage < 0 || totalCount === 0,
|
|
[isLoading, countPerPage, totalCount],
|
|
);
|
|
const isPreviousDisabled = useMemo(
|
|
() => (isLogPanel ? false : offset <= 0 || isNextAndPreviousDisabled),
|
|
[isLogPanel, isNextAndPreviousDisabled, offset],
|
|
);
|
|
const isNextDisabled = useMemo(
|
|
() =>
|
|
isLogPanel ? false : totalCount < countPerPage || isNextAndPreviousDisabled,
|
|
[countPerPage, isLogPanel, isNextAndPreviousDisabled, totalCount],
|
|
);
|
|
|
|
return (
|
|
<Container>
|
|
<Button
|
|
loading={isLoading}
|
|
size="small"
|
|
type="link"
|
|
disabled={isPreviousDisabled}
|
|
onClick={handleNavigatePrevious}
|
|
>
|
|
<LeftOutlined /> Previous
|
|
</Button>
|
|
<Button
|
|
loading={isLoading}
|
|
size="small"
|
|
type="link"
|
|
disabled={isNextDisabled}
|
|
onClick={handleNavigateNext}
|
|
>
|
|
Next <RightOutlined />
|
|
</Button>
|
|
<Select<Pagination['limit']>
|
|
style={defaultSelectStyle}
|
|
loading={isLoading}
|
|
value={countPerPage}
|
|
onChange={handleCountItemsPerPageChange}
|
|
getPopupContainer={popupContainer}
|
|
>
|
|
{perPageOptions.map((count) => (
|
|
<Select.Option
|
|
key={count}
|
|
value={count}
|
|
>{`${count} / page`}</Select.Option>
|
|
))}
|
|
</Select>
|
|
</Container>
|
|
);
|
|
}
|
|
|
|
Controls.defaultProps = {
|
|
offset: 0,
|
|
perPageOptions: DEFAULT_PER_PAGE_OPTIONS,
|
|
isLogPanel: false,
|
|
};
|
|
|
|
export interface ControlsProps {
|
|
offset?: Pagination['offset'];
|
|
perPageOptions?: number[];
|
|
totalCount: number;
|
|
countPerPage: Pagination['limit'];
|
|
isLoading: boolean;
|
|
handleNavigatePrevious: () => void;
|
|
handleNavigateNext: () => void;
|
|
handleCountItemsPerPageChange: (value: Pagination['limit']) => void;
|
|
isLogPanel?: boolean;
|
|
}
|
|
|
|
export default memo(Controls);
|