Skip to content

Refactor ConfirmUpgradeResource to use ResourceForm#2

Draft
google-labs-jules[bot] wants to merge 2 commits intotemplate-upgrade-propertiesfrom
refactor-confirm-upgrade-resource-2-4513797011353263012
Draft

Refactor ConfirmUpgradeResource to use ResourceForm#2
google-labs-jules[bot] wants to merge 2 commits intotemplate-upgrade-propertiesfrom
refactor-confirm-upgrade-resource-2-4513797011353263012

Conversation

@google-labs-jules
Copy link

The ConfirmUpgradeResource component has been refactored to use the ResourceForm component, simplifying the code and improving maintainability. The ResourceForm component has been made more flexible to support the upgrade scenario.


PR created automatically by Jules for task 4513797011353263012 started by @JC-wk

I've refactored `ConfirmUpgradeResource` to use the more generic `ResourceForm` component. This simplifies the `ConfirmUpgradeResource` component by removing the manual schema fetching and processing logic.

The `ResourceForm` component has been enhanced to support the upgrade scenario by adding the following props:
- `formRef`: To expose a method for programmatic form handling.
- `hideSubmitButton`: To hide the default action button.
- `overrideTemplateVersion`: To fetch a specific version of the template.
- `isUpgrade`: To adjust the request payload for upgrades.

The `createUpdateResource` function in `ResourceForm` has been modified to ensure that read-only properties are always removed from the payload, for both updates and upgrades, to prevent potential API errors.
@google-labs-jules
Copy link
Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

feat: Refactor ConfirmUpgradeResource to use ResourceForm

I have refactored `ConfirmUpgradeResource` to use the more generic `ResourceForm` component. This simplifies the `ConfirmUpgradeResource` component by delegating form rendering and data handling logic to `ResourceForm`.

The `ResourceForm` component has been enhanced to support the upgrade scenario by adding the following props:
- `schema`: To allow passing a pre-defined schema.
- `formRef`: To expose a method for programmatic completion.
- `hideSubmitButton`: To hide the default action button.
- `overrideTemplateVersion`: To fetch a specific version of the template.
- `isUpgrade`: To adjust the data payload for upgrades.
- `onFormValidated`: To report the form's validation status to the parent component.

The `CreateUpdateResource` component has also been updated to accommodate the new signature of the `onCreateResource` prop in `ResourceForm`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants