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

Select all output formats by default #198

Merged
29 changes: 27 additions & 2 deletions src/mainviews/create-job.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ function parameterValueMatch(elementName: string): number | null {
export function CreateJob(props: ICreateJobProps): JSX.Element {
const trans = useTranslator('jupyterlab');

// eslint-disable-next-line no-debugger
debugger;

// Cache environment list.
const [environmentList, setEnvironmentList] = useState<
Scheduler.IRuntimeEnvironment[]
Expand All @@ -88,6 +91,7 @@ export function CreateJob(props: ICreateJobProps): JSX.Element {
const setList = async () => {
const envList = await api.getRuntimeEnvironments();
setEnvironmentList(envList);
let environment = props.model.environment;
if (envList.length === 1) {
// If no default compute type is specified, show the first one by default
let newComputeType = envList[0].compute_types?.[0];
Expand All @@ -101,10 +105,26 @@ export function CreateJob(props: ICreateJobProps): JSX.Element {
newComputeType = envList[0].default_compute_type;
}

const outputFormats = outputFormatsForEnvironment(
envList,
envList[0].name
)?.map(format => format.name);

props.handleModelChange({
...props.model,
environment: envList[0].name,
computeType: newComputeType
computeType: newComputeType,
outputFormats: outputFormats
});
environment = envList[0].name;
andrii-i marked this conversation as resolved.
Show resolved Hide resolved
} else {
const outputFormats = outputFormatsForEnvironment(
envList,
environment
)?.map(format => format.name);
andrii-i marked this conversation as resolved.
Show resolved Hide resolved
props.handleModelChange({
...props.model,
outputFormats: outputFormats
});
}
};
Expand Down Expand Up @@ -184,10 +204,15 @@ export function CreateJob(props: ICreateJobProps): JSX.Element {
) {
newComputeType = envObj.default_compute_type;
}
const newEnvOutputFormats = outputFormatsForEnvironment(
environmentList,
target.value
)?.map(format => format.name);
props.handleModelChange({
...props.model,
environment: target.value,
computeType: newComputeType
computeType: newComputeType,
outputFormats: newEnvOutputFormats
andrii-i marked this conversation as resolved.
Show resolved Hide resolved
});
} else {
// otherwise, just set the model
Expand Down