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

#9492 Add database to Rich Text Editor form builder field #9495

Merged
merged 7 commits into from
Nov 12, 2024

Conversation

mnholtz
Copy link
Collaborator

@mnholtz mnholtz commented Nov 12, 2024

What does this PR do?

Discussion

  • An alternative approach to throwing an error is to silently disable the image upload feature, i.e. make the database field optional

Demo

Demo & product question
https://www.loom.com/share/b38a0cf4304040f4b0bc1b1066c16dd6

@mnholtz
Copy link
Collaborator Author

mnholtz commented Nov 12, 2024

An alternative approach to throwing an error is to silently disable the image upload feature, i.e. make the database field optional

@Pashaminkovsky any preference on the approach here? See demo video for context

Copy link

github-actions bot commented Nov 12, 2024

Playwright test results

passed  147 passed
flaky  7 flaky
skipped  2 skipped

Details

report  Open report ↗︎
stats  156 tests across 51 suites
duration  11 minutes, 47 seconds
commit  f827eca
info  For more information on how to debug and view this report, see our readme

Flaky tests

msedge-setup › setup/unaffiliated.setup.ts › authenticate with unaffiliated user
chrome › tests/pageEditor/copyMod.spec.ts › run a copied mod with a built-in integration
msedge › tests/pageEditor/moveOrCopyModComponent.spec.ts › Create new mod by copying a mod component
msedge › tests/runtime/screenshotTab.spec.ts › screenshot tab brick functionality
msedge › tests/runtime/sidebar/sidebarController.spec.ts › sidebar controller › can open sidebar immediately from iframe without focus dialog
msedge › tests/runtime/sidebar/sidebarController.spec.ts › sidebar controller › shows focus dialog in top-level frame
msedge › tests/telemetry/errors.spec.ts › can report an indexdb error to telemetry service

Skipped tests

chrome › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options
msedge › tests/runtime/googleSheetsIntegration.spec.ts › can activate a google spreadsheet mod with config options

@twschiller twschiller added the enhancement New feature or request label Nov 12, 2024
@twschiller
Copy link
Contributor

twschiller commented Nov 12, 2024

An alternative approach to throwing an error is to silently disable the image upload feature, i.e. make the database field optional

Ideally, the field would be optional and would just disable image upload support if not provided. But for 2.2.0 it's fine if it's required (because it's the primary launch use case for the Rich Text Field)

@twschiller twschiller added this to the 2.2.0 milestone Nov 12, 2024
@Pashaminkovsky
Copy link
Collaborator

+1 to Todd's comment; let's go with the simplest implementation for now (database is required).

@mnholtz
Copy link
Collaborator Author

mnholtz commented Nov 12, 2024

Ideally, the field would be optional and would just disable image upload support if not provided. But for 2.2.0 it's fine if it's required (because it's the primary launch use case for the Rich Text Field)

I propose that we merge as-is and I can always easily make the field optional once I go to implement the feature

Copy link

codecov bot commented Nov 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.84%. Comparing base (8318d74) to head (f827eca).
Report is 491 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9495      +/-   ##
==========================================
+ Coverage   74.24%   75.84%   +1.59%     
==========================================
  Files        1332     1415      +83     
  Lines       40817    42793    +1976     
  Branches     7634     7884     +250     
==========================================
+ Hits        30306    32455    +2149     
+ Misses      10511    10338     -173     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

isRequired
schema={{
$ref: "https://app.pixiebrix.com/schemas/database#",
title: "Database",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change the title to "Asset Database"?

}) => {
const { database } = options;

if (!database) {
Copy link
Contributor

@twschiller twschiller Nov 12, 2024

Choose a reason for hiding this comment

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

I don't like using an error in the field preview as a way of showing an error the user has not provided a value. I prefer we stick with showing it as a field error annotation in the Brick Configuration pane. (I think you'd add as a check in the analysis here:

)

Was there a specific reason you chose to show it in the preview/rendered form instead?

I won't block this PR on it though to keep the ball rolling

Copy link
Collaborator Author

@mnholtz mnholtz Nov 12, 2024

Choose a reason for hiding this comment

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

Was there a specific reason you chose to show it in the preview/rendered form instead?

I wanted to make sure at minimum that the form displayed errors at run-time due to consideration for passing in variables, but I agree that also including the error annotation in the form itself is ideal.

However - at this point, I'm more convinced that we should favor the approach of making the field optional in the next slice, as it will 1) be easy to do, 2) be more compatible with putting asset database creation behind a feature flag, and 3) reduce complexity around handling form errors.

Let's merge as-is, and I'll remove the required field limitation in favor of disabling the image feature in the next slice.

@@ -95,60 +96,6 @@ function shouldShowPlaceholderText(uiType: UiType): boolean {
}
}

const TextAreaFields: React.FC<{ uiOptionsPath: string }> = ({
Copy link
Contributor

Choose a reason for hiding this comment

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

❤️

Copy link
Contributor

@twschiller twschiller left a comment

Choose a reason for hiding this comment

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

See comment here: https://github.com/pixiebrix/pixiebrix-extension/pull/9495/files#r1838408454

Why not use our existing field error annotations?

@twschiller twschiller self-requested a review November 12, 2024 16:30
Copy link
Contributor

@twschiller twschiller left a comment

Choose a reason for hiding this comment

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

See comment: #9495 (review)

Copy link

When the PR is merged, the first loom link found on this PR will be posted to #sprint-demo on Slack. Do not edit this comment manually.

@mnholtz mnholtz merged commit e80e6e6 into main Nov 12, 2024
21 checks passed
@mnholtz mnholtz deleted the feature/9492_req_database_field branch November 12, 2024 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

Slice 1: Add required database field to Rich Text form builder fields
3 participants