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

Add edit application functionality from topology #3788

Merged
merged 1 commit into from Jan 3, 2020
Merged

Add edit application functionality from topology #3788

merged 1 commit into from Jan 3, 2020

Conversation

divyanshiGupta
Copy link
Contributor

@divyanshiGupta divyanshiGupta commented Dec 16, 2019

Jira stories: https://jira.coreos.com/browse/ODC-2346, https://jira.coreos.com/browse/ODC-2349

In this PR I have added the edit application scenario for the applications created using import from git/dockerfile/catalog flow. Knative service editing scenarios are also handled.

edit-app

ToDo -

  • Populate advanced limits section

Note : I will be doing the following things in remaining story(from: deployImage) of edit-application epic in the next sprint:

  • I will be adding the unit tests all at once
  • Aligning UI with final UXD if present

@openshift-ci-robot openshift-ci-robot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Dec 16, 2019
@openshift-ci-robot openshift-ci-robot added component/dev-console Related to dev-console component/knative Related to knative-plugin component/shared Related to console-shared labels Dec 16, 2019
@sahil143
Copy link
Contributor

sahil143 commented Dec 16, 2019

@divyanshiGupta If I create a new source secret from the Edit Application modal then the Source Secret modal opens up but the Edit Application modal closes in the background.

P.S.: Not sure if we should be opening one modal over another modal.

@sahil143
Copy link
Contributor

@divyanshiGupta While editing the application if I change the application grouping name by creating a new one:

  1. It doesn't change the application grouping name
  2. It rollouts a new version of the resource

@divyanshiGupta
Copy link
Contributor Author

@divyanshiGupta If I create a new source secret from the Edit Application modal then the Source Secret modal opens up but the Edit Application modal closes in the background.

P.S.: Not sure if we should be opening one modal over another modal.

@serenamarie125 @parvathyvr how should we handle this edge case?

@divyanshiGupta divyanshiGupta changed the title Add edit application functionality from topology [WIP]Add edit application functionality from topology Dec 16, 2019
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 16, 2019
@divyanshiGupta divyanshiGupta changed the title [WIP]Add edit application functionality from topology Add edit application functionality from topology Dec 17, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 17, 2019
@divyanshiGupta
Copy link
Contributor Author

@divyanshiGupta While editing the application if I change the application grouping name by creating a new one:

  1. It doesn't change the application grouping name
  2. It rollouts a new version of the resource

Fixed.

@divyanshiGupta
Copy link
Contributor Author

/test e2e-gcp-console
/test analyze

name: namespace,
},
git: EditApplicationUtils.getGitData(_.get(resources, 'buildConfig.data')),
docker: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Any specific reason to not have util to get docker data in edit-application-utils?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So I created utils for the sections that were most complex to populate with data and have a single source of data. Docker section needs only the port information and docker file path and we get that info from two different resources so didnt created a specific util for this.

10,
),
},
image: {
Copy link
Contributor

Choose a reason for hiding this comment

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

Any specific reason to not have util to get image data in edit-application-utils?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same reason as above.

<form className="modal-content" onSubmit={handleSubmit}>
<ModalTitle>Edit Application</ModalTitle>
<ModalBody>
{!_.isEmpty(values.build.strategy) && <GitSection />}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it better to check for Source strategy 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.

We show GitSection for both strategies Source and Docker and hence I am just checking if there is a strategy show GitSection and if empty do not show it.

@serenamarie125
Copy link
Contributor

@divyanshiGupta If I create a new source secret from the Edit Application modal then the Source Secret modal opens up but the Edit Application modal closes in the background.

P.S.: Not sure if we should be opening one modal over another modal.

couple of points:

  • there was a change that Edit should be a full page form
  • modals from modals should work regardless, and work in other areas of OpenShift today

@divyanshiGupta
Copy link
Contributor Author

divyanshiGupta commented Dec 19, 2019

@divyanshiGupta If I create a new source secret from the Edit Application modal then the Source Secret modal opens up but the Edit Application modal closes in the background.

P.S.: Not sure if we should be opening one modal over another modal.

couple of points:

  • there was a change that Edit should be a full page form
  • modals from modals should work regardless, and work in other areas of OpenShift today

@serenamarie125 I will be aligning with the final UXD in the deploy image story this sprint since I see that the doc has some unresolved comments and is not closed yet.

@christianvogt
Copy link
Contributor

That modal in the gif needs to be wider.

@christianvogt
Copy link
Contributor

There's a few spacing issues now between form sections. for example:
image

@divyanshiGupta
Copy link
Contributor Author

That modal in the gif needs to be wider.

I know but this is the modal we use across console and I didnt wanted to make any css changes since I knew things are going to change and now as we know its no more a modal but a page again. Just wanted to get the first pass done and deal with aligning with UX. Will align with final UXD in deploy image story 🙈

@christianvogt
Copy link
Contributor

Oh we circled back once again to a page? hah. I can't keep up!

@divyanshiGupta
Copy link
Contributor Author

Oh we circled back once again to a page? hah. I can't keep up!

Yes, I was also not aware of that change and then I looked at the doc and I was like where did the modal go. 😪

@sahil143
Copy link
Contributor

@divyanshiGupta Sometimes the resource object modifies behind the scene and we end up with this error.
Screenshot from 2019-12-24 18-10-01

We have seen this while editing YAML for a resource. For that, there is an option to reload the YAML. Maybe something similar for this as well?
Screenshot from 2019-12-24 18-15-02

cc: @serenamarie125

@sahil143
Copy link
Contributor

@divyanshiGupta Whenever a label is edited and then saved it triggers a new rollout and also it takes really long to open the modal.
edit-app

@divyanshiGupta
Copy link
Contributor Author

@divyanshiGupta Sometimes the resource object modifies behind the scene and we end up with this error.
Screenshot from 2019-12-24 18-10-01

We have seen this while editing YAML for a resource. For that, there is an option to reload the YAML. Maybe something similar for this as well?
Screenshot from 2019-12-24 18-15-02

cc: @serenamarie125

@sahil143 sure we can look at adding something similar. @serenamarie125 should we add a similar page reload button or there will be a different UX for this case?

@rohitkrai03
Copy link
Contributor

@divyanshiGupta Sometimes the resource object modifies behind the scene and we end up with this error.
Screenshot from 2019-12-24 18-10-01
We have seen this while editing YAML for a resource. For that, there is an option to reload the YAML. Maybe something similar for this as well?
Screenshot from 2019-12-24 18-15-02
cc: @serenamarie125

@sahil143 sure we can look at adding something similar. @serenamarie125 should we add a similar page reload button or there will be a different UX for this case?

@divyanshiGupta I think this problem will be solved if you use the deployment resources fetched by firehose instead of sending it from the modal. That way it will automatically get updated. I think you are working on the deploy image edit story where you're going to convert this to a full page from modal, for that you'll have to fetch the resource using firehose anyway.

Copy link
Contributor

@rohitkrai03 rohitkrai03 left a comment

Choose a reason for hiding this comment

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

/approve

@rohitkrai03
Copy link
Contributor

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Dec 27, 2019
@rohitkrai03
Copy link
Contributor

/assign @christianvogt

@divyanshiGupta
Copy link
Contributor Author

/test analyze
/test e2e-gcp-console

Copy link
Contributor

@andrewballantyne andrewballantyne left a comment

Choose a reason for hiding this comment

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

Please see my 👀 flagged comments, there may not be any changes needed but some questions to be answered.

@@ -20,3 +20,17 @@ export const ModifyApplication = (kind, obj): KebabOption => {
},
};
};

export const EditApplication = (model, obj): KebabOption => {
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
export const EditApplication = (model, obj): KebabOption => {
export const EditApplication = (model: K8sKind, obj: K8sResourceKind): KebabOption => {

I'd appreciate it if you updated the ModifyApplication option as well. We should strive to type everything.

editAppResource,
)
.then(() => {
actions.setSubmitting(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Disable submitting just before you submit? Any reason why?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you see the submitting is getting disabled after the promise is resolved, i.e when the form is already submitted.

Copy link
Contributor

Choose a reason for hiding this comment

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

We discussed, I misread the code. No issue here.

)
.then(() => {
actions.setSubmitting(false);
actions.setStatus({ error: '' });
Copy link
Contributor

Choose a reason for hiding this comment

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

Is error different from submitError in the catch block? If so, did we want to clear both?

status,
isSubmitting,
}) => (
<form className="modal-content" onSubmit={handleSubmit}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmmm... Would we not want to use import { Form } from '@patternfly/react-core';? HTML forms refresh the page on submit (and this needs to be suppressed usually - perhaps Formik handles this for us).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using Form from pf as a modal wrapper introduces css issues and that is why form is being used here and at other places also where modal is being rendered. Anyways according to new UX we need to show a page and not a modal and I am aligning with new UX in my current story so form will be replaced by Form.

@@ -12,7 +15,7 @@ const ResourceLimitSection: React.FC = () => {
label="Request"
unitName="limits.cpu.requestUnit"
unitOptions={CPUUnits}
defaultUnitSize="m"
defaultUnitSize={`${cpuLimits.value.requestUnit}`}
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh boy this makes me uncomfortable. default based props are not supposed to change. I followed it down into the underlying component and it feels wrong there too... so I am unsure what to do here. I don't think this change is needed for it to work but I haven't fully tested.

@divyanshiGupta if this change was to fix the storing of the correct information then please keep it. If it is not a needed change, I think we shouldn't do it... but overall I don't think it's super important one way or another. It just feels wrong using a default prop as the live update value.

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 made this change to show the unit size that was selected when the application was created as the default. I can create a separate prop in limits section for the default value which will be only initialized once and will not update with selecting another unit from the dropdown.

@@ -153,15 +156,18 @@ export const createBuildConfig = (
};

const buildConfig = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion (for future changes):

_.merge({}, (originalBuildConfig || {}), newData)

@@ -124,6 +125,7 @@ export interface DockerData {
}

export interface RouteData {
show?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this always there? Or does RouteData get used by an interface that doesn't have this functionality yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So we need to show the create route option only when the route was not created when the application was created. If a route already exists we need not show the create route option. Now according to new UX we need to disable the option and not hide it. Aligning with new UX in my current story.

Copy link
Contributor

@andrewballantyne andrewballantyne left a comment

Choose a reason for hiding this comment

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

/approve

/assign @christianvogt

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

@andrewballantyne andrewballantyne left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

Christian will have to give the actual approval. But for all intensive purposes (until the e2e tests are fixed) this is reviewed.

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

/hold

@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 2, 2020
@andrewballantyne
Copy link
Contributor

/kind feature

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

/approve

@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: andrewballantyne, christianvogt, divyanshiGupta, rohitkrai03

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

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 2, 2020
@andrewballantyne
Copy link
Contributor

/hold cancel
/retest
#3847 has fixed the e2e tests

@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 2, 2020
@openshift-bot
Copy link
Contributor

/retest

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

3 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-merge-robot openshift-merge-robot merged commit cbe705a into openshift:master Jan 3, 2020
@spadgett spadgett added this to the v4.4 milestone Jan 3, 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 component/knative Related to knative-plugin component/shared Related to console-shared kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet