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

"Save" and "Cancel" buttons for settings sections #11290

Merged
merged 49 commits into from
Nov 21, 2024

Conversation

somebody1234
Copy link
Contributor

@somebody1234 somebody1234 commented Oct 10, 2024

Pull Request Description

  • Add "Save" and "Cancel" buttons in settings sections instead of sending request on unfocus

Important Notes

None

Screenshots

Before:
image

After:
image

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.

@somebody1234 somebody1234 added CI: No changelog needed Do not require a changelog entry for this PR. x-new-feature Type: new feature request g-dashboard labels Oct 10, 2024
@@ -26,7 +26,7 @@ interface SubmitButtonBaseProps {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
readonly form?: FormInstance<any>
/** Defaults to `submit`. */
readonly action?: 'cancel' | 'submit' | 'update'
readonly action?: 'cancel' | 'save' | 'submit' | 'update'
Copy link
Contributor

Choose a reason for hiding this comment

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

how's the save is different from 'submit' or 'update'?

On the second thought, why'd we need that at all? we had formnovalidate which was quirky, but web-compliant, now we have custom prop, that looks very unclear and has very confusing values.

autoFocus = false,
...inputProps
} = props
const formFromContext = Form.useFormContext()
Copy link
Contributor

@MrFlashAccount MrFlashAccount Oct 10, 2024

Choose a reason for hiding this comment

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

nit: we can pass the form prop in the context and the context will return the passed form if it's defined, otherwise will try to consume a form from the context.

@@ -11,6 +11,11 @@ import { tv } from '#/utilities/tailwindVariants'

const SETTINGS_INPUT_STYLES = tv({
extend: INPUT_STYLES,
variants: {
readOnly: {
true: { base: 'opacity-100', textArea: 'border-transparent' },
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the inputs in settings should be somehow hightlighted, now it's unclear that we can click on the name and edit it, since nothing is making it different from an ordinary text element

@somebody1234 somebody1234 added the CI: Keep up to date Automatically update this PR to the latest develop. label Nov 18, 2024
@somebody1234 somebody1234 removed the CI: Keep up to date Automatically update this PR to the latest develop. label Nov 18, 2024
@somebody1234 somebody1234 added the CI: Ready to merge This PR is eligible for automatic merge label Nov 18, 2024
@PabloBuchu
Copy link
Contributor

PabloBuchu commented Nov 19, 2024

@somebody1234 After I click Browse for new Root Folder and then select new directory nothing happens.. The root folder stays the same.. is it related to this PR?

[UPDATE] ok looks like it works but in the background. the new value will appear in the input after reload. please fix

@somebody1234 somebody1234 removed the CI: Ready to merge This PR is eligible for automatic merge label Nov 19, 2024
@somebody1234
Copy link
Contributor Author

@PabloBuchu yup, good catch. looks like it is changed internally but because it's separate from the form, the displayed form value doesn't change

@somebody1234
Copy link
Contributor Author

@PabloBuchu should be fixed now

@somebody1234 somebody1234 marked this pull request as draft November 20, 2024 11:04
@somebody1234 somebody1234 marked this pull request as ready for review November 20, 2024 13:45
@somebody1234 somebody1234 added CI: Ready to merge This PR is eligible for automatic merge CI: Keep up to date Automatically update this PR to the latest develop. labels Nov 20, 2024
@somebody1234 somebody1234 removed the CI: Keep up to date Automatically update this PR to the latest develop. label Nov 20, 2024
@jdunkerley jdunkerley added the CI: Clean build required CI runners will be cleaned before and after this PR is built. label Nov 20, 2024
@jdunkerley jdunkerley merged commit 0e51ce6 into develop Nov 21, 2024
33 of 37 checks passed
@jdunkerley jdunkerley deleted the wip/sb/save-settings-sections branch November 21, 2024 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Clean build required CI runners will be cleaned before and after this PR is built. CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge g-dashboard x-new-feature Type: new feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants