Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
nathandf committed Aug 12, 2024
1 parent 7c1dc8c commit 80a0782
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,9 @@ const CodeTab: React.FC<CodeTabProps> = ({ featured }) => {
return (
<Chip
size="small"
label={`repo:${repo.url!.replace(
'https://github.com/',
''
)}:${repo.branch} ${repo.directory}`}
label={`repo:${repo.url!.replace('https://github.com/', '')}:${
repo.branch
} ${repo.directory}`}
onDelete={() => {
setTaskPatch(task, {
git_repositories: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,89 +1,91 @@
import React from 'react';
import { Workflows } from '@tapis/tapis-typescript';
import { Sidebar } from '../../../Sidebar';
import styles from "./IOTab.module.scss"
import styles from './IOTab.module.scss';
import { usePatchTask } from 'app/Workflows/_hooks';
import { Button, List, Box, ListItem, ListItemButton, ListSubheader, ListItemText } from '@mui/material';
import {
Button,
List,
Box,
ListItem,
ListItemButton,
ListSubheader,
ListItemText,
} from '@mui/material';
import { Add } from '@mui/icons-material';

const IOTab: React.FC<{ toggle: () => void }> = ({ toggle }) => {
const { taskPatch } = usePatchTask<Workflows.Task>();
const getValueSource = (value: Workflows.SpecWithValue) => {
if (value.value) {
return `from literal: ${value.value}`
return `from literal: ${value.value}`;
}

const sourceKey = Object.keys(value.value_from!)[0]
let source: string | undefined = undefined
console.log({sourceKey})
const sourceKey = Object.keys(value.value_from!)[0];
let source: string | undefined = undefined;
console.log({ sourceKey });
switch (sourceKey) {
case "args":
case 'args':
source = value.value_from?.args;
break;
case "env":
source = value.value_from?.env
break
case 'env':
source = value.value_from?.env;
break;
default:
source = "unknown"
source = 'unknown';
}

return `from '${source}' in '${sourceKey}'`
}
return `from '${source}' in '${sourceKey}'`;
};

const input = Object.entries(taskPatch.input || {})
const output = Object.entries(taskPatch.output || {})
const input = Object.entries(taskPatch.input || {});
const output = Object.entries(taskPatch.output || {});

return (
<Sidebar title={'Inputs & Outputs'} toggle={toggle}>
<Box>
<List
subheader={
<ListSubheader
component="div"
id="inputs"
>
<ListSubheader component="div" id="inputs">
Inputs
</ListSubheader>
}
>
{input.length < 1 && (
<ListItem disablePadding>
<ListItemButton>
<ListItemText
primary={"No inputs"}
secondary={"Press the button below to add an input"}
/>
</ListItemButton>
</ListItem>
)}
{
input.map(([key, value]) => {
{input.length < 1 && (
<ListItem disablePadding>
<ListItemButton>
<ListItemText
primary={'No inputs'}
secondary={'Press the button below to add an input'}
/>
</ListItemButton>
</ListItem>
)}
{input.map(([key, value]) => {
return (
<ListItem disablePadding>
<ListItemButton>
<ListItemText
primary={`'${key}' as ${value.type} ${getValueSource(value)}`}
primary={`'${key}' as ${value.type} ${getValueSource(
value
)}`}
secondary={value.description}
/>
</ListItemButton>
</ListItem>
)
})
}
);
})}
</List>
</Box>
<div className={styles["container"]}>
<div className={styles['container']}>
<Button startIcon={<Add />} onClick={() => {}}>
Add Input
</Button>
</div>
<Box>
<List
subheader={
<ListSubheader
component="div"
id="inputs"
>
<ListSubheader component="div" id="inputs">
Outputs
</ListSubheader>
}
Expand All @@ -92,29 +94,27 @@ const IOTab: React.FC<{ toggle: () => void }> = ({ toggle }) => {
<ListItem disablePadding>
<ListItemButton>
<ListItemText
primary={"No outputs"}
secondary={"Press the button below to add an output"}
primary={'No outputs'}
secondary={'Press the button below to add an output'}
/>
</ListItemButton>
</ListItem>
)}
{
output.map(([key, value]) => {
return (
<ListItem disablePadding>
<ListItemButton>
<ListItemText
primary={`'${key}' as ${value} ${getValueSource(value)}`}
secondary={(value as any).type!}
/>
</ListItemButton>
</ListItem>
)
})
}
{output.map(([key, value]) => {
return (
<ListItem disablePadding>
<ListItemButton>
<ListItemText
primary={`'${key}' as ${value} ${getValueSource(value)}`}
secondary={(value as any).type!}
/>
</ListItemButton>
</ListItem>
);
})}
</List>
</Box>
<div className={styles["container"]}>
<div className={styles['container']}>
<Button startIcon={<Add />} onClick={() => {}}>
Add Output
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@ const TaskEditor: React.FC<TaskEditorProps> = ({
{(tab === 'code' || featuredTab === 'code') &&
tabs.includes('code') && (
<CodeTab featured={task.type === Workflows.EnumTaskType.Function} />
)
}
)}
{(tab === 'jobdef' || featuredTab === 'jobdef') &&
tabs.includes('jobdef') && (
<TapisJobDefTab
Expand Down

0 comments on commit 80a0782

Please sign in to comment.