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

Edit pipeline builder #4055

Merged

Conversation

andrewballantyne
Copy link
Contributor

@andrewballantyne andrewballantyne commented Jan 23, 2020

Fixes:
Folded the PRs into this one now that it has been reviewed by @christianvogt - Additional changes will be more commits

Dependency on #4004 (https://issues.redhat.com/browse/ODC-2605) -- 1st commit
Dependency on #4031 (https://issues.redhat.com/browse/ODC-2448) -- 2nd commit
Dependency on #4033 (https://issues.redhat.com/browse/ODC-2447) -- 3rd commit
Dependency on #4049 (https://issues.redhat.com/browse/ODC-2449) -- 4th commit
https://issues.redhat.com/browse/ODC-2450 -- 5th commit

Tickets covered are:

Additional comments beyond the 1st one are all reviewer feedback.

Analysis / Root cause:
I've completed walked through the builder and produced a Pipeline I like. There however is an issue with the way I set it up - it'd be nice to go back through the builder to adjust it.

Solution Description:
Inject an existing Pipeline into the PipelineBuilder as to start off with a pre-built structure.

Screen shots / Gifs for design review:

EditPipelineBuilder

There is a laundry list of touch ups and writing tests I need to do. But this is the essence of the Pipeline Builder (and all 4 previous PRs build it up in different ways).

Unit test coverage report:

  • Unit Tests

Test setup:

  • Install the Pipeline Operator (this comes with cluster tasks from 0.8.x onwards)
  • Go to the Pipelines page and "Create Pipeline"

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@openshift-ci-robot openshift-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jan 23, 2020
@andrewballantyne
Copy link
Contributor Author

Was waiting for the initial bot to kick in... but it seems busy with other things.

/kind feature
/assign @christianvogt

cc @openshift/team-devconsole-ux

@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Jan 23, 2020
Copy link
Contributor

@serenamarie125 serenamarie125 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good 🎉

@sspeiche
Copy link

Looks great, love the "this is not the param you are looking for" sample text

@andrewballantyne
Copy link
Contributor Author

Looks great, love the "this is not the param you are looking for" sample text

To be honest, forgot that was there lol. Wasn't reading the text when I was recording. It's part of my test param Pipeline I have, so if this shows up in the logs I made a bug somewhere 😅

@@ -142,8 +142,8 @@ const TaskComponent: React.FC<TaskProps> = ({
</>
);
return (
<li className={cx('odc-pipeline-vis-task')}>
<div className={cx('odc-pipeline-vis-task')}>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need to use classnames lib here for a single class

return (
<PipelineTopologyGraph
// TODO: fix this; the graph layout isn't properly laying out nodes
key={nodes.map((n) => n.id).join('-')}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need for a key here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout is a pain atm, if I don't force a re-render it doesn't properly layout nodes when new ones are added. Have an intent to circle back to this once Jeff's stuff is in.

const [clusterTasks, setClusterTasks] = React.useState<PipelineResourceTask[]>(null);
const [loadErrorMsg, setLoadErrorMsg] = React.useState<string>(undefined);

React.useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These async calls to update state need to be guarded against updating state on an unmounted component.

Comment on lines 42 to 49
.then((res: PipelineResourceTask[]) => {
setNamespacedTasks(res);
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

.then(setNamespacedTasks)

Comment on lines 53 to 63
.then((res: PipelineResourceTask[]) => {
setClusterTasks(res);
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

.then(setClusterTasks)

Comment on lines +56 to +57
<div style={{ height: maxSize?.height, width: maxSize?.width }}>
<VisualizationSurface visualization={vis} />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to improve topology to support sizing based on contents.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pipeline code (this code)? Or Topology?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Topology. This is fine for now

Comment on lines +4 to +6
const SpacerNode: React.FC<{ element: Node }> = () => {
return <g />;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dagre trickery?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To get the design we want, yeah... parallel to parallel is just straight lines to Dagre... placing a node as a focal point allows them to flow to an invisible point and then flow back out.

Select task <CaretDownIcon />
</Button>
</div>
<Popper
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to extract this and the other instances into a single reusable component later.

properties: {
perspective: 'dev',
exact: true,
path: [`/k8s/ns/:ns/${referenceForModel(PipelineModel)}/~new/:pipelineName/builder`],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ~new in the edit url?
/k8s/ns/:ns/${referenceForModel(PipelineModel)}/:pipelineName/builder

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did that originally... it's caught by the Details page and thinks I want a tab in there. I am unsure how to override that. Order in the Plugin file doesn't seem to do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently I was wrong... not sure how I tested that and didn't get it to work. 🤷‍♂ Fixed now.

const {
metadata: { name, namespace },
} = pipeline;
history.push(`/k8s/ns/${namespace}/${referenceForModel(PipelineModel)}/~new/${name}/builder`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
history.push(`/k8s/ns/${namespace}/${referenceForModel(PipelineModel)}/~new/${name}/builder`);
history.push(`/k8s/ns/${namespace}/${referenceForModel(PipelineModel)}/${name}/builder`);

@christianvogt
Copy link
Contributor

christianvogt commented Jan 23, 2020

Clicked the right + button which resulted in the bottom right task being created. Expected it created between the two nodes. Possibly because the middle node had no task set. If i set the task first then it works correctly.
image

Probably a related issue. Clicked all three + signs on the first task set and ended up with this. Expected the middle task to have all other tasks connected but the first task got the bottom one.
image

@andrewballantyne
Copy link
Contributor Author

/retest

@@ -2,7 +2,6 @@ $border-color: var(--pf-global--BorderColor--light-100);
.odc-pipeline-vis-task {
position: relative;
width: 10em;
margin-top: 1.5em;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I understand this is an existing file... However, should we use pf-react-tokens instead later

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand. Your problem is with the sass styles or the hardcoded value? I believe I made the margin a pf variable when I moved it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not something urgent. While going through the code, I just thought that the remaining styles like width:10em, should they be converted to pf units. This could be taken up in later PRs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah gotcha... you mean the width haha... I thought you were talking about the margin-top

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was all done at the time to make the nodes reactive to font size. The layout was dynamic too.
Now that we have a fixed layout and node sizes at can clean up the old code later

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On my cleanup list 😞

@karthikjeeyar
Copy link
Contributor

By adding a node in between two other nodes and removing it from the side panel breaks the UI.

I observed same issue when introducing a left node to the very first task and by removing it from sidepanel

AwesomeScreenshot-2020-1-24-1579864220236

@abhinandan13jan
Copy link
Contributor

abhinandan13jan commented Jan 24, 2020

Suppose I want to arrive at this,
Screenshot from 2020-01-24 16-47-46

If I follow in order and do the following to the first task -> click bottom + then right + of first task , I get to this.
But, if I do it in order -> click right + then click bottom + of first task, I have no further way to do this and there is no reset.So, I have to cancel and come back. Is this expected?

Screenshot from 2020-01-24 16-48-49

@abhinandan13jan
Copy link
Contributor

abhinandan13jan commented Jan 24, 2020

clicking on the task bubble gave this issue

backend.js:6 TypeError: Cannot read property 'value' of undefined
The above error occurred in the <TaskSidebarParam> component:
    in TaskSidebarParam (created by TaskSidebar)
    in div (created by TaskSidebar)
    in TaskSidebar (created by Sidebar)
    in div (created by Sidebar)
    in Transition (created by CSSTransition)

Screenshot from 2020-01-24 17-00-13

@abhinandan13jan
Copy link
Contributor

abhinandan13jan commented Jan 24, 2020

While changing the name in the Sidebar for one of the buildah task, I backspaced till zero characters and got this issue.

 Error: Edge with ID 'build-app~to~' has no target.
    at BaseEdge.push../packages/topology/src/elements/BaseEdge.ts.BaseEdge.getTarget (:9000/static/dev-console-topology~git-import-form~pipeline-builder-edit-page~pipeline-builder-page~pipeline-detai~5e936f59-1d3453939c1c018d376a.js:3925)

@andrewballantyne
Copy link
Contributor Author

#4055 (comment)
Unfortunately there are UX issues with the design. I've not had time to vet this with Serena and come up with a new design. Once a node on the right side of the graph is not pointing at anything there is no way to rejoin it with another line. Not sure if I misunderstood the design but I'll need to discuss with UX.

@andrewballantyne
Copy link
Contributor Author

#4055 (comment) ah, damn. That was overlooked. Good catch. Live updating the form + visualization has its issues haha.

@andrewballantyne
Copy link
Contributor Author

#4055 (comment)
Yeah, I spotted this late yesterday. The task setup needs some work. When one is removed I don't stitch it back together. Need to rework some stuff to reuse the logic.

@abhinandan13jan
Copy link
Contributor

abhinandan13jan commented Jan 24, 2020

The Builder fails to load over Create/Edit flow in Admin perspective because of route issues

@andrewballantyne
Copy link
Contributor Author

/test e2e-gcp-console

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@andrewballantyne
Copy link
Contributor Author

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

4 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@andrewballantyne
Copy link
Contributor Author

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 25, 2020
@andrewballantyne
Copy link
Contributor Author

andrewballantyne commented Jan 25, 2020

/hold

Looks like there is another flake that is preventing any tests from running.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 25, 2020
@andrewballantyne
Copy link
Contributor Author

/retest

@andrewballantyne
Copy link
Contributor Author

/hold cancel

Looks like it's good to go again.

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 25, 2020
@andrewballantyne
Copy link
Contributor Author

/retest

@andrewballantyne
Copy link
Contributor Author

/test e2e-gcp-console

@andrewballantyne
Copy link
Contributor Author

/retest

@serenamarie125
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 26, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: abhinandan13jan, andrewballantyne, christianvogt, karthikjeeyar, serenamarie125

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@andrewballantyne
Copy link
Contributor Author

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@andrewballantyne
Copy link
Contributor Author

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 4168efa into openshift:master Jan 26, 2020
@spadgett spadgett added this to the v4.4 milestone Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. component/dev-console Related to dev-console kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

10 participants