remove dashboard related code

This commit is contained in:
天元
2021-03-20 18:36:51 +08:00
parent 15ffac9a46
commit d4705380a8
5 changed files with 40 additions and 58 deletions

View File

@@ -7,10 +7,8 @@ import (
"io"
"io/ioutil"
"os"
"os/exec"
"os/signal"
"path/filepath"
"runtime"
"strings"
"syscall"
"time"
@@ -36,11 +34,12 @@ func NewDashboardCommand(c types.Args, ioStreams cmdutil.IOStreams, frontendSour
var o Options
o.frontendSource = frontendSource
cmd := &cobra.Command{
Hidden: true,
Use: "dashboard",
Short: "Setup API Server and launch Dashboard",
Long: "Setup API Server and launch Dashboard",
Example: `dashboard`,
Hidden: true,
Use: "dashboard",
Short: "Setup API Server and launch Dashboard",
Long: "Setup API Server and launch Dashboard",
Example: `dashboard`,
Deprecated: "vela dashboard is deprecated, it will only launch APIServer without dashboard",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
return c.SetConfig()
},
@@ -200,23 +199,6 @@ func SetupAPIServer(c types.Args, cmd *cobra.Command, o Options) error {
return server.Shutdown(ctx)
}
// OpenBrowser will open browser by url in different OS system
// nolint:gosec
func OpenBrowser(url string) error {
var err error
switch runtime.GOOS {
case "linux":
err = exec.Command("xdg-open", url).Start()
case "windows":
err = exec.Command("cmd", "/C", "start", url).Run()
case "darwin":
err = exec.Command("open", url).Start()
default:
err = fmt.Errorf("unsupported platform")
}
return err
}
// CheckVelaRuntimeInstalledAndReady checks whether vela-core runtime is installed and ready
func CheckVelaRuntimeInstalledAndReady(ioStreams cmdutil.IOStreams, c client.Client) (bool, error) {
if !helm.IsHelmReleaseRunning(types.DefaultKubeVelaReleaseName, types.DefaultKubeVelaChartName, types.DefaultKubeVelaNS, ioStreams) {

View File

@@ -7,8 +7,10 @@ import (
"io/ioutil"
"net/http"
"os"
"os/exec"
"os/signal"
"path/filepath"
"runtime"
"syscall"
"time"
@@ -346,3 +348,20 @@ func showReferenceConsole(ctx context.Context, c types.Args, ioStreams cmdutil.I
}
return nil
}
// OpenBrowser will open browser by url in different OS system
// nolint:gosec
func OpenBrowser(url string) error {
var err error
switch runtime.GOOS {
case "linux":
err = exec.Command("xdg-open", url).Start()
case "windows":
err = exec.Command("cmd", "/C", "start", url).Run()
case "darwin":
err = exec.Command("open", url).Start()
default:
err = fmt.Errorf("unsupported platform")
}
return err
}