Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Onboarding wizard #1285

Merged
merged 24 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
629df9a
fix(1205): Resource fetching performance improvement for OVH
tanbirali Nov 16, 2023
d344687
Update civo.mdx
jakepage91 Nov 21, 2023
cad8aff
fix: Resource fetching performance improvement for Scaleway (#1212)
tanbirali Nov 21, 2023
70a1231
[KOM-38]: Resource fetching performance improvement for CIVO, Digital…
bishal7679 Nov 21, 2023
9f818e9
fix: no OVH in docs (#1218)
Azanul Nov 21, 2023
6b03062
Update hello-to-new-contributors.yml
AvineshTripathi Nov 22, 2023
e656f97
[FEAT-1092]: Update color names and box-shadows to match Design-Syste…
umrkhn Nov 23, 2023
74a8a0b
feat: add aws codebuild resource (#1216)
AmalRichwin Nov 26, 2023
a24452b
feat: add aws codedeploy resource (#1228)
VanshulB Nov 27, 2023
13445cb
Fix accidental loop capture (#1252)
Azanul Nov 30, 2023
ebef48d
feat: add aws codecommit resource (#1229)
AmalRichwin Dec 1, 2023
6e1e34d
Check for nil VpcId and SubnetId before use (#1254)
codekoala Dec 1, 2023
1109af2
Migration Nextjs 13 to 14 (#1217)
shivam-sharma7 Dec 4, 2023
b98b250
Merge branch 'tailwarden:develop' into develop
Azanul Dec 6, 2023
5e6e5f3
Merge branch 'tailwarden:develop' into develop
Azanul Dec 14, 2023
926184f
feat: create default config.toml instead of error
Azanul Dec 14, 2023
2cc7aa7
fix: create default config.toml instead of error
Azanul Dec 14, 2023
8bc5d24
Merge branch 'develop' into onboarding-wizard
Azanul Dec 15, 2023
a8d0fee
fix: browser saving confidential data
Azanul Dec 15, 2023
0cdf11b
Merge branch 'develop' into onboarding-wizard
Azanul Jan 4, 2024
6c00c48
feat: db first then cloud provider
Azanul Jan 5, 2024
72ff8a1
lint: logrus
Azanul Jan 5, 2024
670a574
feat: fetch resources on cloud account creation
Azanul Jan 8, 2024
9ca2703
Merge branch 'develop' into onboarding-wizard
Azanul Jan 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ package cmd

import (
"errors"
"os"
"path/filepath"
"time"

"github.com/getsentry/sentry-go"
Expand Down Expand Up @@ -31,7 +33,21 @@ var startCmd = &cobra.Command{
if file == "" {
return errors.New("you must specify a config file with '--config PATH'")
}
if file == "config.toml" {
filename, err := filepath.Abs(file)
if err != nil {
return err
}

if _, err := os.Stat(filename); errors.Is(err, os.ErrNotExist) {
log.Info("unable to use given config file:", err)
log.Info("Creating default config.toml")
err = os.WriteFile("config.toml", []byte{}, 0644)
if err != nil {
return err
}
}
}
regions, err := cmd.Flags().GetStringArray("regions")
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion dashboard/components/layout/Layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ function Layout({ children }: LayoutProps) {
title="We could not find a cloud account"
message="Get Started Onboarding"
action={() => {
router.push('/onboarding/choose-cloud');
router.push('/onboarding/choose-database');
}}
actionLabel="Begin Onboarding"
secondaryAction={() => {
Expand Down
1 change: 1 addition & 0 deletions dashboard/components/onboarding-wizard/LabelledInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ function LabelledInput({
}`}
onChange={onChange}
defaultValue={value}
autoComplete="off"
/>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion dashboard/pages/onboarding/cloud-accounts/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export default function CloudAccounts() {
))}
</div>
<div className="fixed bottom-0 -mx-20 flex w-[calc(100%*6/11)] justify-end border-t border-gray-300 bg-white px-20 py-4">
<Button onClick={() => router.push('/onboarding/choose-database')}>
<Button onClick={() => router.push('/onboarding/complete')}>
Next
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion dashboard/pages/onboarding/database/postgres.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function PostgreSQLCredentials() {
message:
'Your Postgres database has been successfully connected to Komiser.'
});
router.push('/onboarding/complete/');
router.push('/onboarding/choose-cloud/');
}
});
};
Expand Down
2 changes: 1 addition & 1 deletion dashboard/pages/onboarding/database/sqlite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default function SqliteCredentials() {
message:
'Your Postgres database has been successfully connected to Komiser.'
});
router.push('/onboarding/complete/');
router.push('/onboarding/choose-cloud/');
}
});
};
Expand Down
8 changes: 4 additions & 4 deletions handlers/accounts_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (

"github.com/BurntSushi/toml"
"github.com/gin-gonic/gin"
"github.com/sirupsen/logrus"
log "github.com/sirupsen/logrus"
"github.com/tailwarden/komiser/models"
"github.com/tailwarden/komiser/utils"
Expand All @@ -33,15 +32,15 @@ func (handler *ApiHandler) IsOnboardedHandler(c *gin.Context) {
}

if handler.db == nil {
output.Status = "PENDING_ACCOUNTS"
output.Status = "PENDING_DATABASE"
c.JSON(http.StatusOK, output)
return
}

accounts := make([]models.Account, 0)
err := handler.db.NewRaw("SELECT * FROM accounts").Scan(handler.ctx, &accounts)
if err != nil {
logrus.WithError(err).Error("scan failed")
log.WithError(err).Error("scan failed")
c.JSON(http.StatusInternalServerError, gin.H{"error": "scan failed"})
return
}
Expand All @@ -65,7 +64,7 @@ func (handler *ApiHandler) ListCloudAccountsHandler(c *gin.Context) {

err := handler.db.NewRaw("SELECT * FROM accounts").Scan(handler.ctx, &accounts)
if err != nil {
logrus.WithError(err).Error("scan failed")
log.WithError(err).Error("scan failed")
c.JSON(http.StatusInternalServerError, gin.H{"error": "scan failed"})
return
}
Expand Down Expand Up @@ -113,6 +112,7 @@ func (handler *ApiHandler) NewCloudAccountHandler(c *gin.Context) {

accountId, _ := result.LastInsertId()
account.Id = accountId
go fetchResourcesForAccount(c, account, handler.db, []string{})
}

if handler.telemetry {
Expand Down
Loading