Skip to content

Commit

Permalink
package input files and folders (frontend)
Browse files Browse the repository at this point in the history
  • Loading branch information
andrii-i committed Mar 14, 2024
1 parent 5a784c5 commit eb8e18f
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 4 deletions.
18 changes: 18 additions & 0 deletions src/components/input-folder-checkbox.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React, { ChangeEvent } from 'react';

import { Checkbox, FormControlLabel, FormGroup } from '@mui/material';

export function PackageInputFolderControl(props: {
onChange: (event: ChangeEvent<HTMLInputElement>) => void;
}): JSX.Element {
return (
<FormGroup>
<FormControlLabel
control={
<Checkbox onChange={props.onChange} name={'packageInputFolder'} />
}
label="Package input folder"
/>
</FormGroup>
);
}
4 changes: 4 additions & 0 deletions src/handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ export namespace Scheduler {
compute_type?: string;
schedule?: string;
timezone?: string;
package_input_folder?: boolean;
}

export interface IUpdateJobDefinition {
Expand All @@ -389,6 +390,7 @@ export namespace Scheduler {
create_time: number;
update_time: number;
active: boolean;
packageInputFolder?: boolean;
}

export interface IEmailNotifications {
Expand All @@ -415,6 +417,7 @@ export namespace Scheduler {
output_filename_template?: string;
output_formats?: string[];
compute_type?: string;
package_input_folder?: boolean;
}

export interface ICreateJobFromDefinition {
Expand Down Expand Up @@ -463,6 +466,7 @@ export namespace Scheduler {
start_time?: number;
end_time?: number;
downloaded: boolean;
packageInputFolder?: boolean;
}

export interface ICreateJobResponse {
Expand Down
8 changes: 6 additions & 2 deletions src/mainviews/create-job.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {

import { Box, Stack } from '@mui/system';
import { getErrorMessage } from '../util/errors';
import { PackageInputFolderControl } from '../components/input-folder-checkbox';

export interface ICreateJobProps {
model: ICreateJobModel;
Expand Down Expand Up @@ -320,7 +321,8 @@ export function CreateJob(props: ICreateJobProps): JSX.Element {
compute_type: props.model.computeType,
idempotency_token: props.model.idempotencyToken,
tags: props.model.tags,
runtime_environment_parameters: props.model.runtimeEnvironmentParameters
runtime_environment_parameters: props.model.runtimeEnvironmentParameters,
package_input_folder: props.model.packageInputFolder
};

if (props.model.parameters !== undefined) {
Expand Down Expand Up @@ -368,7 +370,8 @@ export function CreateJob(props: ICreateJobProps): JSX.Element {
tags: props.model.tags,
runtime_environment_parameters: props.model.runtimeEnvironmentParameters,
schedule: props.model.schedule,
timezone: props.model.timezone
timezone: props.model.timezone,
package_input_folder: props.model.packageInputFolder
};

if (props.model.parameters !== undefined) {
Expand Down Expand Up @@ -504,6 +507,7 @@ export function CreateJob(props: ICreateJobProps): JSX.Element {
environmentList={environmentList}
value={props.model.environment}
/>
<PackageInputFolderControl onChange={handleInputChange} />
<OutputFormatPicker
label={trans.__('Output formats')}
name="outputFormat"
Expand Down
6 changes: 6 additions & 0 deletions src/mainviews/detail-view/job-definition.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ export function JobDefinition(props: IJobDefinitionProps): JSX.Element {
value: model.timezone ?? '',
label: trans.__('Time zone')
}
],
[
{
value: model.packageInputFolder ? trans.__('Yes') : trans.__('No'),
label: trans.__('Package input folder')
}
]
];

Expand Down
6 changes: 6 additions & 0 deletions src/mainviews/detail-view/job-detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@ export function JobDetail(props: IJobDetailProps): JSX.Element {
{
value: timestampLocalize(props.model.endTime ?? ''),
label: trans.__('End time')
},
{
value: props.model.packageInputFolder
? trans.__('Yes')
: trans.__('No'),
label: trans.__('Package input folder')
}
]
];
Expand Down
9 changes: 7 additions & 2 deletions src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export interface ICreateJobModel
tags?: string[];
// Is the create button disabled due to a submission in progress?
createInProgress?: boolean;
packageInputFolder?: boolean;
}

export const defaultScheduleFields: ModelWithScheduleFields = {
Expand Down Expand Up @@ -310,6 +311,7 @@ export interface IJobDetailModel {
outputPrefix?: string;
job_files: Scheduler.IJobFile[];
downloaded: boolean;
packageInputFolder?: boolean;
}

export interface IJobDefinitionModel {
Expand All @@ -336,6 +338,7 @@ export interface IJobDefinitionModel {
startTime?: number;
endTime?: number;
outputPrefix?: string;
packageInputFolder?: boolean;
}

const convertParameters = (parameters: {
Expand Down Expand Up @@ -384,7 +387,8 @@ export function convertDescribeJobtoJobDetail(
updateTime: describeJob.update_time,
startTime: describeJob.start_time,
endTime: describeJob.end_time,
downloaded: describeJob.downloaded
downloaded: describeJob.downloaded,
packageInputFolder: describeJob.packageInputFolder
};
}

Expand Down Expand Up @@ -412,7 +416,8 @@ export function convertDescribeDefinitiontoDefinition(
createTime: describeDefinition.create_time,
updateTime: describeDefinition.update_time,
schedule: describeDefinition.schedule,
timezone: describeDefinition.timezone
timezone: describeDefinition.timezone,
packageInputFolder: describeDefinition.packageInputFolder
};
}

Expand Down

0 comments on commit eb8e18f

Please sign in to comment.