@maap-jupyterlab/dps-jupyter-extension
Version:
A JupyterLab extension for submitting and viewing jobs.
24 lines (23 loc) • 1.44 kB
JavaScript
import React from 'react';
import { useSelector } from 'react-redux';
import { selectJobs } from '../redux/slices/jobsSlice';
import { INPUTS_JOBS_INFO } from '../templates/InputsJobInfoTable';
import ReactJson from 'react-json-view';
export const InputsJobInfoTable = () => {
// Redux
const { selectedJob } = useSelector(selectJobs);
return (React.createElement("table", { className: 'table' },
React.createElement("tbody", null, // If the job is in a queued state, the inputs (if there are any) are not provided
// in the API response, so we have to check they exist first.
selectedJob['jobInfo'][INPUTS_JOBS_INFO.accessor] ?
selectedJob['jobInfo'][INPUTS_JOBS_INFO.accessor].map((input) => {
return React.createElement("tr", { key: input.name },
React.createElement("th", null, input.name),
input.value ?
(typeof (input.value) === 'string' || typeof (input.value) === 'number') ?
React.createElement("td", null, input.value)
: React.createElement("td", null,
React.createElement(ReactJson, { src: input.value, theme: "summerfruit:inverted", collapsed: true, displayDataTypes: false }))
: React.createElement("td", null, "-"));
}) : React.createElement(React.Fragment, null))));
};