Compare commits

...

3 Commits

Author SHA1 Message Date
AmitUp9
dc241218bf minor changes updated (#1122) 2022-05-31 15:08:15 +03:00
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
7 changed files with 100 additions and 72 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

@@ -24,63 +24,60 @@
}, },
"peerDependencies": { "peerDependencies": {
"@craco/craco": "^6.4.3", "@craco/craco": "^6.4.3",
"@material-ui/core": "^4.11.3", "@material-ui/core": "^4.12.4",
"@material-ui/icons": "^4.11.2", "@material-ui/icons": "^4.11.3",
"@material-ui/lab": "^4.0.0-alpha.60", "@material-ui/lab": "^4.0.0-alpha.60",
"@types/jest": "^26.0.22", "@types/jest": "^26.0.24",
"@types/node": "^12.20.10", "@types/node": "^12.20.52",
"node-sass": "^6.0.0", "node-sass": "^6.0.1",
"react": "^17.0.2", "react": "^17.0.2",
"react-copy-to-clipboard": "^5.0.3", "react-copy-to-clipboard": "^5.1.0",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"recoil": "^0.5.2" "recoil": "^0.5.2"
}, },
"dependencies": { "dependencies": {
"@craco/craco": "^6.4.3", "@craco/craco": "^6.4.3",
"@types/lodash": "^4.14.179", "@types/lodash": "^4.14.182",
"@uiw/react-textarea-code-editor": "^1.4.12", "@uiw/react-textarea-code-editor": "^1.6.0",
"axios": "^0.25.0", "axios": "^0.25.0",
"core-js": "^3.20.2", "core-js": "^3.22.7",
"highlight.js": "^11.3.1", "highlight.js": "^11.5.1",
"json-beautify": "^1.1.1", "json-beautify": "^1.1.1",
"jsonpath": "^1.1.1", "jsonpath": "^1.1.1",
"marked": "^4.0.10", "marked": "^4.0.16",
"material-ui-popup-state": "^2.0.0", "material-ui-popup-state": "^2.0.1",
"mobx": "^6.3.10", "mobx": "^6.6.0",
"moment": "^2.29.1", "moment": "^2.29.3",
"node-fetch": "^3.1.1", "node-fetch": "^3.2.4",
"numeral": "^2.0.6", "numeral": "^2.0.6",
"protobuf-decoder": "^0.1.2", "protobuf-decoder": "^0.1.2",
"react-graph-vis": "^1.0.7", "react-graph-vis": "^1.0.7",
"react-lowlight": "^3.0.0", "react-lowlight": "^3.0.0",
"react-router-dom": "^6.2.1", "react-router-dom": "^6.3.0",
"react-scrollable-feed-virtualized": "^1.4.9", "react-scrollable-feed-virtualized": "^1.4.9",
"react-syntax-highlighter": "^15.4.3", "react-syntax-highlighter": "^15.5.0",
"react-toastify": "^8.0.3", "react-toastify": "^8.2.0",
"redoc": "^2.0.0-rc.59", "redoc": "^2.0.0-rc.59",
"styled-components": "^5.3.3", "styled-components": "^5.3.5",
"web-vitals": "^1.1.1", "web-vitals": "^1.1.2",
"xml-formatter": "^2.6.0" "xml-formatter": "^2.6.1"
}, },
"devDependencies": { "devDependencies": {
"@rollup/plugin-node-resolve": "^13.1.3", "@rollup/plugin-node-resolve": "^13.3.0",
"@svgr/rollup": "^6.2.1", "@svgr/rollup": "^6.2.1",
"@testing-library/jest-dom": "^4.2.4", "cross-env": "^7.0.3",
"@testing-library/react": "^9.5.0", "env-cmd": "^10.1.0",
"@testing-library/user-event": "^7.2.1",
"cross-env": "^7.0.2",
"env-cmd": "^10.0.1",
"gh-pages": "^2.2.0", "gh-pages": "^2.2.0",
"microbundle-crl": "^0.13.10", "microbundle-crl": "^0.13.11",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"prettier": "^2.0.4", "prettier": "^2.6.2",
"rollup-plugin-import-css": "^3.0.2",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-sass": "^1.2.10",
"rollup-plugin-scss": "^3.0.0",
"react": "^17.0.2", "react": "^17.0.2",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"typescript": "^4.2.4" "rollup-plugin-import-css": "^3.0.3",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-sass": "^1.2.12",
"rollup-plugin-scss": "^3.0.0",
"typescript": "^4.7.2"
}, },
"eslintConfig": { "eslintConfig": {
"extends": [ "extends": [

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>

View File

@@ -4,51 +4,48 @@
"private": true, "private": true,
"dependencies": { "dependencies": {
"@craco/craco": "^6.4.3", "@craco/craco": "^6.4.3",
"@material-ui/core": "^4.11.3", "@material-ui/core": "^4.12.4",
"@material-ui/icons": "^4.11.2", "@material-ui/icons": "^4.11.3",
"@material-ui/lab": "^4.0.0-alpha.60", "@material-ui/lab": "^4.0.0-alpha.60",
"@testing-library/jest-dom": "^5.11.10", "@types/jest": "^26.0.24",
"@testing-library/react": "^11.2.6", "@types/node": "^12.20.52",
"@testing-library/user-event": "^12.8.3", "@uiw/react-textarea-code-editor": "^1.6.0",
"@types/jest": "^26.0.22",
"@types/node": "^12.20.10",
"@uiw/react-textarea-code-editor": "^1.4.12",
"@up9/mizu-common": "file:up9-mizu-common-0.0.0.tgz", "@up9/mizu-common": "file:up9-mizu-common-0.0.0.tgz",
"axios": "^0.25.0", "axios": "^0.25.0",
"core-js": "^3.20.2", "core-js": "^3.22.7",
"craco-babel-loader": "^1.0.3", "craco-babel-loader": "^1.0.3",
"highlight.js": "^11.3.1", "highlight.js": "^11.5.1",
"json-beautify": "^1.1.1", "json-beautify": "^1.1.1",
"jsonpath": "^1.1.1", "jsonpath": "^1.1.1",
"marked": "^4.0.10", "marked": "^4.0.16",
"material-ui-popup-state": "^2.0.0", "material-ui-popup-state": "^2.0.1",
"mobx": "^6.3.10", "mobx": "^6.6.0",
"moment": "^2.29.1", "moment": "^2.29.3",
"node-fetch": "^3.1.1", "node-fetch": "^3.2.4",
"node-sass": "^6.0.0", "node-sass": "^6.0.1",
"numeral": "^2.0.6", "numeral": "^2.0.6",
"react": "^17.0.2", "react": "^17.0.2",
"react-copy-to-clipboard": "^5.0.3", "react-copy-to-clipboard": "^5.1.0",
"react-dom": "^17.0.2", "react-dom": "^17.0.2",
"react-graph-vis": "^1.0.7", "react-graph-vis": "^1.0.7",
"react-lowlight": "^3.0.0", "react-lowlight": "^3.0.0",
"react-router-dom": "^6.2.1", "react-router-dom": "^6.3.0",
"react-scrollable-feed-virtualized": "^1.4.9", "react-scrollable-feed-virtualized": "^1.4.9",
"react-syntax-highlighter": "^15.4.3", "react-syntax-highlighter": "^15.5.0",
"react-toastify": "^8.0.3", "react-toastify": "^8.2.0",
"redoc": "^2.0.0-rc.59", "redoc": "^2.0.0-rc.59",
"styled-components": "^5.3.3", "styled-components": "^5.3.5",
"typescript": "^4.2.4", "typescript": "^4.7.2",
"web-vitals": "^1.1.1", "web-vitals": "^1.1.2",
"xml-formatter": "^2.6.0" "xml-formatter": "^2.6.1"
}, },
"devDependencies": { "devDependencies": {
"env-cmd": "^10.0.1", "env-cmd": "^10.1.0",
"npm-link-shared": "^0.5.6", "npm-link-shared": "^0.5.6",
"react-app-rewire-alias": "^1.1.7", "react-app-rewire-alias": "^1.1.7",
"react-dev-utils": "^12.0.0", "react-dev-utils": "^12.0.1",
"recoil": "^0.5.2", "react-error-overlay": "6.0.9",
"react-error-overlay": "6.0.9" "recoil": "^0.5.2"
}, },
"scripts": { "scripts": {
"prestart": "../devops/ui-common-pack.sh $PWD", "prestart": "../devops/ui-common-pack.sh $PWD",