From 0246d48584ca08809e8d5fea5759d40eca82717f Mon Sep 17 00:00:00 2001 From: Ali BARIN Date: Thu, 1 Sep 2022 18:45:30 +0200 Subject: [PATCH] feat: show test runs in executions --- .../web/src/components/ExecutionRow/index.tsx | 12 ++++++++++-- .../web/src/components/ExecutionRow/style.ts | 4 ++++ .../src/components/ExecutionStep/index.tsx | 2 +- .../web/src/components/FlowSubstep/index.tsx | 19 ------------------- .../web/src/components/InputCreator/index.tsx | 5 +---- .../web/src/components/LoginForm/index.tsx | 7 +------ .../web/src/components/PowerInput/index.tsx | 2 +- .../web/src/helpers/authenticationSteps.ts | 1 - packages/web/src/locales/en.json | 1 + packages/web/src/pages/Executions/index.tsx | 1 - 10 files changed, 19 insertions(+), 35 deletions(-) diff --git a/packages/web/src/components/ExecutionRow/index.tsx b/packages/web/src/components/ExecutionRow/index.tsx index ccabac6f..a949de12 100644 --- a/packages/web/src/components/ExecutionRow/index.tsx +++ b/packages/web/src/components/ExecutionRow/index.tsx @@ -1,9 +1,8 @@ import * as React from 'react'; import { Link } from 'react-router-dom'; import Card from '@mui/material/Card'; -import Box from '@mui/material/Box'; -import Stack from '@mui/material/Stack'; import CardActionArea from '@mui/material/CardActionArea'; +import Chip from '@mui/material/Chip'; import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos'; import { DateTime } from 'luxon'; import type { IExecution } from '@automatisch/types'; @@ -49,6 +48,15 @@ export default function ExecutionRow(props: ExecutionRowProps): React.ReactEleme + {execution.testRun && ( + + )} + theme.palette.primary.main }} /> diff --git a/packages/web/src/components/ExecutionRow/style.ts b/packages/web/src/components/ExecutionRow/style.ts index e679040e..09f59802 100644 --- a/packages/web/src/components/ExecutionRow/style.ts +++ b/packages/web/src/components/ExecutionRow/style.ts @@ -31,6 +31,10 @@ export const Title = styled(MuiStack)(() => ({ })); export const ArrowContainer = styled(MuiBox)(() => ({ + flexDirection: 'row', + display: 'flex', + alignItems: 'center', + gap: 10, gridArea: 'arrow-container', })); export const Typography = styled(MuiTypography)(() => ({ diff --git a/packages/web/src/components/ExecutionStep/index.tsx b/packages/web/src/components/ExecutionStep/index.tsx index d7d2bb2a..3016fc84 100644 --- a/packages/web/src/components/ExecutionStep/index.tsx +++ b/packages/web/src/components/ExecutionStep/index.tsx @@ -27,7 +27,7 @@ const validIcon = ; const errorIcon = ; export default function ExecutionStep(props: ExecutionStepProps): React.ReactElement | null { - const { executionStep, index, } = props; + const { executionStep, } = props; const [activeTabIndex, setActiveTabIndex] = React.useState(0); const step: IStep = executionStep.step; const isTrigger = step.type === 'trigger'; diff --git a/packages/web/src/components/FlowSubstep/index.tsx b/packages/web/src/components/FlowSubstep/index.tsx index 56966da5..a3d3ec90 100644 --- a/packages/web/src/components/FlowSubstep/index.tsx +++ b/packages/web/src/components/FlowSubstep/index.tsx @@ -43,7 +43,6 @@ function FlowSubstep(props: FlowSubstepProps): React.ReactElement { expanded = false, onExpand, onCollapse, - onChange, onSubmit, step, } = props; @@ -57,24 +56,6 @@ function FlowSubstep(props: FlowSubstepProps): React.ReactElement { const formContext = useFormContext(); const [validationStatus, setValidationStatus] = React.useState(validateSubstep(substep, formContext.getValues() as IStep)); - const handleChangeOnBlur = React.useCallback((key: string) => { - return (value: string) => { - const currentValue = step.parameters?.[key]; - - if (currentValue !== value) { - onChange({ - step: { - ...step, - parameters: { - ...step.parameters, - [key]: value, - } - }, - }); - } - } - }, [step, onChange]); - React.useEffect(() => { function validate (step: unknown) { const validationResult = validateSubstep(substep, step as IStep); diff --git a/packages/web/src/components/InputCreator/index.tsx b/packages/web/src/components/InputCreator/index.tsx index 6c1469fc..cfedf0f3 100644 --- a/packages/web/src/components/InputCreator/index.tsx +++ b/packages/web/src/components/InputCreator/index.tsx @@ -1,10 +1,8 @@ import * as React from 'react'; -import { useLazyQuery } from '@apollo/client'; import MuiTextField from '@mui/material/TextField'; -import type { IField, IFieldDropdown, IFieldDropdownOption, IJSONObject } from '@automatisch/types'; +import type { IField, IFieldDropdownOption } from '@automatisch/types'; import useDynamicData from 'hooks/useDynamicData'; -import { GET_DATA } from 'graphql/queries/get-data'; import PowerInput from 'components/PowerInput'; import TextField from 'components/TextField'; import ControlledAutocomplete from 'components/ControlledAutocomplete'; @@ -23,7 +21,6 @@ type RawOption = { value: string; }; -const computeArguments = (args: IFieldDropdown["source"]["arguments"]): IJSONObject => args.reduce((result, { name, value }) => ({ ...result, [name as string]: value }), {}); const optionGenerator = (options: RawOption[]): IFieldDropdownOption[] => options?.map(({ name, value }) => ({ label: name as string, value: value })); const getOption = (options: IFieldDropdownOption[], value: string) => options?.find(option => option.value === value); diff --git a/packages/web/src/components/LoginForm/index.tsx b/packages/web/src/components/LoginForm/index.tsx index 2bd05084..38e91923 100644 --- a/packages/web/src/components/LoginForm/index.tsx +++ b/packages/web/src/components/LoginForm/index.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { useNavigate } from 'react-router-dom'; import { useMutation } from '@apollo/client'; -import { UseFormReturn } from 'react-hook-form'; import Paper from '@mui/material/Paper'; import Typography from '@mui/material/Typography'; import LoadingButton from '@mui/lab/LoadingButton'; @@ -12,15 +11,11 @@ import { LOGIN } from 'graphql/mutations/login'; import Form from 'components/Form'; import TextField from 'components/TextField'; -type FormValues = { - email: string; - password: string; -} function renderFields(props: { loading: boolean }) { const { loading = false } = props; - return (methods: UseFormReturn) => { + return () => { return ( <> { control={control} defaultValue={defaultValue} shouldUnregister={false} - render={({ field: { value, ref, onChange: controllerOnChange, onBlur: controllerOnBlur, ...field } }) => ( + render={({ field: { value, onChange: controllerOnChange, onBlur: controllerOnBlur, } }) => (