Skip to content

Commit 0948eec

Browse files
committed
Run npm run fix
1 parent 911d7b2 commit 0948eec

File tree

8 files changed

+208
-139
lines changed

8 files changed

+208
-139
lines changed

frontend/src/components/trigger/ActionForm.tsx

+34-28
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import {
66
TriggerActionValue,
77
} from "@dmm-com/airone-apiclient-typescript-fetch";
88
import AddIcon from "@mui/icons-material/Add";
9-
import AddCircleIcon from '@mui/icons-material/AddCircle';
10-
import CancelIcon from '@mui/icons-material/Cancel';
9+
import AddCircleIcon from "@mui/icons-material/AddCircle";
10+
import CancelIcon from "@mui/icons-material/Cancel";
1111
import DeleteOutlineIcon from "@mui/icons-material/DeleteOutline";
1212
import {
1313
Box,
@@ -22,9 +22,10 @@ import {
2222
import { styled } from "@mui/material/styles";
2323
import React, { FC } from "react";
2424
import { Control, Controller, useFieldArray } from "react-hook-form";
25-
import { ReferralsAutocomplete } from "components/entry/entryForm/ReferralsAutocomplete";
2625

2726
import { Schema } from "./TriggerFormSchema";
27+
28+
import { ReferralsAutocomplete } from "components/entry/entryForm/ReferralsAutocomplete";
2829
import { isSupportedType } from "services/trigger/Edit";
2930

3031
interface Props {
@@ -49,18 +50,20 @@ interface PropsActionValueComponent {
4950
actionValue: TriggerActionValue;
5051
}
5152

52-
interface PropsActionValueComponentWithAttrId extends PropsActionValueComponent {
53+
interface PropsActionValueComponentWithAttrId
54+
extends PropsActionValueComponent {
5355
attrId: number;
5456
}
5557

56-
interface PropsActionValueComponentWithEntity extends PropsActionValueComponent {
58+
interface PropsActionValueComponentWithEntity
59+
extends PropsActionValueComponent {
5760
entity: EntityDetail;
5861
actionField: TriggerAction;
5962
handleAddInputValue: (index: number) => void;
6063
handleDelInputValue: (index: number) => void;
6164
}
6265

63-
const StyledBox = styled(Box)(({ }) => ({
66+
const StyledBox = styled(Box)(({}) => ({
6467
display: "flex",
6568
width: "100%",
6669
gap: "0 12px",
@@ -70,17 +73,15 @@ const ActionValueAsString: FC<PropsActionValueComponent> = ({
7073
indexAction,
7174
indexActionValue,
7275
control,
73-
actionValue
76+
actionValue,
7477
}) => {
7578
return (
7679
<Controller
7780
name={`actions.${indexAction}.values.${indexActionValue}.strCond`}
7881
defaultValue={actionValue.strCond ?? ""}
7982
control={control}
8083
render={({ field }) => {
81-
return (
82-
<TextField {...field} variant="standard" fullWidth />
83-
)
84+
return <TextField {...field} variant="standard" fullWidth />;
8485
}}
8586
/>
8687
);
@@ -150,7 +151,6 @@ const ActionValueInputForm: FC<PropsActionValueComponentWithEntity> = ({
150151
handleAddInputValue,
151152
handleDelInputValue,
152153
}) => {
153-
154154
const attrInfo = entity.attrs.find((attr) => attr.id === actionField.attr.id);
155155
switch (attrInfo?.type) {
156156
case EntryAttributeTypeTypeEnum.STRING:
@@ -226,7 +226,7 @@ const ActionValueInputForm: FC<PropsActionValueComponentWithEntity> = ({
226226
</StyledBox>
227227
);
228228
}
229-
}
229+
};
230230

231231
const ActionValue: FC<PropsActionValue> = ({
232232
indexAction,
@@ -246,12 +246,12 @@ const ActionValue: FC<PropsActionValue> = ({
246246
strCond: "",
247247
refCond: null,
248248
});
249-
}
249+
};
250250
const handleDelActionValue = (index: number) => {
251251
remove(index);
252252

253253
fields.length === 1 && handleAddActionValue(0);
254-
}
254+
};
255255

256256
return (
257257
<>
@@ -293,27 +293,31 @@ export const ActionForm: FC<Props> = ({
293293
name: "",
294294
type: 0,
295295
},
296-
values: [{
297-
id: 0,
298-
strCond: "",
299-
refCond: null,
300-
boolCond: undefined,
301-
}]
302-
})
296+
values: [
297+
{
298+
id: 0,
299+
strCond: "",
300+
refCond: null,
301+
boolCond: undefined,
302+
},
303+
],
304+
});
303305
};
304306

305307
return (
306308
<>
307309
{fields.map((actionField, index) => {
308310
return (
309-
<Controller key={actionField.key}
311+
<Controller
312+
key={actionField.key}
310313
name={`actions.${index}.attr.id`}
311314
control={control}
312315
defaultValue={actionField.attr.id}
313316
render={({ field }) => (
314317
<TableRow>
315318
<TableCell>
316-
<Select {...field}
319+
<Select
320+
{...field}
317321
size="small"
318322
fullWidth
319323
onChange={(e) => {
@@ -323,11 +327,13 @@ export const ActionForm: FC<Props> = ({
323327
resetActionValues(index);
324328
}}
325329
>
326-
{entity.attrs.filter((attr) => isSupportedType(attr)).map((attr) => (
327-
<MenuItem key={attr.id} value={attr.id}>
328-
{attr.name}
329-
</MenuItem>
330-
))}
330+
{entity.attrs
331+
.filter((attr) => isSupportedType(attr))
332+
.map((attr) => (
333+
<MenuItem key={attr.id} value={attr.id}>
334+
{attr.name}
335+
</MenuItem>
336+
))}
331337
</Select>
332338
</TableCell>
333339
<TableCell>

frontend/src/components/trigger/Conditions.tsx

+27-13
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ import {
1717
TextField,
1818
Typography,
1919
} from "@mui/material";
20+
import { styled } from "@mui/material/styles";
2021
import React, { FC } from "react";
2122
import { Control, Controller, useFieldArray } from "react-hook-form";
22-
import { ReferralsAutocomplete } from "components/entry/entryForm/ReferralsAutocomplete";
2323

2424
import { Schema } from "./TriggerFormSchema";
25-
import { styled } from "@mui/material/styles";
26-
import { isSupportedType } from "services/trigger/Edit";
2725

26+
import { ReferralsAutocomplete } from "components/entry/entryForm/ReferralsAutocomplete";
27+
import { isSupportedType } from "services/trigger/Edit";
2828

29-
const StyledTypography = styled(Typography)(({ }) => ({
29+
const StyledTypography = styled(Typography)(({}) => ({
3030
color: "rgba(0, 0, 0, 0.6)",
3131
}));
3232

33-
const StyledBox = styled(Box)(({ }) => ({
33+
const StyledBox = styled(Box)(({}) => ({
3434
display: "flex",
3535
alignItems: "center",
3636
}));
@@ -129,18 +129,30 @@ const ConditionValue: FC<PropsConditionValuePlusEntity> = ({
129129
case EntryAttributeTypeTypeEnum.STRING:
130130
case EntryAttributeTypeTypeEnum.ARRAY_STRING:
131131
return (
132-
<ConditionValueAsString index={index} control={control} condField={condField} />
132+
<ConditionValueAsString
133+
index={index}
134+
control={control}
135+
condField={condField}
136+
/>
133137
);
134138

135139
case EntryAttributeTypeTypeEnum.BOOLEAN:
136140
return (
137-
<ConditionValueAsBoolean index={index} control={control} condField={condField} />
141+
<ConditionValueAsBoolean
142+
index={index}
143+
control={control}
144+
condField={condField}
145+
/>
138146
);
139147

140148
case EntryAttributeTypeTypeEnum.ARRAY_OBJECT:
141149
case EntryAttributeTypeTypeEnum.OBJECT:
142150
return (
143-
<ConditionValueAsObject index={index} control={control} condField={condField} />
151+
<ConditionValueAsObject
152+
index={index}
153+
control={control}
154+
condField={condField}
155+
/>
144156
);
145157
}
146158
};
@@ -179,11 +191,13 @@ export const Conditions: FC<Props> = ({ control, entity }) => {
179191
<TableRow>
180192
<TableCell>
181193
<Select {...field} size="small" fullWidth>
182-
{entity.attrs.filter((attr) => isSupportedType(attr)).map((attr) => (
183-
<MenuItem key={attr.id} value={attr.id}>
184-
{attr.name}
185-
</MenuItem>
186-
))}
194+
{entity.attrs
195+
.filter((attr) => isSupportedType(attr))
196+
.map((attr) => (
197+
<MenuItem key={attr.id} value={attr.id}>
198+
{attr.name}
199+
</MenuItem>
200+
))}
187201
</Select>
188202
</TableCell>
189203
<TableCell>
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
import { TriggerParent } from "@dmm-com/airone-apiclient-typescript-fetch";
12
import { z } from "zod";
23

3-
import { TriggerParent } from "@dmm-com/airone-apiclient-typescript-fetch";
44
import { schemaForType } from "services/ZodSchemaUtil";
55

66
export const schema = schemaForType<TriggerParent>()(
@@ -20,14 +20,16 @@ export const schema = schemaForType<TriggerParent>()(
2020
type: z.number(),
2121
}),
2222
strCond: z.string().nullable(),
23-
refCond: z.object({
24-
id: z.number(),
25-
name: z.string(),
26-
schema: z.object({
23+
refCond: z
24+
.object({
2725
id: z.number(),
2826
name: z.string(),
29-
}),
30-
}).nullable(),
27+
schema: z.object({
28+
id: z.number(),
29+
name: z.string(),
30+
}),
31+
})
32+
.nullable(),
3133
boolCond: z.boolean().optional(),
3234
})
3335
),
@@ -39,22 +41,26 @@ export const schema = schemaForType<TriggerParent>()(
3941
name: z.string(),
4042
type: z.number(),
4143
}),
42-
values: z.array(z.object({
43-
id: z.number(),
44-
strCond: z.string().nullable(),
45-
refCond: z.object({
44+
values: z.array(
45+
z.object({
4646
id: z.number(),
47-
name: z.string(),
48-
schema: z.object({
49-
id: z.number(),
50-
name: z.string(),
51-
}),
52-
}).nullable(),
53-
boolCond: z.boolean().optional(),
54-
})),
47+
strCond: z.string().nullable(),
48+
refCond: z
49+
.object({
50+
id: z.number(),
51+
name: z.string(),
52+
schema: z.object({
53+
id: z.number(),
54+
name: z.string(),
55+
}),
56+
})
57+
.nullable(),
58+
boolCond: z.boolean().optional(),
59+
})
60+
),
5561
})
5662
),
5763
})
5864
);
5965

60-
export type Schema = z.infer<typeof schema>;
66+
export type Schema = z.infer<typeof schema>;

0 commit comments

Comments
 (0)