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

Bug 1998575: Fix that insert yaml does nothing when yaml is provided via an extension (also hide samples when user edits a resource) #9909

Merged
merged 1 commit into from Aug 31, 2021

Conversation

jerolimov
Copy link
Member

@jerolimov jerolimov commented Aug 27, 2021

Fixes:
https://issues.redhat.com/browse/ODC-6301
https://bugzilla.redhat.com/show_bug.cgi?id=1998575

Analysis / Root cause:
When the user presses on insert it doesn't insert any YAML because the YAML templates was provided by an extension.

It also shows an error just in development mode because the YAML was undefined.

It was also incorrect that the YAML (field) editor shows the samples at all. At least our generic YAML editor shows samples only if the user creates a new resource.

Solution Description:

  1. Adds some defaults and types to ensure that the YAML is at least an empty string when editor.setValue is called. This fixes the error which was only shown in development mode. (With this change alone we still have a button which do nothing.)
  2. Loads the YAMLTemplate extensions YAMLEditorField.tsx to load the right YAML. (With this change we have now a button which inserts a YAML (template) sample in the editor.)
  3. Only shows the samples in YAMLEditorField.tsx similar to edit-yaml.jsx only if the user creates a new resource. Added a new prop showSamples for this to make the decision in the parent component.
    1. In BuildConfigForm, EditDeploymentForm, HPAForm and PipelineBuilderForm only when editoring a resource (a resource is loaded successfully)
    2. In HelmInstallUpgradeForm never (the helm itself is the "sample", right?)
    3. In knative add/EventSourceForm, add/brokers/AddBrokerForm and add/channels/form-fields/ChannelYamlEditor always because these forms are obviously add only forms

Screen shots / Gifs for design review:
BuildConfig before:
buildconfig-before

BuildConfig after (no samples anymore):
buildconfig-after

Create Pipeline with Pipeline Builder before:
create-pipeline-before

Create Pipeline with Pipeline Builder after (same as expected):
create-pipeline-after

Edit Pipeline with Pipeline Builder before:
edit-pipeline-before

Edit Pipeline with Pipeline Builder after (no samples anymore):
edit-pipeline-after

Unit test coverage report:
Unchanged

Test setup:
Unchanged

Browser conformance:

  • Chrome
  • Firefox
  • Safari
  • Edge

@openshift-ci openshift-ci bot added the component/core Related to console core functionality label Aug 27, 2021
@openshift-ci openshift-ci bot added component/dev-console Related to dev-console approved Indicates a PR has been approved by an approver from all required OWNERS files. component/helm Related to helm-plugin component/knative Related to knative-plugin component/pipelines Related to pipelines-plugin component/shared Related to console-shared labels Aug 27, 2021
@jerolimov
Copy link
Member Author

/kind bug
/cc @debsmita1 @rohitkrai03

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Aug 27, 2021
@jerolimov jerolimov changed the title Fix crash when insert a yaml which provides data by an extension Fix that insert yaml does nothing when yaml template provides data via an extension (also hide samples when user edits a resource) Aug 27, 2021
@jerolimov jerolimov changed the title Fix that insert yaml does nothing when yaml template provides data via an extension (also hide samples when user edits a resource) Bug 1998575: Fix that insert yaml does nothing when yaml template provides data via an extension (also hide samples when user edits a resource) Aug 27, 2021
@openshift-ci openshift-ci bot added bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. labels Aug 27, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 27, 2021

@jerolimov: This pull request references Bugzilla bug 1998575, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (4.9.0) matches configured target release for branch (4.9.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

No GitHub users were found matching the public email listed for the QA contact in Bugzilla (gamore@redhat.com), skipping review request.

In response to this:

Bug 1998575: Fix that insert yaml does nothing when yaml template provides data via an extension (also hide samples when user edits a resource)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@jerolimov jerolimov changed the title Bug 1998575: Fix that insert yaml does nothing when yaml template provides data via an extension (also hide samples when user edits a resource) Bug 1998575: Fix that insert yaml does nothing when yaml is provided via an extension (also hide samples when user edits a resource) Aug 27, 2021
@jerolimov
Copy link
Member Author

/test e2e-gcp-console

@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 27, 2021
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 29, 2021
@jerolimov
Copy link
Member Author

/retest

1 similar comment
@jerolimov
Copy link
Member Author

/retest

Also show samples in YAMLEditorField only if the user creates a new resource
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.

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 31, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 31, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jerolimov, 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-merge-robot openshift-merge-robot merged commit 9f277e6 into openshift:master Aug 31, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Aug 31, 2021

@jerolimov: All pull requests linked via external trackers have merged:

Bugzilla bug 1998575 has been moved to the MODIFIED state.

In response to this:

Bug 1998575: Fix that insert yaml does nothing when yaml is provided via an extension (also hide samples when user edits a resource)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@spadgett spadgett added this to the v4.9 milestone Sep 4, 2021
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. bugzilla/severity-low Referenced Bugzilla bug's severity is low for the branch this PR is targeting. bugzilla/valid-bug Indicates that a referenced Bugzilla bug is valid for the branch this PR is targeting. component/core Related to console core functionality component/dev-console Related to dev-console component/helm Related to helm-plugin component/knative Related to knative-plugin component/pipelines Related to pipelines-plugin component/shared Related to console-shared kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants