Skip to content

Commit 4290284

Browse files
committed
chore: remove unused typesParameter.ts
1 parent 7c13eb7 commit 4290284

File tree

3 files changed

+53
-178
lines changed

3 files changed

+53
-178
lines changed

site/src/api/typesParameter.ts

Lines changed: 0 additions & 124 deletions
This file was deleted.

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

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -173,29 +173,26 @@ const ParameterField: FC<ParameterFieldProps> = ({
173173
<SelectValue placeholder="Select option" />
174174
</SelectTrigger>
175175
<SelectContent>
176-
{parameter.options
177-
.map((option) => (
178-
<SelectItem key={option.value.value} value={option.value.value}>
179-
<OptionDisplay option={option} />
180-
</SelectItem>
181-
))}
176+
{parameter.options.map((option) => (
177+
<SelectItem key={option.value.value} value={option.value.value}>
178+
<OptionDisplay option={option} />
179+
</SelectItem>
180+
))}
182181
</SelectContent>
183182
</Select>
184183
);
185184

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

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

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

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

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

site/src/pages/CreateWorkspacePage/CreateWorkspacePageExperimental.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import type { AutofillBuildParameter } from "utils/richParameters";
3232
import { CreateWorkspacePageViewExperimental } from "./CreateWorkspacePageViewExperimental";
3333
export const createWorkspaceModes = ["form", "auto", "duplicate"] as const;
3434
export type CreateWorkspaceMode = (typeof createWorkspaceModes)[number];
35-
import type { Response } from "api/typesParameter";
3635
import { useWebSocket } from "hooks/useWebsocket";
3736
import {
3837
type CreateWorkspacePermissions,

0 commit comments

Comments
 (0)