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

Use a full list of functions on insert/edit page "Function" select #13557

Closed
OlafvdSpek opened this issue Aug 3, 2017 · 15 comments · Fixed by #15935
Closed

Use a full list of functions on insert/edit page "Function" select #13557

OlafvdSpek opened this issue Aug 3, 2017 · 15 comments · Fixed by #15935
Assignees
Labels
enhancement A feature request for improving phpMyAdmin has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete ui Issues relating to the user interface
Milestone

Comments

@OlafvdSpek
Copy link

The list appears to be split into two, not sure on what criteria..

I think it'd be easier if it was a single list.

pma

@nijel
Copy link
Contributor

nijel commented Aug 28, 2017

The functions are grouped by types, first list showing functions which apply to current type.

@nijel nijel added enhancement A feature request for improving phpMyAdmin ui Issues relating to the user interface undecided labels Aug 28, 2017
@nijel
Copy link
Contributor

nijel commented Oct 11, 2017

We can improve this by adding additional group labels to the list, that should make it clear why the list is split.

@ibennetch
Copy link
Member

Optgroup labels like "Suggested" and "All" or something similar.

@OlafvdSpek
Copy link
Author

The trouble with split lists is that one has to figure out in what list a function is.
If I'm looking for unix_timestamp I already know it's near the bottom (normally)..

@ibennetch
Copy link
Member

Indeed, but my solution to that would be to put all functions below the separation, so some are in the list twice (once as a suggested function and again further below)

@OlafvdSpek
Copy link
Author

OlafvdSpek commented Oct 11, 2017

Then you're in the same situation as I'm now: we've got U, we've got V, but no unix_timestamp.. and then: oh, wait, it's in the second part of the list.

@nijel
Copy link
Contributor

nijel commented Oct 11, 2017

That's true. On the other side, it probably doesn't make sense to show functions returning string when working with numeric fields. The current solution was chosen probably to allow using functions even in case the categorization would be bad.

So are there any particular functions you were missing in the first list for some fields?

@OlafvdSpek
Copy link
Author

I think it was unix_timestamp(), it's not in the screenshot but it's in the list now.
IMO having a single list, probably without filtering, would be so much simpler.

@williamdes williamdes added this to Triage zone in Enhancements Jan 23, 2020
@williamdes williamdes moved this from Triage zone to Interface in Enhancements Jan 24, 2020
@rabeehrz
Copy link
Contributor

rabeehrz commented Feb 5, 2020

@williamdes I would like to work on this.
If I'm correct, I just have to remove the seperator and make everything a single list right?

@williamdes
Copy link
Member

I am not sure about what to do :)
Please ping me back on this one Saturday

@rabeehrz
Copy link
Contributor

rabeehrz commented Feb 8, 2020

@williamdes ping.

@williamdes
Copy link
Member

$functions = $GLOBALS['dbi']->types->getFunctions($field['True_Type']);
foreach ($functions as $function) {
$retval .= '<option';
if (isset($foreignData['foreign_link']) && $foreignData['foreign_link'] !== false && $default_function === $function) {
$retval .= ' selected="selected"';
}
$retval .= '>' . $function . '</option>' . "\n";
$dropdown_built[$function] = true;
}
// Create separator before all functions list
if (count($functions) > 0) {
$retval .= '<option value="" disabled="disabled">--------</option>'
. "\n";
}

The criteria is to list functions for the column type

Maybe we can add a configuration option, or remove the first group of entries

@rabeehrz
Copy link
Contributor

rabeehrz commented Feb 8, 2020

@williamdes I've already made the changes. I'll open up a PR?

@rabeehrz
Copy link
Contributor

rabeehrz commented Feb 8, 2020

@williamdes I found another set of code here as well.

public static function getFunctionsForField(array $field, $insert_mode, array $foreignData): string
{
$default_function = self::getDefaultFunctionForField($field, $insert_mode);
$dropdown_built = [];
// Create the output
$retval = '<option></option>' . "\n";
// loop on the dropdown array and print all available options for that
// field.
$functions = $GLOBALS['dbi']->types->getFunctions($field['True_Type']);
foreach ($functions as $function) {
$retval .= '<option';
if (isset($foreignData['foreign_link']) && $foreignData['foreign_link'] !== false
&& $default_function
=== $function) {
$retval .= ' selected="selected"';
}
$retval .= '>' . $function . '</option>' . "\n";
$dropdown_built[$function] = true;

@williamdes williamdes added the has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete label Feb 8, 2020
@williamdes
Copy link
Member

Waiting for approvers on #15935

@williamdes williamdes added this to the 5.1.0 milestone Oct 3, 2020
@williamdes williamdes self-assigned this Oct 3, 2020
@williamdes williamdes changed the title Input functions order Use a full list of functions on insert/edit page "Function" select Oct 3, 2020
williamdes added a commit that referenced this issue Oct 3, 2020
Signed-off-by: William Desportes <williamdes@wdes.fr>
Enhancements automation moved this from Interface to Done Oct 3, 2020
MoonE added a commit to MoonE/phpmyadmin that referenced this issue Aug 12, 2021
Signed-off-by: Maximilian Krög <maxi_kroeg@web.de>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 4, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement A feature request for improving phpMyAdmin has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete ui Issues relating to the user interface
Projects
Enhancements
  
Done
Development

Successfully merging a pull request may close this issue.

5 participants