flipt
flipt copied to clipboard
[FLI-808] Allow switching branches/refs in UI
Problem
In v1.36 we introduced the ability to evaluate different git references (branches) if using our git backends (guide here).
Also in 1.36 we added the ability to show the current configured branch in the UI (#2672)
It would be great if we could now allow switching between branches in the UI by combing these features.
Ideal Solution
- Allow the branch in the UI to change to a dropdown on click, allowing the user to pick between the various known references that Flipt knows of
- Selecting a new reference should reload the UI with all state for the selected ref
- Since this is using the git backend, it will only need to work for readonly, no writes
Search
- [X] I searched for other open and closed issues before opening this
Additional Context
I started a WIP branch to see how this would work
I think we will need to do the following:
- Update almost all RTK queries to pass an optional
ref
parameter either in the query string or body of the request, depending on the API (ie evaluate will useref
in body). Like https://github.com/flipt-io/flipt/compare/main...ui-branch-picker#diff-d179bd77db52401511bb679af1e3fbedeb0db93eefe474fae1d9ea92224ca3ceR14-R19 - Create an internal API to list all of the known refs that Flipt knows about. I believe we get all the references in the Git repo here or around there. We will need to surface these references as an
/internal
API or similar so that the Flipt UI can populate the dropdown list to pick from
/cc @GeorgeMac for confirmation/clarification
From SyncLinear.com | FLI-808
You could also try to apply ref
param in customFetchFn
https://github.com/flipt-io/flipt/blob/39f6def6493fb76a38b0ebb59bdfd68a0360915b/ui/src/utils/redux-rtk.ts#L9-L18
That is pretty spot on, the only change is that it is the full string “reference” instead of “ref”.