Skip to content

Commit

Permalink
show error message and place new test suite button at start (#138)
Browse files Browse the repository at this point in the history
  • Loading branch information
Pranshu1902 authored Oct 17, 2023
1 parent 6ca55e0 commit 74b9f3f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/app/admin/tests/new/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function Page() {
testSuite={{}}
onSubmit={onSubmit}
loading={createTestSuiteMutation.isLoading}
errors={(createTestSuiteMutation.error as any)?.errors}
errors={(createTestSuiteMutation.error as any)?.error}
/>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/app/admin/tests/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ export default function Page() {
Test Suites
</h1>
<div className="grid grid-cols-4 gap-4 mt-8">
<Link href={`/admin/tests/new`} className="border border-dashed border-gray-300 hover:bg-gray-100 bg-white rounded-lg p-4">
<i className="far fa-plus" /> New Test Suite
</Link>
{testSuites.map((testSuite, i) => (
<Link href={`/admin/tests/${testSuite.external_id}`} key={i} className="border border-gray-300 hover:bg-gray-100 bg-white rounded-lg p-4">
{testSuite.name}
</Link>
))}
<Link href={`/admin/tests/new`} className="border border-dashed border-gray-300 hover:bg-gray-100 bg-white rounded-lg p-4">
<i className="far fa-plus" /> New Test Suite
</Link>
</div>
</div>
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/components/forms/testsuiteform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default function TestSuiteForm(props: {
placeholder="Name"
value={testSuite.name}
onChange={(e) => setTestSuite({ ...testSuite, name: e.target.value })}
errors={errors?.name}
/>
Temperature< br />
<Slider
Expand All @@ -35,6 +36,7 @@ export default function TestSuiteForm(props: {
step={0.1}
max={1}
onChange={(val) => setTestSuite({ ...testSuite, temperature: val })}
errors={errors?.temperature}
/>
TopK<br />
<Slider
Expand All @@ -44,6 +46,7 @@ export default function TestSuiteForm(props: {
step={1}
max={100}
onChange={(val) => setTestSuite({ ...testSuite, topk: val })}
errors={errors?.topk}
/>
<div className="grid grid-cols-2 gap-4 mt-4">
<Button
Expand Down
4 changes: 4 additions & 0 deletions src/components/ui/slider.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { Errors } from "./interactive";

export default function Slider(props: {
max: number,
min?: number,
Expand All @@ -7,6 +9,7 @@ export default function Slider(props: {
disabled?: boolean,
left?: React.ReactNode,
right?: React.ReactNode,
errors?: string[],
}) {

const { max, min = 0, value, onChange, step = 1, disabled } = props;
Expand Down Expand Up @@ -34,6 +37,7 @@ export default function Slider(props: {
disabled={disabled}
className="w-full slider"
/>
<Errors errors={props.errors} />
</div>
)
}

0 comments on commit 74b9f3f

Please sign in to comment.