Skip to content

Commit

Permalink
task/TUI-316 -- bug fixes (#318)
Browse files Browse the repository at this point in the history
* Fix modal open issue

* Use FormText for error instead of ErrorMessage

* linting
  • Loading branch information
jchuahtacc authored Jun 27, 2022
1 parent 775562a commit b5b7741
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
12 changes: 6 additions & 6 deletions src/tapis-ui/_common/FieldWrapperFormik/FieldWrapperFormik.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { FormGroup, Label, FormText, Badge } from 'reactstrap';
import styles from './FieldWrapperFormik.module.css';
import { ErrorMessage, Field, useField } from 'formik';
import { Field, useField } from 'formik';
export type FieldWrapperProps = {
name: string;
label: string;
Expand Down Expand Up @@ -33,11 +33,11 @@ const FieldWrapper: React.FC<FieldWrapperProps> = ({
) : null}
</Label>
<Field name={name} as={Component} id={name} />
<ErrorMessage name={name} className="form-field__help">
{(message) => (
<div className={styles['form-field__help']}>{message}</div>
)}
</ErrorMessage>
{meta.error && (
<FormText className={styles['form-field__help']} color="dark">
{meta.error}
</FormText>
)}
{description && !meta.error && (
<FormText className={styles['form-field__help']} color="muted">
{description}
Expand Down
15 changes: 4 additions & 11 deletions src/tapis-ui/components/jobs/JobLauncher/steps/FileInputArrays.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,7 @@ const SourceUrlsField: React.FC<FieldWrapperProps> = ({
+ Browse for Files
</Button>
</div>
{modal && (
<FileSelectModal
toggle={close}
selectMode={{ mode: 'multi', types: ['file', 'dir'] }}
onSelect={onSelect}
/>
)}
{modal && <FileSelectModal toggle={close} onSelect={onSelect} />}
</FormGroup>
);
};
Expand Down Expand Up @@ -175,7 +169,6 @@ const JobInputArrayField: React.FC<JobInputArrayFieldProps> = ({
label="Source URLs"
required={true}
description="Input TAPIS files as pathnames, TAPIS URIs or web URLs"
key={uuidv4()}
>
<SourceUrlsField
fileInputArrayIndex={index}
Expand Down Expand Up @@ -339,12 +332,12 @@ const FixedInputArray: React.FC<{ inputArray: Apps.AppFileInputArray }> = ({
required={true}
description="Input TAPIS files as pathnames, TAPIS URIs or web URLs"
>
{inputArray.sourceUrls?.map((sourceUrl) => (
{inputArray.sourceUrls?.map((sourceUrl, index) => (
<Input
bsSize="sm"
defaultValue={sourceUrl}
disabled={true}
key={uuidv4()}
key={`fixed-input-array-${inputArray.name}-${index}`}
/>
))}
</FieldWrapper>
Expand Down Expand Up @@ -429,7 +422,7 @@ const JobInputArrays: React.FC<{ arrayHelpers: FieldArrayRenderProps }> = ({
item={jobInputArray}
index={index}
remove={arrayHelpers.remove}
key={`fileInputArrays.${index}`}
key={`render-fileInputArrays.${index}`}
/>
))}
<Button onClick={() => arrayHelpers.push({ sourceUrls: [''] })} size="sm">
Expand Down

0 comments on commit b5b7741

Please sign in to comment.