CONSOLE-4626: Creating YAML/Form view perspective switcher for Creating CronTabs#34
Conversation
|
@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. DetailsIn response to this:
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. |
aeb54cf to
66edc78
Compare
There was a problem hiding this comment.
@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.
3e26a21 to
e4d40b8
Compare
| <PageSection isFilled={true} height="sizeToFit"> | ||
| <> | ||
| <div data-test="page-heading"> | ||
| <PageHeader title={t("Create CronTab")} data-test="page-heading" /> |
There was a problem hiding this comment.
| <PageHeader title={t("Create CronTab")} data-test="page-heading" /> | |
| <PageHeader title={t("Create CronTab")} data-test="page-heading" /> |
| <PageHeader title={t("Create CronTab")} data-test="page-heading" /> | |
| <PageHeader title={t("Create CronTab")} /> |
18a4cc1 to
09c9cbd
Compare
|
/retest |
|
/test e2e-aws-console-crontab-plugin |
|
/retest |
5 similar comments
|
/retest |
|
/retest |
|
/retest |
|
/retest |
|
/retest |
09c9cbd to
b7e77b0
Compare
rhamilto
left a comment
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
You need to run yarn i18n again and commit the changes since you removed these strings.
| <PageSection isFilled={true} height="sizeToFit"> | ||
| {showYaml ? ( | ||
| <> | ||
| <CodeEditor |
There was a problem hiding this comment.
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/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
b7e77b0 to
4403b67
Compare
rhamilto
left a comment
There was a problem hiding this comment.
Looking good, @krishagarwal278. One error and and two nits.
| const [replicas, setReplicas] = useState<number | "">(0); | ||
| const [loading, setLoading] = useState(false); | ||
| const [error, setError] = useState(""); | ||
|
|
There was a problem hiding this comment.
Nit: no need for an extra line since theses are all hooks.
console-extensions.json
Outdated
| "path": "spec.cronSpec" | ||
| } | ||
| }, | ||
| { |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
| namespace: namespace || "form", | |
| namespace: namespace || "default", |
4403b67 to
ea3fdd8
Compare
| "flags": { | ||
| "required": ["CRONTAB"] | ||
| } | ||
| "exact": true |
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.
|
|
/label docs-approved |
And it is also working if I deploy this PR to my shared cluster:
|
|
/retest |
|
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 |
|
/label px-approved |
|
@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. DetailsIn response to this:
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. |
| <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> |
There was a problem hiding this comment.
can we use ListPageHeader from the SDK so that you can favourite the page
There was a problem hiding this comment.
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
There was a problem hiding this comment.
@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.
1e244c2 to
b619087
Compare
Screen.Recording.2025-07-21.at.10.18.04.AM.movReplacing PageHeader with ListPageHeader allows to favorite the page |
|
/lgtm |
|
[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 DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@krishagarwal278: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions 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. |





Added switcher
working on YAML Editor