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

In-UI error reporting #2312

Closed
5 tasks
Tracked by #2309 ...
adrianthedev opened this issue Jan 3, 2024 · 5 comments
Closed
5 tasks
Tracked by #2309 ...

In-UI error reporting #2312

adrianthedev opened this issue Jan 3, 2024 · 5 comments
Labels
Milestone

Comments

@adrianthedev
Copy link
Collaborator

adrianthedev commented Jan 3, 2024

Depends on #2352

We need to improve the way we report errors to the developer in the Avo UI in development.

Common errors

  • model class not found
  • bad block arguments
  • The developer tried to use field types that are inexistent
  • more errors from Avo LSP (VS Code extension) #2310
  • bad initializer settings (from here undefined method 'tabs_style=' for #<Avo::Configuration)

Ideally we'd use the same error reporting system for both this issue and #2310

Build a UI for it

I'm thinking of having a tiny icon/button somewhere that highlights the number of errors that are present.
When that button is pressed, an overlay slides in, showing a list with all the errors and the next steps on how to correct them or link to the docs.

CleanShot 2024-01-03 at 15 27 04@2x

@MrJoy
Copy link
Contributor

MrJoy commented Jan 5, 2024

I have a couple cases right now where I'm creating fields for non-existent fields, and handling it via the format_using attribute. Since that would interact badly with this feature, and this feature is very much worth having, a better solution for my use-case would be welcome.

An example:

      Product.all.each do |product|
        field(:"Missing #{product.name} Perms",
              as:           :text,
              readonly:     true,
              format_using: -> { (product.gsuite_scopes - record.scopes).join("<br/>\n").html_safe }) # rubocop:disable Rails/OutputSafety,Layout/LineLength
      end

(In this case, Product is not an ActiveRecord model, so this isn't a degenerate association of some kind.)

I could perhaps push these into accessor methods on the model, but they wouldn't show up as "fields" if querying ActiveRecord metadata. So if you made it allowable to make a read-only field refer to an arbitrary instance method on the model class (and non-read-only fields would have to refer to DB fields), that would cover such use-cases while still allowing robust, proactive error reporting for the developer.

@adrianthedev
Copy link
Collaborator Author

adrianthedev commented Jan 6, 2024

Ok. I made a mistake in the description (and corrected). Instead of inexistent field names I meant field types.

field :name, as: :string # should show a warning that the `string` field does not exist

I use that technique of "virtual" fields as well. It's rather powerful!

@adrianthedev adrianthedev mentioned this issue Jan 10, 2024
2 tasks
Copy link
Contributor

This issue has been marked as stale because there was no activity for the past 15 days.

@github-actions github-actions bot added the Stale label Jan 28, 2024
@adrianthedev adrianthedev added Task Something to get done and removed Stale labels Jan 28, 2024
@adrianthedev adrianthedev moved this from Next up to To Do in Issues May 15, 2024
@adrianthedev
Copy link
Collaborator Author

Some brainstorming

Image

@adrianthedev
Copy link
Collaborator Author

Closing in favor of #2311

@github-project-automation github-project-automation bot moved this from To Do to Done in Issues Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

2 participants