import styled from '@emotion/styled'; import {Button} from 'sentry/components/button'; import ButtonBar from 'sentry/components/buttonBar'; import SelectControl from 'sentry/components/forms/controls/selectControl'; import InternalStatChart from 'sentry/components/internalStatChart'; import {Panel, PanelBody, PanelHeader} from 'sentry/components/panels'; import AsyncView from 'sentry/views/asyncView'; const TIME_WINDOWS = ['1h', '1d', '1w'] as const; type TimeWindow = (typeof TIME_WINDOWS)[number]; type State = AsyncView['state'] & { activeTask: string; resolution: string; since: number; taskList: string[]; taskName: string; timeWindow: TimeWindow; }; export default class AdminQueue extends AsyncView<{}, State> { getDefaultState() { return { ...super.getDefaultState(), timeWindow: '1w', since: new Date().getTime() / 1000 - 3600 * 24 * 7, resolution: '1h', taskName: null, }; } getEndpoints(): ReturnType { return [['taskList', '/internal/queue/tasks/']]; } changeWindow(timeWindow: TimeWindow) { let seconds: number; if (timeWindow === '1h') { seconds = 3600; } else if (timeWindow === '1d') { seconds = 3600 * 24; } else if (timeWindow === '1w') { seconds = 3600 * 24 * 7; } else { throw new Error('Invalid time window'); } this.setState({ since: new Date().getTime() / 1000 - seconds, timeWindow, }); } changeTask(value: string) { this.setState({activeTask: value}); } renderBody() { const {activeTask, taskList} = this.state; return (

Queue Overview

{TIME_WINDOWS.map(r => ( ))}
Global Throughput

Task Details

this.changeTask(value)} value={activeTask} clearable options={taskList.map(value => ({value, label: value}))} />
{activeTask ? (
Jobs Started {activeTask} Jobs Finished {activeTask}
) : null}
); } } const Header = styled('div')` display: flex; justify-content: space-between; align-items: center; `;