parse-community / parse-dashboard

A dashboard for managing Parse Server
https://parseplatform.org
Other
3.73k stars 1.38k forks source link

Add options for default column order #2504

Open theolundqvist opened 9 months ago

theolundqvist commented 9 months ago

New Feature / Enhancement Checklist

Current Limitation

With many columns we often want to see ex username and email before other less relevant fields. Currently the four system columns appear first and then the rest of the fields have a random? order.

Feature / Enhancement Description

Forcing the columns to be in the same order that is specified in the columnPreference field. All non-mentioned columns can come in a random order in the end.

  apps: [
    {
      columnPreference: {
        "_User": [
             { name: "objectId" } // first column
             { name: "username" } // second column
         ]
      }
    },
  ],

Example Use Case

All dashboard users store their own ordering in localStorage, but I don't want everyone to need to create their own order for 10ths of classes. It would be good to provide a sensible and customised default for all users.

Alternatives / Workarounds

None which I am aware of.

3rd Party References

parse-github-assistant[bot] commented 9 months ago

Thanks for opening this issue!

theolundqvist commented 9 months ago

Addition: I would also want to be able to provide a default ordering for the classes. Maybe even separate them into groups with a horizontal line such as it is done with the system classes.

mtrezza commented 9 months ago

The auto-sort sorts the rest of the fields alphabetically, not randomly, that's what it's supposed to do anyway.

Did you check whether columnPreference already supports predefined column sorting? It may not be documented in the README but the feature may exist in code.

theolundqvist commented 9 months ago

I did do some digging but I could try again.

This is what the columns in one of my classes look like in a fresh browser image The first four fields are always in the same order and the custom fields does not seem to be in alphabetical order.

Doing this does not affect the order.

columnPreference: {
  "Progress": [{name: "chapter"}, {name: "user"}, {name: "progress"}]
}

It seems to me that this should work based on the code here: ColumnPreference.js:100

First it adds the columns in localstorage, then objectId, then the defaultPrefs and lastly all the others in a convenient order since there is no sorting going on from what I can tell.

Actually..., Safari was probably not as clean as I thought. I opened they dashboard in a new icognito window and this is the result: image

So it does work.

But there is still a minor problem here. Even if I never added any clientside custom ordering to the Progress class the dashboard saves the order in my localstorage and applies it with priority the next time I open the dashboard. Meaning that server side ordering changes won't affect the client if they ever opened the dashboard before.