-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Pick from list of real variations (#420)
This adds better UX for multivariate flags. Previously, you just had the ability to edit the raw json values. Now you can pick from the available variations already defined in the LD service or you can create your own "local override". This is implemented by fetching all flags from the flag list API and writing the variations to the sqlite db. The data written to SQLite is then used to serve subsequent requests. I took this approach because it means that the pulled flag state should be in-sync with the available variations and it enables offline work. It does mean that add project & sync project operations take significantly longer in projects with large amounts of flags. Some other changes are along for the ride because this branch was longer lived than ideal. search bar for flags display source environment dark mode fix patch endpoint so that the side-effect resync causes the observers to fire
- Loading branch information
Showing
59 changed files
with
11,667 additions
and
2,195 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package api | ||
|
||
import "github.com/launchdarkly/ldcli/internal/dev_server/model" | ||
|
||
func availableVariationsToResponseFormat(availableVariations map[string][]model.Variation) map[string][]Variation { | ||
respAvailableVariations := make(map[string][]Variation, len(availableVariations)) | ||
for flagKey, variationsForFlag := range availableVariations { | ||
respVariationsForFlag := make([]Variation, 0, len(variationsForFlag)) | ||
for _, variation := range variationsForFlag { | ||
respVariationsForFlag = append(respVariationsForFlag, Variation{ | ||
Id: variation.Id, | ||
Description: variation.Description, | ||
Name: variation.Name, | ||
Value: variation.Value, | ||
}) | ||
} | ||
respAvailableVariations[flagKey] = respVariationsForFlag | ||
} | ||
return respAvailableVariations | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.