flipt-io / flipt

Enterprise-ready, GitOps enabled, CloudNative feature management solution
https://flipt.io
GNU General Public License v3.0
3.62k stars 198 forks source link

Default sorting of flags ect to not be created time stamp #3413

Open alucarddelta opened 3 weeks ago

alucarddelta commented 3 weeks ago

Problem

Is it possible to change the default sorting of the flag table to be something other than the created timestamp.

When trying to view a bunch of flags, it is much easier to look for a key/name in alphabetical order.

Ideal Solution

Have a config option under the UI section for default sort order, Allowing config values of:

eg

 ui:
     table_sorting:
          flag: key
          segments: name

Search

Additional Context

No response

markphelps commented 3 weeks ago

Great idea @alucarddelta ! What if we saved the latest sort field/direction in local storage? That would prevent the need for setting it in config

alucarddelta commented 3 weeks ago

Great idea @alucarddelta ! What if we saved the latest sort field/direction in local storage? That would prevent the need for setting it in config

That also works :)

markphelps commented 2 weeks ago

@alucarddelta I prototyped a fix here where instead of using local storage I just save the sorting state for the table to Redux

see: https://github.com/flipt-io/flipt/pull/3415

This means that if you close the browser it will clear the preferred saved sorting field/direction.. but it will no longer lose the sorting field/direction if you remain in the app and click around to different pages.

In this gif, I first show the current behavior, that whenever you click away from the flags table it resets the sorting state

Then I switch to the new behavior that uses Redux to store the flag table state, which keeps it persisted between pages.

Would this solve your issue?

2024-08-28 19 48 24

alucarddelta commented 2 weeks ago

That will def be helpful!... This solution would work well when setting up new applications/namespace with lots of back and forth setting up flags, rules, ect. I am slightly concerned when accessing Flipt UI infrequently between sessions to make minor changes and toggling flags manually. But that shouldn't be a massive issue and can be dealt with.

As part of this FR/Idea, I did have a thought last night came from one of our internal tools... Rather than using storage to set default sort, we chose to uses URL query parameters to store table options. This includes things like pagination, limits, search filters, and Sort Order. Is this something that would be useful in your mind?

eg. /foo?FoosFilter-limit=100&FoosFilter-%5B%5DorderBy=foo_name

markphelps commented 2 weeks ago

That will def be helpful!... This solution would work well when setting up new applications/namespace with lots of back and forth setting up flags, rules, ect. I am slightly concerned when accessing Flipt UI infrequently between sessions to make minor changes and toggling flags manually. But that shouldn't be a massive issue and can be dealt with.

As part of this FR/Idea, I did have a thought last night came from one of our internal tools... Rather than using storage to set default sort, we chose to uses URL query parameters to store table options. This includes things like pagination, limits, search filters, and Sort Order. Is this something that would be useful in your mind?

eg. /foo?FoosFilter-limit=100&FoosFilter-%5B%5DorderBy=foo_name

I think we could support that as well. The UI is a Single Page Application (SPA) but we can get query params from the URL and still make the JS handle pagination/sorting/etc. I will see if we can support this easily