Skip to content

Commit c1cc222

Browse files
committed
chore: remove unused typesParameter.ts
1 parent 82a4733 commit c1cc222

File tree

2 files changed

+53
-177
lines changed

2 files changed

+53
-177
lines changed

site/src/api/typesParameter.ts

-124
This file was deleted.

site/src/modules/workspaces/DynamicParameter/DynamicParameter.tsx

+53-53
Original file line numberDiff line numberDiff line change
@@ -172,29 +172,26 @@ const ParameterField: FC<ParameterFieldProps> = ({
172172
<SelectValue placeholder="Select option" />
173173
</SelectTrigger>
174174
<SelectContent>
175-
{parameter.options
176-
.map((option) => (
177-
<SelectItem key={option.value.value} value={option.value.value}>
178-
<OptionDisplay option={option} />
179-
</SelectItem>
180-
))}
175+
{parameter.options.map((option) => (
176+
<SelectItem key={option.value.value} value={option.value.value}>
177+
<OptionDisplay option={option} />
178+
</SelectItem>
179+
))}
181180
</SelectContent>
182181
</Select>
183182
);
184183

185184
case "multi-select": {
186185
// Map parameter options to MultiSelectCombobox options format
187-
const comboboxOptions: Option[] = parameter.options
188-
.map((opt) => ({
189-
value: opt.value.value,
190-
label: opt.name,
191-
disable: false,
192-
}));
186+
const comboboxOptions: Option[] = parameter.options.map((opt) => ({
187+
value: opt.value.value,
188+
label: opt.name,
189+
disable: false,
190+
}));
193191

194192
const defaultOptions: Option[] = JSON.parse(defaultValue).map(
195193
(val: string) => {
196-
const option = parameter.options
197-
.find((o) => o.value.value === val);
194+
const option = parameter.options.find((o) => o.value.value === val);
198195
return {
199196
value: val,
200197
label: option?.name || val,
@@ -244,21 +241,20 @@ const ParameterField: FC<ParameterFieldProps> = ({
244241
disabled={disabled}
245242
defaultValue={defaultValue}
246243
>
247-
{parameter.options
248-
.map((option) => (
249-
<div
250-
key={option.value.value}
251-
className="flex items-center space-x-2"
252-
>
253-
<RadioGroupItem
254-
id={option.value.value}
255-
value={option.value.value}
256-
/>
257-
<Label htmlFor={option.value.value} className="cursor-pointer">
258-
<OptionDisplay option={option} />
259-
</Label>
260-
</div>
261-
))}
244+
{parameter.options.map((option) => (
245+
<div
246+
key={option.value.value}
247+
className="flex items-center space-x-2"
248+
>
249+
<RadioGroupItem
250+
id={option.value.value}
251+
value={option.value.value}
252+
/>
253+
<Label htmlFor={option.value.value} className="cursor-pointer">
254+
<OptionDisplay option={option} />
255+
</Label>
256+
</div>
257+
))}
262258
</RadioGroup>
263259
);
264260

@@ -352,20 +348,19 @@ const ParameterDiagnostics: FC<ParameterDiagnosticsProps> = ({
352348
}) => {
353349
return (
354350
<div className="flex flex-col gap-2">
355-
{diagnostics
356-
.map((diagnostic, index) => (
357-
<div
358-
key={`diagnostic-${diagnostic.summary}-${index}`}
359-
className={`text-xs px-1 ${
360-
diagnostic.severity === "error"
361-
? "text-content-destructive"
362-
: "text-content-warning"
363-
}`}
364-
>
365-
<div className="font-medium">{diagnostic.summary}</div>
366-
{diagnostic.detail && <div>{diagnostic.detail}</div>}
367-
</div>
368-
))}
351+
{diagnostics.map((diagnostic, index) => (
352+
<div
353+
key={`diagnostic-${diagnostic.summary}-${index}`}
354+
className={`text-xs px-1 ${
355+
diagnostic.severity === "error"
356+
? "text-content-destructive"
357+
: "text-content-warning"
358+
}`}
359+
>
360+
<div className="font-medium">{diagnostic.summary}</div>
361+
{diagnostic.detail && <div>{diagnostic.detail}</div>}
362+
</div>
363+
))}
369364
</div>
370365
);
371366
};
@@ -439,10 +434,12 @@ export const useValidationSchemaForDynamicParameters = (
439434
if (parameter) {
440435
switch (parameter.type) {
441436
case "number": {
442-
const minValidation = parameter.validations
443-
.find((v) => v.validation_min !== null);
444-
const maxValidation = parameter.validations
445-
.find((v) => v.validation_max !== null);
437+
const minValidation = parameter.validations.find(
438+
(v) => v.validation_min !== null,
439+
);
440+
const maxValidation = parameter.validations.find(
441+
(v) => v.validation_max !== null,
442+
);
446443

447444
if (
448445
minValidation &&
@@ -551,12 +548,15 @@ const parameterError = (
551548
parameter: PreviewParameter,
552549
value?: string,
553550
): string | undefined => {
554-
const validation_error = parameter.validations
555-
.find((v) => v.validation_error !== null);
556-
const minValidation = parameter.validations
557-
.find((v) => v.validation_min !== null);
558-
const maxValidation = parameter.validations
559-
.find((v) => v.validation_max !== null);
551+
const validation_error = parameter.validations.find(
552+
(v) => v.validation_error !== null,
553+
);
554+
const minValidation = parameter.validations.find(
555+
(v) => v.validation_min !== null,
556+
);
557+
const maxValidation = parameter.validations.find(
558+
(v) => v.validation_max !== null,
559+
);
560560

561561
if (!validation_error || !value) {
562562
return;

0 commit comments

Comments
 (0)