Skip to content

Commit

Permalink
Fixed Get Current theme issue when customized using dashboard (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammed786 committed Jul 5, 2021
1 parent 4e9a509 commit 2f65236
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions api/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ func GetPage() (*HostedPageResponse, error) {
if err != nil {
return nil, err
}
// This Logic is needed to support the theme customization done using Dashboard.
resultResp.Pages[0].Status = strings.ReplaceAll(resultResp.Pages[0].Status, "9", "")
return &resultResp, nil
}

Expand Down
Binary file modified cli_home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 4 additions & 5 deletions cmd/get/theme/theme.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ func NewThemeCmd() *cobra.Command {
Example: heredoc.Doc(`
$ lr get theme --all
Available Themes:
1. Tokyo
2. London
1. London
2. Tokyo
3. Helsinki
$ lr get theme --active
Expand All @@ -43,16 +43,15 @@ func NewThemeCmd() *cobra.Command {
func themes() error {
if *all && !*active {
fmt.Println("Available Themes:")
fmt.Println("1. Tokyo")
fmt.Println("2. London")
fmt.Println("1. London")
fmt.Println("2. Tokyo")
fmt.Println("3. Helsinki")
} else if *active && !*all {
resp, err := api.GetPage()
if err != nil {
return err
}
index := resp.Pages[0].Status

fmt.Println("Current Theme:", cmdutil.ThemeMap[index])
} else {
fmt.Println("Use exactly one of the following flags: ")
Expand Down
1 change: 1 addition & 0 deletions cmdutil/constant.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package cmdutil

var ThemeMap = map[string]string{
"0": "London", // Handled fallback logic to London.
"1": "London",
"2": "Tokyo",
"3": "Helsinki",
Expand Down

0 comments on commit 2f65236

Please sign in to comment.