1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from 'react';
6 import { CustomStyleRulesCallback } from 'common/custom-theme';
7 import { FormControl, Select, MenuItem, Input } from '@mui/material';
8 import { WithStyles } from '@mui/styles';
9 import withStyles from '@mui/styles/withStyles';
10 import { ArvadosTheme } from 'common/custom-theme';
12 type CssRules = 'formControl';
14 const styles: CustomStyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
16 minWidth: theme.spacing(15),
20 export interface FilterOption {
25 export interface ProcessLogFormDataProps {
26 selectedFilter: FilterOption;
27 filters: FilterOption[];
30 export interface ProcessLogFormActionProps {
31 onChange: (filter: FilterOption) => void;
34 type ProcessLogFormProps = ProcessLogFormDataProps & ProcessLogFormActionProps & WithStyles<CssRules>;
36 export const ProcessLogForm = withStyles(styles)(
37 ({ classes, selectedFilter, onChange, filters }: ProcessLogFormProps) =>
38 <form autoComplete="off" data-cy="process-logs-filter">
39 <FormControl className={classes.formControl}>
41 value={selectedFilter.value}
42 onChange={(ev: any) => onChange({ label: ev.target.innerText as string, value: ev.target.value as string })}
43 input={<Input name="eventType" id="log-label-placeholder" />}
47 <MenuItem key={option.value} value={option.value}>{option.label}</MenuItem>