trestle icon indicating copy to clipboard operation
trestle copied to clipboard

Same critical error of all Admin systems

Open paulocheque opened this issue 6 years ago • 3 comments
trafficstars

The most critical problem of all admin systems are the auto generate field for relationships. It loads the entire database into the memory and may turn down a system.

Don't set this as the default behavior of the library. Today, you guys use a Select2 field for that.

By default, let the field read-only/static or just a text box to change the id. That is the safest approach.

paulocheque avatar Apr 11 '19 03:04 paulocheque

Why would that be critical?

It has no safety implication, and it is definitly not a problemativ behaviour for most users.

It does BTW only load the entire Table, which is fine for most usecases where you want a drop down, or check boxes.

FreeApophis avatar May 06 '19 10:05 FreeApophis

A third party library that is responsible to breaks down the web server appears to be critical to me.

paulocheque avatar May 06 '19 10:05 paulocheque

I'd definitely agree with you that the current approach taken with the automatically generated select fields breaks down with very large data sets, and as such is somewhat naiive in that respect. Indeed even parts of the Trestle demo application fall victim to slow loading due to this.

However the UX of a select field far surpasses the possible alternatives here, so I do think it is the most appropriate default. In situations like this, it becomes a balancing act between what can be achieved quickly with the auto-generated forms versus what ends up requiring extra effort in building a custom form.

I must admit that my view of the auto-generated forms and tables up until recently has been that they are more akin to Rails scaffolding; i.e. a temporary structure that is useful for early prototyping but should be quickly customized to suit your application's specific needs. I am however warming to the idea that the auto-generated forms and tables could and should be more flexible.

At this stage, I'm thinking of a few enhancements that could be beneficial:

  1. Some basic configuration options for the automatic forms/tables. In particular being able to:

    1. easily remove certain fields (as requested in #120 & #190)
    2. override how certain field types are rendered, e.g. customize how an association is handled, or potentially more specifically customize how an association of type User is handled. This way it would be possible to easily change all associations to a basic text field, or even better a Select2 field that loads its results via AJAX.
  2. Being able to completely override how the automatic forms or tables are rendered by swapping in a new generator class entirely. I'd imagine this would be most useful for applications with very large numbers of models.

With #195 now largely out of the way (which has consumed most of my Trestle attention recently), I'm hoping these enhancements won't be too far off.

spohlenz avatar May 06 '19 12:05 spohlenz