Skip to content

Commit

Permalink
[app] Make template required for benchmark submission
Browse files Browse the repository at this point in the history
Related to #132
  • Loading branch information
TheChristophe authored and BorjaEst committed Mar 21, 2022
1 parent ea81302 commit 2311962
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions service_frontend/components/forms/benchmarkSubmitForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export function BenchmarkSubmitForm(props: {

function isTemplateValid() {
if (template.length === 0) {
return true;
return false;
}
try {
JSON.parse(template);
Expand Down Expand Up @@ -96,44 +96,42 @@ export function BenchmarkSubmitForm(props: {
{errorMessage !== undefined && <Alert variant="danger">Error: {errorMessage}</Alert>}
<RegistrationCheck />
<Form>
<Form.Group className="mb-3">
<Form.Label htmlFor="benchmark">Benchmark:</Form.Label>
<Form.Group className="mb-3" controlId="benchmark">
<Form.Label>Benchmark:</Form.Label>
<InputGroup>
<Form.Control
placeholder="user/image"
onChange={(e) => setDockerName(e.target.value)}
isInvalid={!isDockerNameValid()}
aria-label="Docker image name including username"
id="benchmark"
/>
<InputGroup.Text>:</InputGroup.Text>
<Form.Control
placeholder="tag"
onChange={(e) => setDockerTag(e.target.value)}
isInvalid={!isDockerTagValid()}
aria-label="Tag or version of the docker image to use"
defaultValue="latest"
/>
</InputGroup>
</Form.Group>

<Form.Group className="mb-3">
<Form.Label htmlFor="description">Benchmark description (optional):</Form.Label>
<Form.Group className="mb-3" controlId="description">
<Form.Label>Benchmark description (optional):</Form.Label>
<Form.Control
id="description"
placeholder="Enter a description of the new benchmark here."
onChange={(e) => setDescription(e.target.value)}
as="textarea"
/>
</Form.Group>

<Form.Group>
<Form.Label htmlFor="template">
Benchmark result JSON schema (optional,{' '}
<Form.Group controlId="template">
<Form.Label>
Benchmark result JSON schema (
<Link href="/code-guidelines#json">example here</Link>
):
</Form.Label>
<Form.Control
id="template"
placeholder={JSON.stringify(benchmarkJsonSchema, null, 4)}
onChange={(e) => setTemplate(e.target.value)}
as="textarea"
Expand Down

0 comments on commit 2311962

Please sign in to comment.