-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Thomas Kosiewski <[email protected]>
- Loading branch information
Thomas Kosiewski
committed
Sep 22, 2023
1 parent
a54e5cf
commit d7a9612
Showing
10 changed files
with
185 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package cmd | ||
|
||
import ( | ||
"errors" | ||
"fmt" | ||
|
||
loftctl "github.com/loft-sh/loftctl/v3/cmd/loftctl/cmd" | ||
"github.com/loft-sh/log" | ||
"github.com/loft-sh/vcluster/cmd/vclusterctl/flags" | ||
"github.com/loft-sh/vcluster/pkg/pro" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewUICmd(globalFlags *flags.GlobalFlags) (*cobra.Command, error) { | ||
loftctlGlobalFlags, err := pro.GlobalFlags(globalFlags) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to parse pro flags: %w", err) | ||
} | ||
|
||
cmd := &loftctl.UiCmd{ | ||
GlobalFlags: loftctlGlobalFlags, | ||
Log: log.GetInstance(), | ||
} | ||
|
||
description := `######################################################## | ||
##################### vcluster ui ###################### | ||
######################################################## | ||
Open the vCluster.Pro web UI | ||
Example: | ||
vcluster ui | ||
######################################################## | ||
` | ||
|
||
uiCmd := &cobra.Command{ | ||
Use: "ui", | ||
Short: "Start the web UI", | ||
Long: description, | ||
Args: cobra.NoArgs, | ||
RunE: func(cobraCmd *cobra.Command, args []string) error { | ||
err := cmd.Run(cobraCmd.Context(), args) | ||
if err != nil { | ||
if errors.Is(err, loftctl.ErrNoUrl) { | ||
return fmt.Errorf("%w: please login first using 'vcluster login' or start using 'vcluster pro start'", err) | ||
} | ||
|
||
return fmt.Errorf("failed to run ui command: %w", err) | ||
} | ||
|
||
return nil | ||
}, | ||
} | ||
|
||
return uiCmd, nil | ||
} |
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
2 changes: 1 addition & 1 deletion
2
vendor/github.com/loft-sh/loftctl/v3/cmd/loftctl/cmd/create/space.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
52 changes: 40 additions & 12 deletions
52
vendor/github.com/loft-sh/loftctl/v3/cmd/loftctl/cmd/create/vcluster.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
76 changes: 76 additions & 0 deletions
76
vendor/github.com/loft-sh/loftctl/v3/cmd/loftctl/cmd/ui.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
vendor/github.com/loft-sh/loftctl/v3/pkg/client/helper/helper.go
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