import { WorkflowResource, parseWorkflowDefinition, getWorkflowInputs, getInputLabel, stringifyInputType } from '~/models/workflow';
import { WorkflowGraph } from "~/views/workflow-panel/workflow-graph";
-export type CssRules = 'root' | 'tab' | 'inputTab' | 'descriptionTab' | 'inputsTable';
+export type CssRules = 'root' | 'tab' | 'inputTab' | 'graphTab' | 'descriptionTab' | 'inputsTable';
const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
root: {
paddingBottom: theme.spacing.unit / 2,
}
},
+ graphTab: {
+ overflow: 'auto',
+ height: '450px',
+ marginTop: theme.spacing.unit,
+ },
descriptionTab: {
overflow: 'auto',
maxHeight: '300px',
render() {
const { classes, workflow } = this.props;
+ if (workflow) {
+ console.log(workflow.definition);
+ }
const { value } = this.state;
return <div className={classes.root}>
<Tabs value={value} onChange={this.handleChange} centered={true}>
messages={['Please select a workflow to see its inputs.']} />
}
</CardContent>}
- {value === 2 && <CardContent className={classes.inputTab}>
+ {value === 2 && <CardContent className={classes.graphTab}>
{workflow
? <WorkflowGraph workflow={workflow} />
: <DataTableDefaultView
export class WorkflowGraph extends React.Component<WorkflowGraphProps, {}> {
private svgRoot: React.RefObject<SVGSVGElement> = React.createRef();
- componentDidMount(): void {
+ setGraph() {
const graphs = yaml.safeLoad(this.props.workflow.definition, { json: true });
let workflowGraph = graphs;
new SVGArrangePlugin(),
new SVGEdgeHoverPlugin(),
new SVGNodeMovePlugin({
- movementSpeed: 10
+ movementSpeed: 2
}),
new SVGPortDragPlugin(),
new SelectionPlugin(),
workflow.draw();
}
+ componentDidMount() {
+ this.setGraph();
+ }
+
+ componentDidUpdate() {
+ this.setGraph();
+ }
+
render() {
return <svg
ref={this.svgRoot}