Skip to content

Commit

Permalink
Hide/Show path and label changes
Browse files Browse the repository at this point in the history
  • Loading branch information
chandra-tacc committed Sep 26, 2023
1 parent fa2d40d commit 00ca696
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
15 changes: 13 additions & 2 deletions client/src/components/Applications/AppForm/AppForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,12 @@ export const AppSchemaForm = ({ app }) => {
onSubmit={(values, { setSubmitting, resetForm }) => {
const job = cloneDeep(values);

// Transform input field values into format that jobs service wants
// Transform input field values into format that jobs service wants.
// File Input structure will have 2 fields if target path is required by the app.
// field 1 - has source url
// field 2 - has target path for the source url.
// tapis wants only 1 field with 2 properties - source url and target path.
// The logic below handles that scenario by merging the related fields into 1 field.
job.fileInputs = Object.values(
Object.entries(job.fileInputs)
.map(([k, v]) => {
Expand Down Expand Up @@ -494,7 +499,13 @@ export const AppSchemaForm = ({ app }) => {
}, {})
)
.flat()
.filter((fileInput) => fileInput.sourceUrl); // filter out any empty values
.filter((fileInput) => fileInput.sourceUrl) // filter out any empty values
.map((fileInput) => {
fileInput.targetPath = checkAndSetDefaultTargetPath(
fileInput.targetPath
);
return fileInput;
});

job.parameterSet = Object.assign(
{},
Expand Down
10 changes: 9 additions & 1 deletion client/src/components/Applications/AppForm/AppFormSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ const FormSchema = (app) => {
}
);

// The default is to not show target path for file inputs.
const showTargetPathForFileInputs =
app.definition.notes.showTargetPath ?? false;
(app.definition.jobAttributes.fileInputs || []).forEach((i) => {
const input = i;
/* TODOv3 consider hidden file inputs https://jira.tacc.utexas.edu/browse/WP-102
Expand Down Expand Up @@ -137,6 +140,9 @@ const FormSchema = (app) => {
: input.sourceUrl;

// Add targetDir for all sourceUrl
if (!showTargetPathForFileInputs) {
return;
}
const targetPathName = getTargetPathFieldName(input.name);
appFields.schema.fileInputs[targetPathName] = Yup.string();
appFields.schema.fileInputs[targetPathName] = appFields.schema.fileInputs[
Expand All @@ -150,7 +156,9 @@ const FormSchema = (app) => {
appFields.fileInputs[targetPathName] = {
label: 'Target Path for ' + input.name,
description:
"The target path is the location to which data are copied from the input. Empty target path or '*' indicates, the simple directory or file name from the input path is automatically assign to the target path.",
'The name of the ' +
input.name +
' after it is copied to the target system, but before the job is run. Leave this value blank to just use the name of the input file.',
required: false,
readOnly: field.readOnly,
type: 'text',
Expand Down

0 comments on commit 00ca696

Please sign in to comment.