django-sql-explorer
django-sql-explorer copied to clipboard
Add label to parameters
I embedded a query with parameters using the procedure described in #485. The problem with this is that there is no way to add an optional "label" to the parameters so as to have better control on what to disply to the users.
I tried to change the parameter name to be used as a labe but for reasons unknown to me this doesn't work. For example take a peek at this query:
select aa.id, aa.created_on,
aa.dynamic_data->>'date' as "Ημερμηνία",
aa.dynamic_data->>'authority' as "Υπηρεσία",
aa.dynamic_data->>'mail' as "Email",
aa.dynamic_data
from apps_app aa
left join apptypes_apptype aat on
aa.app_type_id = aat.id
where aat.id = 8
and aa.dynamic_data->>'mail' like "%$$email$$%"
and aa.dynamic_data->>'authority' like "%$$Υπηρεσία$$%"
Notice that I use a unicode name for the parameter in the last line; this parameter is not displayed at all (notice I'm using the normal process explorer view not any custom ones). Also, if I wanted to write Email
as the name of the parameter instead of email
I'd still get email
(all lowercase) in the form field label.
One way this could be implemented (this is only for UX purposes, I haven't read the code to understand if it's possible) is to add an optional label in the field similar to the optional default value. I.e right now we can do: $$paramName:defaultValue$$
, this can be changed to $$paramName:defaultValue:Label$$
(and let's suppose we don't allow :
in the label).
Is this the correct way to go? Also is this a feature we'd like to add ? If yes I'd be happy to take a look at it.