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

feat: Support for dynamic and nested workflows. #326

Merged
merged 50 commits into from
Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from 49 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
0ff7153
progress
jsonporter Nov 24, 2021
ee151b2
Progress: fixed fetch to request all children
jsonporter Nov 26, 2021
84d858d
progress
jsonporter Nov 29, 2021
4613307
progress
jsonporter Nov 29, 2021
91ed4d2
progress
jsonporter Nov 30, 2021
a4be1ac
Pre-reafactor RFGraphTypes
jsonporter Dec 1, 2021
a098998
progress, aborted on the refactor
jsonporter Dec 1, 2021
e4508b6
progress
jsonporter Dec 3, 2021
b6c6ad4
progress
jsonporter Dec 3, 2021
08399a1
progress
jsonporter Dec 3, 2021
de84ff5
sketchy progress, may revert
jsonporter Dec 4, 2021
91a4979
pre refactor to use setFlowStates
jsonporter Dec 6, 2021
5f9e5a7
Refactor from github rf issues example complete, not sure if we shoul…
jsonporter Dec 6, 2021
b1fe71c
Progress
jsonporter Dec 7, 2021
09c2fc4
progress on new ids for start/end
jsonporter Dec 7, 2021
bbc41e1
progress
jsonporter Dec 7, 2021
2cfe277
refactored createDNode to take props
jsonporter Dec 8, 2021
4e14ac4
progress
jsonporter Dec 9, 2021
132a3c0
Pre git issue submit checkin
jsonporter Dec 10, 2021
0084230
parentNode-object to parentNodeId-string
jsonporter Dec 16, 2021
1890225
init checkin
jsonporter Dec 30, 2021
97efe51
progress
jsonporter Dec 30, 2021
b616722
progress
jsonporter Dec 31, 2021
705f002
Progress
jsonporter Feb 16, 2022
c87d962
more progress
jsonporter Feb 17, 2022
cd7e079
Full nesting support at any depth
jsonporter Feb 17, 2022
8447299
cleaned up code
jsonporter Feb 18, 2022
373b26f
one layer dynamic nodes working, need to recurse
jsonporter Feb 22, 2022
56a7345
recursive working, all functions should be good just need UI cleanup
jsonporter Feb 22, 2022
72eab00
minor refactors
jsonporter Feb 23, 2022
9ec0431
fixed some UI issues
jsonporter Feb 23, 2022
1f66a37
progress
jsonporter Feb 28, 2022
a169dee
funciton complete, starting typescript and merge
jsonporter Mar 4, 2022
0a9ede6
checkin mid-flight on static graph css
jsonporter Mar 4, 2022
0a783a1
progress
jsonporter Mar 7, 2022
9b967a1
Static graph working
jsonporter Mar 7, 2022
2524509
Typescript complete
jsonporter Mar 7, 2022
d6f28fb
removing console statement
jsonporter Mar 9, 2022
b0ea788
Merged with master, still has issues with timeline
jsonporter Mar 9, 2022
6096dbf
pre-merge fixes
jsonporter Mar 10, 2022
42b5655
post-merge check
jsonporter Mar 10, 2022
878406a
merge complete
jsonporter Mar 10, 2022
9f626ac
chore: fix timeline and nodes view
anrusina Mar 11, 2022
6a5f3df
chore: update imports to match file name
anrusina Mar 11, 2022
cae1b19
Fixed failing tests
jsonporter Mar 14, 2022
7f0b087
fixed PR nits
jsonporter Mar 14, 2022
65b0c38
fixed merge conflicts
jsonporter Mar 14, 2022
84e4c66
fixed last merge conflict
jsonporter Mar 14, 2022
413cc74
Removed console statement
jsonporter Mar 14, 2022
def2028
Merge branch 'master' into rf-version-update
anrusina Mar 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"memory-fs": "^0.4.1",
"morgan": "^1.8.2",
"react-chartjs-2": "^4.0.0",
"react-flow-renderer": "^9.6.3",
"react-flow-renderer": "10.0.0-next.30",
"react-ga4": "^1.4.1",
"react-helmet": "^5.1.3",
"react-responsive": "^4.1.0",
Expand Down
30 changes: 15 additions & 15 deletions src/client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@ import * as ReactDOM from 'react-dom';
import ReactGA from 'react-ga4';

const render = (Component: React.FC) => {
ReactDOM.render(<Component />, document.getElementById('react-app'));
ReactDOM.render(<Component />, document.getElementById('react-app'));
};

const initializeApp = () => {
const App = require('./components/App/App').App;
const App = require('./components/App/App').App;

const { ENABLE_GA, GA_TRACKING_ID } = env;
const { ENABLE_GA, GA_TRACKING_ID } = env;

if (ENABLE_GA != 'false') {
ReactGA.initialize(GA_TRACKING_ID as string);
}
if (ENABLE_GA != 'false') {
ReactGA.initialize(GA_TRACKING_ID as string);
}

if (env.NODE_ENV === 'development') {
// We use style-loader in dev mode, but it causes a FOUC and some initial styling issues
// so we'll give it time to add the styles before initial render.
setTimeout(() => render(App), 500);
} else {
render(App);
}
if (env.NODE_ENV === 'development') {
// We use style-loader in dev mode, but it causes a FOUC and some initial styling issues
// so we'll give it time to add the styles before initial render.
setTimeout(() => render(App), 500);
} else {
render(App);
}
};

if (document.body) {
initializeApp();
initializeApp();
} else {
window.addEventListener('DOMContentLoaded', initializeApp, false);
window.addEventListener('DOMContentLoaded', initializeApp, false);
}
128 changes: 58 additions & 70 deletions src/components/Entities/EntityDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,35 @@ import { EntityVersions } from './EntityVersions';
import { EntityExecutionsBarChart } from './EntityExecutionsBarChart';

const useStyles = makeStyles((theme: Theme) => ({
metadataContainer: {
display: 'flex',
marginBottom: theme.spacing(5),
marginTop: theme.spacing(2),
width: '100%'
},
descriptionContainer: {
flex: '2 1 auto',
marginRight: theme.spacing(2)
},
executionsContainer: {
display: 'flex',
flex: '1 1 auto',
flexDirection: 'column',
margin: `0 -${theme.spacing(contentMarginGridUnits)}px`,
flexBasis: theme.spacing(80)
},
versionsContainer: {
display: 'flex',
flexDirection: 'column'
},
schedulesContainer: {
flex: '1 2 auto',
marginRight: theme.spacing(30)
}
metadataContainer: {
display: 'flex',
marginBottom: theme.spacing(5),
marginTop: theme.spacing(2),
width: '100%'
},
descriptionContainer: {
flex: '2 1 auto',
marginRight: theme.spacing(2)
},
executionsContainer: {
display: 'flex',
flex: '1 1 auto',
flexDirection: 'column',
margin: `0 -${theme.spacing(contentMarginGridUnits)}px`,
flexBasis: theme.spacing(80)
},
versionsContainer: {
display: 'flex',
flexDirection: 'column'
},
schedulesContainer: {
flex: '1 2 auto',
marginRight: theme.spacing(30)
}
}));

interface EntityDetailsProps {
id: ResourceIdentifier;
id: ResourceIdentifier;
}

/**
Expand All @@ -52,53 +52,41 @@ interface EntityDetailsProps {
* @param id
*/
export const EntityDetails: React.FC<EntityDetailsProps> = ({ id }) => {
const sections = entitySections[id.resourceType];
const project = useProject(id.project);
const styles = useStyles();
const { chartIds, onToggle, clearCharts } = useChartState();
const sections = entitySections[id.resourceType];
const project = useProject(id.project);
const styles = useStyles();
const { chartIds, onToggle, clearCharts } = useChartState();

return (
<WaitForData {...project}>
<EntityDetailsHeader
project={project.value}
id={id}
launchable={!!sections.launch}
/>
return (
<WaitForData {...project}>
<EntityDetailsHeader project={project.value} id={id} launchable={!!sections.launch} />

<div className={styles.metadataContainer}>
{sections.description ? (
<div className={styles.descriptionContainer}>
<EntityDescription id={id} />
</div>
) : null}
{sections.schedules ? (
<div className={styles.schedulesContainer}>
<EntitySchedules id={id} />
</div>
) : null}
</div>
<div className={styles.metadataContainer}>
{sections.description ? (
<div className={styles.descriptionContainer}>
<EntityDescription id={id} />
</div>
) : null}
{sections.schedules ? (
<div className={styles.schedulesContainer}>
<EntitySchedules id={id} />
</div>
) : null}
</div>

{sections.versions ? (
<div className={styles.versionsContainer}>
<EntityVersions id={id} />
</div>
) : null}
{sections.versions ? (
<div className={styles.versionsContainer}>
<EntityVersions id={id} />
</div>
) : null}

<EntityExecutionsBarChart
onToggle={onToggle}
chartIds={chartIds}
id={id}
/>
<EntityExecutionsBarChart onToggle={onToggle} chartIds={chartIds} id={id} />

{sections.executions ? (
<div className={styles.executionsContainer}>
<EntityExecutions
chartIds={chartIds}
id={id}
clearCharts={clearCharts}
/>
</div>
) : null}
</WaitForData>
);
{sections.executions ? (
<div className={styles.executionsContainer}>
<EntityExecutions chartIds={chartIds} id={id} clearCharts={clearCharts} />
</div>
) : null}
</WaitForData>
);
};
175 changes: 76 additions & 99 deletions src/components/Entities/EntityVersions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,117 +19,94 @@ import { WorkflowVersionsTablePageSize } from './constants';
import t from './strings';

const useStyles = makeStyles((theme: Theme) => ({
headerContainer: {
display: 'flex'
},
collapseButton: {
marginTop: theme.spacing(-0.5)
},
header: {
flexGrow: 1,
marginBottom: theme.spacing(1),
marginRight: theme.spacing(1)
},
viewAll: {
color: interactiveTextColor,
cursor: 'pointer'
},
divider: {
borderBottom: `1px solid ${theme.palette.divider}`,
marginBottom: theme.spacing(1)
}
headerContainer: {
display: 'flex'
},
collapseButton: {
marginTop: theme.spacing(-0.5)
},
header: {
flexGrow: 1,
marginBottom: theme.spacing(1),
marginRight: theme.spacing(1)
},
viewAll: {
color: interactiveTextColor,
cursor: 'pointer'
},
divider: {
borderBottom: `1px solid ${theme.palette.divider}`,
marginBottom: theme.spacing(1)
}
}));

export interface EntityVersionsProps {
id: ResourceIdentifier;
showAll?: boolean;
id: ResourceIdentifier;
showAll?: boolean;
}

/**
* The tab/page content for viewing a workflow's versions.
* @param id
* @param showAll - shows all available entity versions
*/
export const EntityVersions: React.FC<EntityVersionsProps> = ({
id,
showAll = false
}) => {
const { domain, project, resourceType, name } = id;
const [showTable, setShowTable] = useLocalCache(
LocalCacheItem.ShowWorkflowVersions
);
const styles = useStyles();
const sort = {
key: executionSortFields.createdAt,
direction: SortDirection.DESCENDING
};
export const EntityVersions: React.FC<EntityVersionsProps> = ({ id, showAll = false }) => {
const { domain, project, resourceType, name } = id;
const [showTable, setShowTable] = useLocalCache(LocalCacheItem.ShowWorkflowVersions);
const styles = useStyles();
const sort = {
key: executionSortFields.createdAt,
direction: SortDirection.DESCENDING
};

const baseFilters = React.useMemo(
() => executionFilterGenerator[resourceType](id),
[id, resourceType]
);
const baseFilters = React.useMemo(() => executionFilterGenerator[resourceType](id), [id, resourceType]);

const versions = useWorkflowVersions(
{ domain, project },
{
sort,
filter: baseFilters,
limit: showAll ? 100 : WorkflowVersionsTablePageSize
}
);
const versions = useWorkflowVersions(
{ domain, project },
{
sort,
filter: baseFilters,
limit: showAll ? 100 : WorkflowVersionsTablePageSize
}
);

const preventDefault = e => e.preventDefault();
const handleViewAll = React.useCallback(() => {
history.push(
Routes.WorkflowVersionDetails.makeUrl(
project,
domain,
name,
versions.value[0].id.version ?? ''
)
);
}, [project, domain, name, versions]);
const preventDefault = e => e.preventDefault();
const handleViewAll = React.useCallback(() => {
history.push(Routes.WorkflowVersionDetails.makeUrl(project, domain, name, versions.value[0].id.version ?? ''));
}, [project, domain, name, versions]);

return (
<>
{!showAll && (
<div className={styles.headerContainer}>
<IconButton
className={styles.collapseButton}
edge="start"
disableRipple={true}
disableTouchRipple={true}
onClick={() => setShowTable(!showTable)}
onMouseDown={preventDefault}
size="small"
aria-label=""
title={t('collapseButton', showTable)}
>
{showTable ? <ExpandLess /> : <ExpandMore />}
</IconButton>
<Typography className={styles.header} variant="h6">
{t('workflowVersionsTitle')}
</Typography>
<Typography
className={styles.viewAll}
variant="body1"
onClick={handleViewAll}
>
{t('viewAll')}
</Typography>
</div>
)}
<WaitForData {...versions}>
{showTable || showAll ? (
<WorkflowVersionsTable
{...versions}
isFetching={isLoadingState(versions.state)}
versionView={showAll}
/>
) : (
<div className={styles.divider} />
)}
</WaitForData>
</>
);
return (
<>
{!showAll && (
<div className={styles.headerContainer}>
<IconButton
className={styles.collapseButton}
edge="start"
disableRipple={true}
disableTouchRipple={true}
onClick={() => setShowTable(!showTable)}
onMouseDown={preventDefault}
size="small"
aria-label=""
title={t('collapseButton', showTable)}
>
{showTable ? <ExpandLess /> : <ExpandMore />}
</IconButton>
<Typography className={styles.header} variant="h6">
{t('workflowVersionsTitle')}
</Typography>
<Typography className={styles.viewAll} variant="body1" onClick={handleViewAll}>
{t('viewAll')}
</Typography>
</div>
)}
<WaitForData {...versions}>
{showTable || showAll ? (
<WorkflowVersionsTable {...versions} isFetching={isLoadingState(versions.state)} versionView={showAll} />
) : (
<div className={styles.divider} />
)}
</WaitForData>
</>
);
};
Loading