Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix/t UI 323 default item create archive modal #435

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ const CreateSystemModal: React.FC<ToolbarModalProps> = ({ toggle }) => {
reset();
}, [reset]);

//used for the advanced checkbox
const [simplified, setSimplified] = useState(false);
const onChange = useCallback(() => {
setSimplified(!simplified);
}, [setSimplified, simplified]);

// used for the canExec checkbox
const [exec, setExec] = useState(true);

Expand Down Expand Up @@ -367,7 +361,7 @@ const CreateSystemModal: React.FC<ToolbarModalProps> = ({ toggle }) => {
setExec(newValue); // Update local state `exec`
}}
/>
<AdvancedSettings simplified={simplified} canExec={exec} />
<AdvancedSettings canExec={exec} />
</Form>
)}
</Formik>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@ import JobSettings from './Job/JobSettings';
const runtimeTypes = Object.values(RuntimeTypeEnum);

type AdvancedSettingsProp = {
simplified: boolean;
canExec: boolean;
};

const AdvancedSettings: React.FC<AdvancedSettingsProp> = ({
simplified,
canExec,
}) => {
const AdvancedSettings: React.FC<AdvancedSettingsProp> = ({ canExec }) => {
//used when trying to read the current value of a parameter
const { values } = useFormikContext();

Expand All @@ -38,49 +34,47 @@ const AdvancedSettings: React.FC<AdvancedSettingsProp> = ({
//reading the runtimeType at its current state
const runtimeType = (values as Partial<Systems.ReqPostSystem>).jobRuntimes;

if (simplified) {
if (canExec) {
return (
<>
<FormikSelect
name="jobRuntimes"
description="The job runtime type for the system"
label="Runtime Type"
required={false}
data-testid="jobRuntimes"
>
<option disabled value="">
Select a job runtime
</option>
{runtimeTypes.map((values) => {
return <option>{values}</option>;
})}
</FormikSelect>
if (canExec) {
return (
<div>
<FormikSelect
name="jobRuntimes"
description="The job runtime type for the system"
label="Runtime Type"
required={false}
data-testid="jobRuntimes"
>
<option disabled value="">
Select a job runtime
</option>
{runtimeTypes.map((values) => {
return <option>{values}</option>;
})}
</FormikSelect>
<FormikInput
name="version"
label={`${runtimeType} Version`}
required={false}
description={`Version of ${runtimeType}`}
aria-label="Input"
disabled={true}
/>
{isS3 ? (
<FormikInput
name="version"
label={`${runtimeType} Version`}
name="bucketName"
label="Bucket Name"
required={false}
description={`Version of ${runtimeType}`}
description={`Bucket name`}
aria-label="Input"
disabled={true}
/>
{isS3 ? (
<FormikInput
name="bucketName"
label="Bucket Name"
required={false}
description={`Bucket name`}
aria-label="Input"
/>
) : null}
<JobSettings />
<BatchSettings />
<ProxySettings />
<CmdSettings />
<TagsSettings />
</>
);
}
) : null}
<JobSettings />
<BatchSettings />
<ProxySettings />
<CmdSettings />
<TagsSettings />
</div>
);
} else {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,12 @@ const TapisSystemArchiveForm: React.FC<FormProps> = ({ onSubmit }) => {
required={true}
description={'A Tapis system'}
>
<option disabled selected>
<option value="" disabled selected>
-- select a system --
</option>
;
{Object.values(systems).map((system) => {
return <option value={system.id}>{system.id}</option>;
})}
{Object.values(systems).map((system) => (
<option value={system.id}>{system.id}</option>
))}
</FormikSelect>
<FormikInput
name="archive_dir"
Expand Down
Loading