Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | 6x | import { Dropdown, Menu, Space, Tag } from "antd";
import React, {ReactElement} from "react";
import {useTranslation} from "react-i18next";
import { ClockCircleOutlined, ReloadOutlined } from "@ant-design/icons";
import {getRefreshIntervalDisplay} from "@utils/StringUtils";
const RefreshIntervalSelect = (props: {
refreshInterval?: number;
setRefreshIntervalCallback: (interval?: number) => void;
}): ReactElement => {
const {refreshInterval, setRefreshIntervalCallback} = props;
const {t} = useTranslation();
const menu = (
<Menu>
{[undefined, 10, 60, 120, 300, 900].map((interval: number | undefined) =>
<Menu.Item key={interval ?? "no_auto_refresh"}
onClick={() => setRefreshIntervalCallback(interval)}>
<Space><ClockCircleOutlined />{getRefreshIntervalDisplay(interval)}</Space>
</Menu.Item>
)}
</Menu>);
return (
<Dropdown overlay={menu} trigger={["click"]}>
<Tag><ReloadOutlined/>{t('Refresh interval', {interval: getRefreshIntervalDisplay(refreshInterval)})}</Tag>
</Dropdown>
);
};
export default RefreshIntervalSelect; |