Compare commits

...

2 Commits

Author SHA1 Message Date
leon-up9
02b3672e09 added map object (#1119)
Co-authored-by: Leon <>
2022-05-30 13:13:07 +03:00
RoyUP9
45b368b33e Updated the install command UX (#1118) 2022-05-30 11:18:46 +03:00
5 changed files with 44 additions and 10 deletions

View File

@@ -1,8 +1,11 @@
package cmd package cmd
import ( import (
"github.com/creasty/defaults"
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/up9inc/mizu/cli/config/configStructs"
"github.com/up9inc/mizu/cli/telemetry" "github.com/up9inc/mizu/cli/telemetry"
"github.com/up9inc/mizu/logger"
) )
var installCmd = &cobra.Command{ var installCmd = &cobra.Command{
@@ -17,4 +20,11 @@ var installCmd = &cobra.Command{
func init() { func init() {
rootCmd.AddCommand(installCmd) rootCmd.AddCommand(installCmd)
defaultInstallConfig := configStructs.InstallConfig{}
if err := defaults.Set(&defaultInstallConfig); err != nil {
logger.Log.Debug(err)
}
installCmd.Flags().BoolP(configStructs.OutInstallName, "o", defaultInstallConfig.Out, "print (to stdout) Kubernetes manifest used to install Mizu Pro edition")
} }

View File

@@ -2,6 +2,7 @@ package cmd
import ( import (
"fmt" "fmt"
"strings"
"github.com/up9inc/mizu/cli/bucket" "github.com/up9inc/mizu/cli/bucket"
"github.com/up9inc/mizu/cli/config" "github.com/up9inc/mizu/cli/config"
@@ -9,12 +10,23 @@ import (
) )
func runMizuInstall() { func runMizuInstall() {
bucketProvider := bucket.NewProvider(config.Config.Install.TemplateUrl, bucket.DefaultTimeout) if config.Config.Install.Out {
installTemplate, err := bucketProvider.GetInstallTemplate(config.Config.Install.TemplateName) bucketProvider := bucket.NewProvider(config.Config.Install.TemplateUrl, bucket.DefaultTimeout)
if err != nil { installTemplate, err := bucketProvider.GetInstallTemplate(config.Config.Install.TemplateName)
logger.Log.Errorf("Failed getting install template, err: %v", err) if err != nil {
logger.Log.Errorf("Failed getting install template, err: %v", err)
return
}
fmt.Print(installTemplate)
return return
} }
fmt.Print(installTemplate) var sb strings.Builder
sb.WriteString("Hello! This command can be used to install Mizu Pro edition on your Kubernetes cluster.")
sb.WriteString("\nPlease run:")
sb.WriteString("\n\tmizu install -o | kubectl apply -f -")
sb.WriteString("\n\nor use helm chart as described in https://getmizu.io/docs/installing-mizu/centralized-installation\n")
fmt.Print(sb.String())
} }

View File

@@ -1,6 +1,11 @@
package configStructs package configStructs
const (
OutInstallName = "out"
)
type InstallConfig struct { type InstallConfig struct {
TemplateUrl string `yaml:"template-url" default:"https://storage.googleapis.com/static.up9.io/mizu/helm-template"` TemplateUrl string `yaml:"template-url" default:"https://storage.googleapis.com/static.up9.io/mizu/helm-template"`
TemplateName string `yaml:"template-name" default:"helm-template.yaml"` TemplateName string `yaml:"template-name" default:"helm-template.yaml"`
Out bool `yaml:"out"`
} }

View File

@@ -34,8 +34,6 @@
font-weight: 600 font-weight: 600
margin-right: 35px margin-right: 35px
& .actions
.graphSection .graphSection
flex: 85% flex: 85%

View File

@@ -33,6 +33,11 @@ const modalStyle = {
padding: "1px 1px", padding: "1px 1px",
paddingBottom: "15px" paddingBottom: "15px"
}; };
const protocolDisplayNameMap = {
"GQL": "GraphQL"
}
interface LegentLabelProps { interface LegentLabelProps {
color: string, color: string,
name: string name: string
@@ -119,7 +124,11 @@ export const ServiceMapModal: React.FC<ServiceMapModalProps> = ({ isOpen, onClos
const getProtocolsForFilter = useMemo(() => { const getProtocolsForFilter = useMemo(() => {
return serviceMapApiData.edges.reduce<ProtocolType[]>((returnArr, currentValue, currentIndex, array) => { return serviceMapApiData.edges.reduce<ProtocolType[]>((returnArr, currentValue, currentIndex, array) => {
if (!returnArr.find(prot => prot.key === currentValue.protocol.abbr)) if (!returnArr.find(prot => prot.key === currentValue.protocol.abbr))
returnArr.push({ key: currentValue.protocol.abbr, value: currentValue.protocol.abbr, component: <LegentLabel color={currentValue.protocol.backgroundColor} name={currentValue.protocol.abbr} /> }) returnArr.push({
key: currentValue.protocol.abbr, value: currentValue.protocol.abbr,
component: <LegentLabel color={currentValue.protocol.backgroundColor}
name={protocolDisplayNameMap[currentValue.protocol.abbr] ? protocolDisplayNameMap[currentValue.protocol.abbr] : currentValue.protocol.abbr} />
})
return returnArr return returnArr
}, new Array<ProtocolType>()) }, new Array<ProtocolType>())
}, [serviceMapApiData]) }, [serviceMapApiData])
@@ -221,12 +230,12 @@ export const ServiceMapModal: React.FC<ServiceMapModalProps> = ({ isOpen, onClos
<div className={styles.card}> <div className={styles.card}>
<SelectList items={getProtocolsForFilter} checkBoxWidth="5%" tableName={"PROTOCOLS"} multiSelect={true} <SelectList items={getProtocolsForFilter} checkBoxWidth="5%" tableName={"PROTOCOLS"} multiSelect={true}
checkedValues={checkedProtocols} setCheckedValues={onProtocolsChange} tableClassName={styles.filters} checkedValues={checkedProtocols} setCheckedValues={onProtocolsChange} tableClassName={styles.filters}
inputSearchClass={styles.servicesFilterSearch} isFilterable={false}/> inputSearchClass={styles.servicesFilterSearch} isFilterable={false} />
</div> </div>
<div className={styles.servicesFilterWrapper + ` ${styles.card}`}> <div className={styles.servicesFilterWrapper + ` ${styles.card}`}>
<div className={styles.servicesFilterList}> <div className={styles.servicesFilterList}>
<SelectList items={getServicesForFilter} tableName={"SERVICES"} tableClassName={styles.filters} multiSelect={true} <SelectList items={getServicesForFilter} tableName={"SERVICES"} tableClassName={styles.filters} multiSelect={true}
checkBoxWidth="5%" checkedValues={checkedServices} setCheckedValues={onServiceChanges} inputSearchClass={styles.servicesFilterSearch}/> checkBoxWidth="5%" checkedValues={checkedServices} setCheckedValues={onServiceChanges} inputSearchClass={styles.servicesFilterSearch} />
</div> </div>
</div> </div>
</div> </div>