Skip to content

CONSOLE-4626: Creating YAML/Form view perspective switcher for Creating CronTabs#34

Merged
openshift-merge-bot[bot] merged 5 commits intoopenshift:mainfrom
krishagarwal278:CONSOLE-4626
Jul 21, 2025
Merged

CONSOLE-4626: Creating YAML/Form view perspective switcher for Creating CronTabs#34
openshift-merge-bot[bot] merged 5 commits intoopenshift:mainfrom
krishagarwal278:CONSOLE-4626

Conversation

@krishagarwal278
Copy link
Copy Markdown
Contributor

Added switcher
working on YAML Editor

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 2, 2025
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Jul 2, 2025

@krishagarwal278: This pull request references CONSOLE-4626 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set.

Details

In response to this:

Added switcher
working on YAML Editor

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 2, 2025
@openshift-ci openshift-ci bot requested review from TheRealJon and jhadvig July 2, 2025 21:12
@krishagarwal278 krishagarwal278 changed the title [WIP] CONSOLE-4626: Creating YAML/Form view perspective switcher for Creating CronTabs CONSOLE-4626: Creating YAML/Form view perspective switcher for Creating CronTabs Jul 7, 2025
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 7, 2025
Copy link
Copy Markdown
Member

@jhadvig jhadvig left a comment

Choose a reason for hiding this comment

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

@krishagarwal278 I would suggest to follow the simple pattern we are doing in PVC create form, where we are only PageHeading with simple link to the code editor https://github.com/openshift/console/blob/main/frontend/public/components/storage/create-pvc.tsx#L265-L273
I would avoid any migration between the form and the editor.

<PageSection isFilled={true} height="sizeToFit">
<>
<div data-test="page-heading">
<PageHeader title={t("Create CronTab")} data-test="page-heading" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
<PageHeader title={t("Create CronTab")} data-test="page-heading" />
<PageHeader title={t("Create CronTab")} data-test="page-heading" />
Suggested change
<PageHeader title={t("Create CronTab")} data-test="page-heading" />
<PageHeader title={t("Create CronTab")} />

@krishagarwal278
Copy link
Copy Markdown
Contributor Author

/retest

@krishagarwal278
Copy link
Copy Markdown
Contributor Author

/test e2e-aws-console-crontab-plugin

@krishagarwal278
Copy link
Copy Markdown
Contributor Author

/retest

5 similar comments
@krishagarwal278
Copy link
Copy Markdown
Contributor Author

/retest

@krishagarwal278
Copy link
Copy Markdown
Contributor Author

/retest

@krishagarwal278
Copy link
Copy Markdown
Contributor Author

/retest

@krishagarwal278
Copy link
Copy Markdown
Contributor Author

/retest

@krishagarwal278
Copy link
Copy Markdown
Contributor Author

/retest

Copy link
Copy Markdown
Member

@rhamilto rhamilto left a comment

Choose a reason for hiding this comment

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

A few comments.

Copy link
Copy Markdown
Member

@rhamilto rhamilto left a comment

Choose a reason for hiding this comment

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

Nice work on this @krishagarwal278. Reviewing this again made me realize we've made a few concessions that we should reconsider. Let me know if you'd like to discuss tomorrow.

} No newline at end of file
"The desired number of instances of this CronTab to run.": "The desired number of instances of this CronTab to run.",
"YAML Editor": "YAML Editor",
"YAML must include metadata.name or metadata.generateName": "YAML must include metadata.name or metadata.generateName",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You need to run yarn i18n again and commit the changes since you removed these strings.

<PageSection isFilled={true} height="sizeToFit">
{showYaml ? (
<>
<CodeEditor
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This has me realizing we won't have full feature parity with the default code editor in the console with the sidebar and other options, which is a limitation of <CodeEditor>.

What we should probably do is revert to what we had before you implemented the form as that will get us the default console editor for creation and add the form with the ability to toggle from the form to the default editor.

So /k8s/ns/*/stable.example.com~v1~CronTab/~new would be the default editor and /k8s/ns/*/stable.example.com~v1~CronTab/~new/form (a new route) would be the form, the header of which would have a link to the default editor.

}~${cronTabGroupVersionKind.version}~${cronTabGroupVersionKind.kind}/~new`;
would change to }~${cronTabGroupVersionKind.version}~${cronTabGroupVersionKind.kind}/~new/form; so that the form is the default with a link back to the editor.

StorageClasses is an example

Screen.Recording.2025-07-16.at.5.29.05.PM.mov

Copy link
Copy Markdown
Member

@rhamilto rhamilto 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, @krishagarwal278. One error and and two nits.

const [replicas, setReplicas] = useState<number | "">(0);
const [loading, setLoading] = useState(false);
const [error, setError] = useState("");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: no need for an extra line since theses are all hooks.

"path": "spec.cronSpec"
}
},
{
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit: to make the diff a little easer to follow, move this to line 65 so it's more clear you are replacing console.resource/create with this.

const createAccessReview = {
groupVersionKind: cronTabGroupVersionKind,
namespace: namespace || "default",
namespace: namespace || "form",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
namespace: namespace || "form",
namespace: namespace || "default",

"flags": {
"required": ["CRONTAB"]
}
"exact": true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is where it's good to have the side-by-side comparison!

This addition should really be protected by a flag. But note #35. The existing flags are in the wrong location, so they don't work. So let's merge this as is and I will add the flag in #35.

@rhamilto
Copy link
Copy Markdown
Member

just curious, why we don't have a Show/Hide Sidebar button on CronTab YAML page? Screenshot 2025-07-18 at 11 18 18 AM

Good catch, @yapei. I am guessing this is the result of a regression introduced with openshift/console#15254. @logonoff, mind taking a look?

@rhamilto
Copy link
Copy Markdown
Member

just curious, why we don't have a Show/Hide Sidebar button on CronTab YAML page? Screenshot 2025-07-18 at 11 18 18 AM

Good catch, @yapei. I am guessing this is the result of a regression introduced with openshift/console#15254. @logonoff, mind taking a look?

Hmm. This is working correctly when I run the plugin locally.

Screenshot 2025-07-18 at 8 49 54 AM

@opayne1
Copy link
Copy Markdown

opayne1 commented Jul 18, 2025

/label docs-approved

@openshift-ci openshift-ci bot added the docs-approved Signifies that Docs has signed off on this PR label Jul 18, 2025
@rhamilto
Copy link
Copy Markdown
Member

just curious, why we don't have a Show/Hide Sidebar button on CronTab YAML page? Screenshot 2025-07-18 at 11 18 18 AM

Good catch, @yapei. I am guessing this is the result of a regression introduced with openshift/console#15254. @logonoff, mind taking a look?

Hmm. This is working correctly when I run the plugin locally.

Screenshot 2025-07-18 at 8 49 54 AM

And it is also working if I deploy this PR to my shared cluster:

console-openshift-console apps rhamilto devcluster openshift com_dashboards

@rhamilto
Copy link
Copy Markdown
Member

/retest

@krishagarwal278
Copy link
Copy Markdown
Contributor Author

krishagarwal278 commented Jul 18, 2025

Helloo @rhamilto, this video, demonstrates the changes we made. have not shown the crontab being deleted or edited in this video as it was not in scope of the story. Really gratefuly your contribution and guidance! :)))

Screen.Recording.2025-07-18.at.1.29.07.PM.mov

@sferich888
Copy link
Copy Markdown

/label px-approved

@openshift-ci openshift-ci bot added the px-approved Signifies that Product Support has signed off on this PR label Jul 18, 2025
@yapei
Copy link
Copy Markdown

yapei commented Jul 21, 2025

sorry I tested again, this time I see Show/Hide sidebar button
Screenshot 2025-07-21 at 10 51 14 AM
/label qe-approved

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 21, 2025
@openshift-ci openshift-ci bot added the qe-approved Signifies that QE has signed off on this PR label Jul 21, 2025
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Jul 21, 2025

@krishagarwal278: This pull request references CONSOLE-4626 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "4.20.0" version, but no target version was set.

Details

In response to this:

Added switcher
working on YAML Editor

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 openshift-eng/jira-lifecycle-plugin repository.

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jul 21, 2025
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 21, 2025
Comment on lines +82 to +93
<div data-test="page-heading">
<PageHeader
title={t("Create CronTab")}
linkProps={{
label: t("Edit YAML"),
onClick: (e) => {
e.preventDefault();
navigate(
`/k8s/ns/${namespace}/${cronTabGroupVersionKind.group}~${cronTabGroupVersionKind.version}~${cronTabGroupVersionKind.kind}/~new`
);
},
}}
/>
</div>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can we use ListPageHeader from the SDK so that you can favourite the page

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ListPageHeader doesn't have a link prop that we can use to redirect user to YAML view. This link is soon going to be replaced with a component that's exposed to the SDK so all original functionality like favoriting the page can be preserved

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@krishagarwal278, you should be able to use helpText to pass in the link. Let me know if it does not work. I realize that prop name does not match your exact use case based on the name of the prop, but it's ok.

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 21, 2025
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 21, 2025
@krishagarwal278
Copy link
Copy Markdown
Contributor Author

Screen.Recording.2025-07-21.at.10.18.04.AM.mov

Replacing PageHeader with ListPageHeader allows to favorite the page

@rhamilto
Copy link
Copy Markdown
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jul 21, 2025
Copy link
Copy Markdown
Member

@logonoff logonoff 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
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Jul 21, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: krishagarwal278, logonoff, rhamilto

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

The pull request process is described here

Details 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
Copy link
Copy Markdown
Contributor

openshift-ci bot commented Jul 21, 2025

@krishagarwal278: all tests passed!

Full PR test history. Your PR dashboard.

Details

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-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 8c37c13 into openshift:main Jul 21, 2025
4 checks passed
@krishagarwal278 krishagarwal278 deleted the CONSOLE-4626 branch October 14, 2025 14:53
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. docs-approved Signifies that Docs has signed off on this PR jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged. px-approved Signifies that Product Support has signed off on this PR qe-approved Signifies that QE has signed off on this PR tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants