Skip to content

Commit

Permalink
kurtosis web cmd work for remote context
Browse files Browse the repository at this point in the history
  • Loading branch information
leoporoli committed Oct 6, 2023
1 parent 545aa53 commit cd705c4
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 16 additions & 2 deletions cli/cli/commands/web/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"github.com/kurtosis-tech/kurtosis/cli/cli/command_framework/lowlevel/flags"
"github.com/kurtosis-tech/kurtosis/cli/cli/command_str_consts"
"github.com/kurtosis-tech/kurtosis/cli/cli/helpers/multi_os_command_executor"
"github.com/kurtosis-tech/kurtosis/cli/cli/user_support_constants"
"github.com/kurtosis-tech/kurtosis/contexts-config-store/store"
"github.com/kurtosis-tech/stacktrace"
)

Expand All @@ -22,11 +24,23 @@ var WebCmd = &lowlevel.LowlevelKurtosisCommand{
}

const (
webUiLink = "http://localhost:9711/enclaves"
webUILink = "http://localhost:9711/enclaves"
)

func run(_ context.Context, _ *flags.ParsedFlags, _ *args.ParsedArgs) error {
if err := multi_os_command_executor.OpenFile(webUiLink); err != nil {

contextsConfigStore := store.GetContextsConfigStore()
currentKurtosisContext, err := contextsConfigStore.GetCurrentContext()
if err != nil {
return stacktrace.Propagate(err, "tried fetching the current Kurtosis context but failed, we can't switch clusters without this information. This is a bug in Kurtosis")
}
if store.IsRemote(currentKurtosisContext) {
if err := multi_os_command_executor.OpenFile(user_support_constants.KurtosisCloudLink); err != nil {
return stacktrace.Propagate(err, "An error occurred while opening the Kurtosis Cloud Web UI")
}
}

if err := multi_os_command_executor.OpenFile(webUILink); err != nil {
return stacktrace.Propagate(err, "An error occurred while opening the Kurtosis Web UI")
}
return nil
Expand Down
2 changes: 2 additions & 0 deletions cli/cli/user_support_constants/user_support_constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const (
FeedbackEmail = "feedback@" + OldDomain
FeedbackEmailLink = "mailto:" + FeedbackEmail
KurtosisTechTwitterProfileLink = "https://twitter.com/KurtosisTech"
KurtosisCloudLink = "https://cloud." + Domain

// If you add new URLs above, make sure to add them to the urlsToValidateInTest below!!!
// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
Expand All @@ -55,4 +56,5 @@ var urlsToValidateInTest = []string{
KurtosisOnBoardCalendlyUrl,
HowImportWorksLink,
KurtosisTechTwitterProfileLink,
KurtosisCloudLink,
}

0 comments on commit cd705c4

Please sign in to comment.