From 9960a37b031867df4ecccf2a4bab196e759e5666 Mon Sep 17 00:00:00 2001 From: Yann Stepienik Date: Sun, 2 Jul 2023 16:12:31 +0100 Subject: [PATCH] [release] v0.9.0-unstable9 --- client/src/pages/config/users/configman.jsx | 12 ++++++++- client/src/pages/home/index.jsx | 29 ++++++++++++--------- client/src/pages/newInstall/newInstall.jsx | 22 +++++++++++++--- package.json | 2 +- src/newInstall.go | 14 ++++++++++ src/utils/db.go | 2 +- src/utils/types.go | 1 + 7 files changed, 63 insertions(+), 19 deletions(-) diff --git a/client/src/pages/config/users/configman.jsx b/client/src/pages/config/users/configman.jsx index 1fce67f..729e35d 100644 --- a/client/src/pages/config/users/configman.jsx +++ b/client/src/pages/config/users/configman.jsx @@ -98,6 +98,7 @@ const ConfigManagement = () => { DefaultDataPath: config.DockerConfig.DefaultDataPath || "/usr", Background: config && config.HomepageConfig && config.HomepageConfig.Background, + Expanded: config && config.HomepageConfig && config.HomepageConfig.Expanded, PrimaryColor: config && config.ThemeConfig && config.ThemeConfig.PrimaryColor, SecondaryColor: config && config.ThemeConfig && config.ThemeConfig.SecondaryColor, }} @@ -148,7 +149,8 @@ const ConfigManagement = () => { }, HomepageConfig: { ...config.HomepageConfig, - Background: values.Background + Background: values.Background, + Expanded: values.Expanded }, ThemeConfig: { ...config.ThemeConfig, @@ -301,6 +303,14 @@ const ConfigManagement = () => { + + + + Primary Color diff --git a/client/src/pages/home/index.jsx b/client/src/pages/home/index.jsx index c48cafb..3b7d026 100644 --- a/client/src/pages/home/index.jsx +++ b/client/src/pages/home/index.jsx @@ -343,7 +343,9 @@ const HomePage = () => { } if (route.HideFromDashboard) skip = true; - return !skip && + return !skip && coStatus && (coStatus.homepage.Expanded ? + + @@ -357,18 +359,19 @@ const HomePage = () => { - // return !skip && - // - // - // - // - //
- //

{route.Name}

- //
- //
- // - //
- //
+ : + + + + + +
+

{route.Name}

+
+
+ +
+
) })} {config && routes.length === 0 && ( diff --git a/client/src/pages/newInstall/newInstall.jsx b/client/src/pages/newInstall/newInstall.jsx index 6baa9d8..3ae4f24 100644 --- a/client/src/pages/newInstall/newInstall.jsx +++ b/client/src/pages/newInstall/newInstall.jsx @@ -3,7 +3,7 @@ import { Link } from 'react-router-dom'; import * as Yup from 'yup'; // material-ui -import { Alert, Button, CircularProgress, FormControl, FormHelperText, Grid, Stack, Typography } from '@mui/material'; +import { Alert, Button, Checkbox, CircularProgress, FormControl, FormHelperText, Grid, Stack, Typography } from '@mui/material'; // ant-ui icons import { CheckCircleOutlined, LeftOutlined, QuestionCircleFilled, QuestionCircleOutlined, RightOutlined } from '@ant-design/icons'; @@ -59,6 +59,7 @@ const NewInstall = () => { const [pullRequestOnSuccess, setPullRequestOnSuccess] = useState(null); const [hostError, setHostError] = useState(null); const [hostIp, setHostIp] = useState(null); + const [cleanInstall, setCleanInstall] = useState(true); const refreshStatus = async () => { try { @@ -115,7 +116,13 @@ const NewInstall = () => { First of all, thanks a lot for trying out Cosmos! And Welcome to the setup wizard. This wizard will guide you through the setup of Cosmos. It will take about 2-3 minutes and you will be ready to go.

- 📄 Don't hesitate to rely on the documentation to guide you! + setCleanInstall(e.target.checked)} />Clean install (remove any existing config files) +

+ + + , nextButtonLabel: () => { return 'Start'; @@ -598,6 +605,14 @@ const NewInstall = () => { endIcon={} disabled={steps[activeStep].nextButtonLabel() == ''} onClick={() => { + if(activeStep == 0 && cleanInstall) { + API.newInstall({ + step: "-1", + }).then((res) => { + refreshStatus() + }); + } + if(activeStep >= steps.length - 1) { API.newInstall({ step: "5", @@ -605,8 +620,9 @@ const NewInstall = () => { setTimeout(() => { window.location.href = hostname + "/cosmos-ui/login"; }, 500); - } else + } else { setActiveStep(activeStep + 1) + } }} >{ steps[activeStep].nextButtonLabel() ? diff --git a/package.json b/package.json index b3bed0f..3f9bb10 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cosmos-server", - "version": "0.9.0-unstable8", + "version": "0.9.0-unstable9", "description": "", "main": "test-server.js", "bugs": { diff --git a/src/newInstall.go b/src/newInstall.go index 4c942a8..2d43a79 100644 --- a/src/newInstall.go +++ b/src/newInstall.go @@ -69,6 +69,20 @@ func NewInstallRoute(w http.ResponseWriter, req *http.Request) { newConfig := utils.GetBaseMainConfig() + if(request.Step == "-1") { + // remove everythin in /config + utils.Log("NewInstall: Step cleanup") + utils.Log("NewInstall: Removing config file") + configFile := utils.GetConfigFileName() + os.Remove(configFile) + if(os.Getenv("HOSTNAME") != "") { + utils.Log("NewInstall: Emptying /config") + os.RemoveAll("/config") + os.Mkdir("/config", 0700) + } + utils.DisconnectDB() + LoadConfig() + } if(request.Step == "2") { utils.Log("NewInstall: Step Database") // User Management & Mongo DB diff --git a/src/utils/db.go b/src/utils/db.go index f9cff6d..16d8889 100644 --- a/src/utils/db.go +++ b/src/utils/db.go @@ -17,7 +17,7 @@ func DB() error { return errors.New("User Management is disabled") } - uri := MainConfig.MongoDB + "/?retryWrites=true&w=majority" + uri := GetBaseMainConfig().MongoDB + "/?retryWrites=true&w=majority" if(client != nil && client.Ping(context.TODO(), readpref.Primary()) == nil) { return nil diff --git a/src/utils/types.go b/src/utils/types.go index 80dc2b5..1849d27 100644 --- a/src/utils/types.go +++ b/src/utils/types.go @@ -94,6 +94,7 @@ type Config struct { type HomepageConfig struct { Background string Widgets []string + Expanded bool } type ThemeConfig struct {