From c35faf16c21bea68c7fc737d2f0ffc31db634012 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexander=20R=C3=B6sel?=
<320272+Traxmaxx@users.noreply.github.com>
Date: Mon, 16 Oct 2023 19:08:27 +0200
Subject: [PATCH 073/113] fix: adress review comments
---
dashboard/README.md | 41 ++++++++++++++++++++++++++---------------
1 file changed, 26 insertions(+), 15 deletions(-)
diff --git a/dashboard/README.md b/dashboard/README.md
index 7442804d5..0c43f547b 100644
--- a/dashboard/README.md
+++ b/dashboard/README.md
@@ -15,28 +15,39 @@ Komiser dashboard is a [Next.js](https://nextjs.org/) project bootstrapped with
Follow the [Contribution Guide](https://github.com/tailwarden/komiser/blob/develop/CONTRIBUTING.md#contributing-to-komiser-dashboard-ui) first if you haven't done so already. Then come back here and follow the next steps:
-1. Run the development server:
+#### 1. Run the development server:
+From the Komiser root folder start the Komiser server by running:
```shell
+go run \*.go start --config /path/to/config.toml
+```
-# From the Komiser root folder start the Komiser server, run:
+In a different terminal tab navigate to the `/dashboard` folder:
+```shell
+cd dashboard
+```
-go run \*.go start --config /path/to/config.toml
+and run:
-# In a different terminal tab in the dashboard folder, run:
+```shell
+npm install
NEXT_PUBLIC_API_URL=http://localhost:3000 npm run dev
+```
-# Alternatively, you can create an .env file with it:
-
-NEXT_PUBLIC_API_URL=http://localhost:3000
+Alternatively, you can create an .env file with it, either manually or by running:
+```shell
+echo "NEXT_PUBLIC_API_URL=http://localhost:3000" > .env
+```
+and simply run:
+```shell
+npm run dev
```
-Open [http://localhost:3002/](http://localhost:3002). If you see the dashboard, ๐ congrats! It's all up and running correctly.
-![Dashboard Image](https://user-images.githubusercontent.com/13384559/224318056-3d2c68bc-aa56-49c8-841a-bb297e380dc9.png)
+#### 2. Open [http://localhost:3002/](http://localhost:3002). If you see the dashboard, ๐ congrats! It's all up and running correctly.
โ If you get an error page such as this, please refer to the logs and our [docs](https://docs.komiser.io/docs/introduction/getting-started).
-![Error Image](https://user-images.githubusercontent.com/13384559/224320642-0bf6814b-d97a-4ad9-95a0-ca82e353c5d0.png)
+
## ๐งฉ Components
@@ -67,22 +78,22 @@ We will require a story for new shared components like icons, inputs or similar.
- ๐งช Component unit test: component name in `UpperCamelCase.test.*`
- ๐ง Check `Card` example for more details:
- ![Component Example](https://user-images.githubusercontent.com/13384559/224307211-2ce62245-de24-4ee7-a156-fb54d8d34b4f.png)
+
**Additional instructions:**
- ๐ To view this component on Storybook, run: `npm run storybook`, then pick `Card`
- ![Storybook Image](https://user-images.githubusercontent.com/13384559/224320112-e21d2ed4-1e22-4a33-adb3-6c236c4d4208.png)
+
- ๐งช To run the unit tests, run: `npm run test:watch`, hit `p`, then `card`
- ![Unit Test Image](https://user-images.githubusercontent.com/13384559/224320260-19b1359e-1bfb-4db5-8379-918dacd7da44.png)
+
## ๐งช Testing
We use Jest & React Testing Library for our unit tests.
- To run the unit tests, run: `npm run test:watch`, hit `p`, then `card`
-
+
**Testing convention:**
@@ -168,7 +179,7 @@ it('opens the dropdown when clicked', () => {
[**Storybook**](https://storybook.komiser.io/) is a tool for UI development. It makes development faster by isolating components. This allows you to work on one component at a time. If you create a new shared component or want to visualize variations of an existing one, follow these steps:
- To view this component on Storybook locally, run: `npm run storybook`, then pick an example (`Card`) or your new component story
-
+
### 1. **Create the Story**:
From 402cfb4fd48a336682f2325edae4763b5ea78fc1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexander=20R=C3=B6sel?=
<320272+Traxmaxx@users.noreply.github.com>
Date: Mon, 16 Oct 2023 19:13:00 +0200
Subject: [PATCH 074/113] fix: adress review comments
---
dashboard/README.md | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/dashboard/README.md b/dashboard/README.md
index 0c43f547b..b28d53070 100644
--- a/dashboard/README.md
+++ b/dashboard/README.md
@@ -18,11 +18,13 @@ Follow the [Contribution Guide](https://github.com/tailwarden/komiser/blob/devel
#### 1. Run the development server:
From the Komiser root folder start the Komiser server by running:
+
```shell
go run \*.go start --config /path/to/config.toml
```
In a different terminal tab navigate to the `/dashboard` folder:
+
```shell
cd dashboard
```
@@ -36,10 +38,13 @@ NEXT_PUBLIC_API_URL=http://localhost:3000 npm run dev
```
Alternatively, you can create an .env file with it, either manually or by running:
+
```shell
echo "NEXT_PUBLIC_API_URL=http://localhost:3000" > .env
```
+
and simply run:
+
```shell
npm run dev
```
@@ -92,8 +97,7 @@ We will require a story for new shared components like icons, inputs or similar.
We use Jest & React Testing Library for our unit tests.
-- To run the unit tests, run: `npm run test:watch`, hit `p`, then `card`
-
+- To run the unit tests, run: `npm run test`
**Testing convention:**
From 5f654cc61ee083f70a8d4121caa5e52ac1cc4d45 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexander=20R=C3=B6sel?=
<320272+Traxmaxx@users.noreply.github.com>
Date: Mon, 16 Oct 2023 19:28:36 +0200
Subject: [PATCH 075/113] fix: adress review comments
---
dashboard/README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dashboard/README.md b/dashboard/README.md
index b28d53070..b62154269 100644
--- a/dashboard/README.md
+++ b/dashboard/README.md
@@ -88,9 +88,9 @@ We will require a story for new shared components like icons, inputs or similar.
**Additional instructions:**
- ๐ To view this component on Storybook, run: `npm run storybook`, then pick `Card`
+
- ๐งช To run the unit tests, run: `npm run test:watch`, hit `p`, then `card`
-
## ๐งช Testing
From 664a59ccac742b2eb8d7d58c02a82e53e8c06af4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexander=20R=C3=B6sel?=
<320272+Traxmaxx@users.noreply.github.com>
Date: Mon, 16 Oct 2023 20:02:46 +0200
Subject: [PATCH 076/113] fix: adress review comments
---
dashboard/README.md | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/dashboard/README.md b/dashboard/README.md
index b62154269..e6a307ac8 100644
--- a/dashboard/README.md
+++ b/dashboard/README.md
@@ -88,7 +88,6 @@ We will require a story for new shared components like icons, inputs or similar.
**Additional instructions:**
- ๐ To view this component on Storybook, run: `npm run storybook`, then pick `Card`
-
- ๐งช To run the unit tests, run: `npm run test:watch`, hit `p`, then `card`
@@ -183,7 +182,7 @@ it('opens the dropdown when clicked', () => {
[**Storybook**](https://storybook.komiser.io/) is a tool for UI development. It makes development faster by isolating components. This allows you to work on one component at a time. If you create a new shared component or want to visualize variations of an existing one, follow these steps:
- To view this component on Storybook locally, run: `npm run storybook`, then pick an example (`Card`) or your new component story
-
+
### 1. **Create the Story**:
From 4648409fa4570460fe821a9b40b9fe425fd3c2a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexander=20R=C3=B6sel?=
<320272+Traxmaxx@users.noreply.github.com>
Date: Mon, 16 Oct 2023 20:03:53 +0200
Subject: [PATCH 077/113] fix: adress review comments
---
dashboard/README.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dashboard/README.md b/dashboard/README.md
index e6a307ac8..7af0d8de8 100644
--- a/dashboard/README.md
+++ b/dashboard/README.md
@@ -88,8 +88,10 @@ We will require a story for new shared components like icons, inputs or similar.
**Additional instructions:**
- ๐ To view this component on Storybook, run: `npm run storybook`, then pick `Card`
+
- ๐งช To run the unit tests, run: `npm run test:watch`, hit `p`, then `card`
+
## ๐งช Testing
@@ -182,7 +184,7 @@ it('opens the dropdown when clicked', () => {
[**Storybook**](https://storybook.komiser.io/) is a tool for UI development. It makes development faster by isolating components. This allows you to work on one component at a time. If you create a new shared component or want to visualize variations of an existing one, follow these steps:
- To view this component on Storybook locally, run: `npm run storybook`, then pick an example (`Card`) or your new component story
-
+
### 1. **Create the Story**:
From 36055d3c83aa31d721c77468d09ff1fc571f7223 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexander=20R=C3=B6sel?=
<320272+Traxmaxx@users.noreply.github.com>
Date: Mon, 16 Oct 2023 20:04:59 +0200
Subject: [PATCH 078/113] fix: adress review comments
---
dashboard/README.md | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dashboard/README.md b/dashboard/README.md
index 7af0d8de8..1b423fcb3 100644
--- a/dashboard/README.md
+++ b/dashboard/README.md
@@ -90,6 +90,7 @@ We will require a story for new shared components like icons, inputs or similar.
- ๐ To view this component on Storybook, run: `npm run storybook`, then pick `Card`
+
- ๐งช To run the unit tests, run: `npm run test:watch`, hit `p`, then `card`
@@ -184,6 +185,7 @@ it('opens the dropdown when clicked', () => {
[**Storybook**](https://storybook.komiser.io/) is a tool for UI development. It makes development faster by isolating components. This allows you to work on one component at a time. If you create a new shared component or want to visualize variations of an existing one, follow these steps:
- To view this component on Storybook locally, run: `npm run storybook`, then pick an example (`Card`) or your new component story
+
### 1. **Create the Story**:
From 3163755857951b90dfa16a108e05d3a9c540612c Mon Sep 17 00:00:00 2001
From: Azanul
Date: Mon, 16 Oct 2023 23:46:57 +0530
Subject: [PATCH 079/113] fix: golangci lint
Signed-off-by: Azanul
---
.github/workflows/lint.yml | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index dffddfc31..c0213f7fd 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -1,6 +1,5 @@
name: Lint
-on:
- push:
+on: pull_request
jobs:
lint:
@@ -8,10 +7,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
+
- name: Setup go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
+
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
From 8a86970acf038e42f1a9e5146a36f8d08c93f54e Mon Sep 17 00:00:00 2001
From: Azanul
Date: Tue, 17 Oct 2023 00:28:34 +0530
Subject: [PATCH 080/113] fix: golangci lint
Signed-off-by: Azanul
---
.github/workflows/lint.yml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
index c0213f7fd..b12288514 100644
--- a/.github/workflows/lint.yml
+++ b/.github/workflows/lint.yml
@@ -17,4 +17,5 @@ jobs:
uses: golangci/golangci-lint-action@v3
with:
args: --timeout=10m
- version: v1.54.2
\ No newline at end of file
+ version: v1.54.2
+ skip-pkg-cache: true
\ No newline at end of file
From a7caa3259ca0d3a95584600a6c5d142687086e58 Mon Sep 17 00:00:00 2001
From: jbleduigou
Date: Mon, 16 Oct 2023 21:33:28 +0200
Subject: [PATCH 081/113] feat: retrieve tags of Kinesis Data Streams
---
providers/aws/kinesis/streams.go | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/providers/aws/kinesis/streams.go b/providers/aws/kinesis/streams.go
index de718e6d4..e7306e5cd 100644
--- a/providers/aws/kinesis/streams.go
+++ b/providers/aws/kinesis/streams.go
@@ -30,6 +30,18 @@ func Streams(ctx context.Context, client ProviderClient) ([]Resource, error) {
}
for _, stream := range output.StreamSummaries {
+ tags := make([]Tag, 0)
+ tagsResp, err := kinesisClient.ListTagsForStream(context.Background(), &kinesis.ListTagsForStreamInput{
+ StreamARN: stream.StreamARN,
+ })
+ if err == nil {
+ for _, t := range tagsResp.Tags {
+ tags = append(tags, Tag{
+ Key: aws.ToString(t.Key),
+ Value: aws.ToString(t.Value),
+ })
+ }
+ }
resources = append(resources, Resource{
Provider: "AWS",
Account: client.Name,
@@ -40,6 +52,7 @@ func Streams(ctx context.Context, client ProviderClient) ([]Resource, error) {
Cost: 0,
CreatedAt: *stream.StreamCreationTimestamp,
FetchedAt: time.Now(),
+ Tags: tags,
Link: fmt.Sprintf("https://%s.console.aws.amazon.com/kinesis/home?region=%s#/streams/details/%s", client.AWSClient.Region, client.AWSClient.Region, *stream.StreamName),
})
consumers, err := getStreamConsumers(ctx, kinesisClient, stream, client.Name, client.AWSClient.Region)
From 37b1262444d611ab9298515e6cf061da499ac74e Mon Sep 17 00:00:00 2001
From: ShubhamPalriwala
Date: Tue, 17 Oct 2023 09:46:07 +0530
Subject: [PATCH 082/113] feat: integrate formbricks in-app survey
---
dashboard/package-lock.json | 246 ++++++++++++++++++------------------
dashboard/package.json | 1 +
dashboard/pages/_app.tsx | 19 +++
3 files changed, 146 insertions(+), 120 deletions(-)
diff --git a/dashboard/package-lock.json b/dashboard/package-lock.json
index ce948cb7f..b91a54122 100644
--- a/dashboard/package-lock.json
+++ b/dashboard/package-lock.json
@@ -8,6 +8,7 @@
"name": "komiser-dashboard",
"version": "3.1.0",
"dependencies": {
+ "@formbricks/js": "^1.1.2",
"@sentry/react": "^7.41.0",
"@sentry/tracing": "^7.41.0",
"@tippyjs/react": "^4.2.6",
@@ -2934,6 +2935,11 @@
"integrity": "sha512-qprfWkn82Iw821mcKofJ5Pk9wgioHicxcQMxx+5zt5GSKoqdWvgG5AxVmpmUUjzTLPVSH5auBrhI93Deayn/DA==",
"dev": true
},
+ "node_modules/@formbricks/js": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/@formbricks/js/-/js-1.1.2.tgz",
+ "integrity": "sha512-1dz7pAFEykERzJXaAuqO0PkG7Fj+4Zbj3SNOxdorVRU/O6O3GtyCx56/LXT7DVX+dOEhZttDt56o+j/hDmGnyw=="
+ },
"node_modules/@humanwhocodes/config-array": {
"version": "0.11.11",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.11.tgz",
@@ -3575,6 +3581,126 @@
"node": ">= 10"
}
},
+ "node_modules/@next/swc-darwin-x64": {
+ "version": "13.5.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.5.4.tgz",
+ "integrity": "sha512-siPuUwO45PnNRMeZnSa8n/Lye5ZX93IJom9wQRB5DEOdFrw0JjOMu1GINB8jAEdwa7Vdyn1oJ2xGNaQpdQQ9Pw==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-arm64-gnu": {
+ "version": "13.5.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.5.4.tgz",
+ "integrity": "sha512-l/k/fvRP/zmB2jkFMfefmFkyZbDkYW0mRM/LB+tH5u9pB98WsHXC0WvDHlGCYp3CH/jlkJPL7gN8nkTQVrQ/2w==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-arm64-musl": {
+ "version": "13.5.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.5.4.tgz",
+ "integrity": "sha512-YYGb7SlLkI+XqfQa8VPErljb7k9nUnhhRrVaOdfJNCaQnHBcvbT7cx/UjDQLdleJcfyg1Hkn5YSSIeVfjgmkTg==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-x64-gnu": {
+ "version": "13.5.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.5.4.tgz",
+ "integrity": "sha512-uE61vyUSClnCH18YHjA8tE1prr/PBFlBFhxBZis4XBRJoR+txAky5d7gGNUIbQ8sZZ7LVkSVgm/5Fc7mwXmRAg==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-x64-musl": {
+ "version": "13.5.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.5.4.tgz",
+ "integrity": "sha512-qVEKFYML/GvJSy9CfYqAdUexA6M5AklYcQCW+8JECmkQHGoPxCf04iMh7CPR7wkHyWWK+XLt4Ja7hhsPJtSnhg==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-win32-arm64-msvc": {
+ "version": "13.5.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.5.4.tgz",
+ "integrity": "sha512-mDSQfqxAlfpeZOLPxLymZkX0hYF3juN57W6vFHTvwKlnHfmh12Pt7hPIRLYIShk8uYRsKPtMTth/EzpwRI+u8w==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-win32-ia32-msvc": {
+ "version": "13.5.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.5.4.tgz",
+ "integrity": "sha512-aoqAT2XIekIWoriwzOmGFAvTtVY5O7JjV21giozBTP5c6uZhpvTWRbmHXbmsjZqY4HnEZQRXWkSAppsIBweKqw==",
+ "cpu": [
+ "ia32"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-win32-x64-msvc": {
+ "version": "13.5.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.5.4.tgz",
+ "integrity": "sha512-cyRvlAxwlddlqeB9xtPSfNSCRy8BOa4wtMo0IuI9P7Y0XT2qpDrpFKRyZ7kUngZis59mPVla5k8X1oOJ8RxDYg==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -23985,126 +24111,6 @@
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
- },
- "node_modules/@next/swc-darwin-x64": {
- "version": "13.5.4",
- "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.5.4.tgz",
- "integrity": "sha512-siPuUwO45PnNRMeZnSa8n/Lye5ZX93IJom9wQRB5DEOdFrw0JjOMu1GINB8jAEdwa7Vdyn1oJ2xGNaQpdQQ9Pw==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-linux-arm64-gnu": {
- "version": "13.5.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.5.4.tgz",
- "integrity": "sha512-l/k/fvRP/zmB2jkFMfefmFkyZbDkYW0mRM/LB+tH5u9pB98WsHXC0WvDHlGCYp3CH/jlkJPL7gN8nkTQVrQ/2w==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-linux-arm64-musl": {
- "version": "13.5.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.5.4.tgz",
- "integrity": "sha512-YYGb7SlLkI+XqfQa8VPErljb7k9nUnhhRrVaOdfJNCaQnHBcvbT7cx/UjDQLdleJcfyg1Hkn5YSSIeVfjgmkTg==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-linux-x64-gnu": {
- "version": "13.5.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.5.4.tgz",
- "integrity": "sha512-uE61vyUSClnCH18YHjA8tE1prr/PBFlBFhxBZis4XBRJoR+txAky5d7gGNUIbQ8sZZ7LVkSVgm/5Fc7mwXmRAg==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-linux-x64-musl": {
- "version": "13.5.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.5.4.tgz",
- "integrity": "sha512-qVEKFYML/GvJSy9CfYqAdUexA6M5AklYcQCW+8JECmkQHGoPxCf04iMh7CPR7wkHyWWK+XLt4Ja7hhsPJtSnhg==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-win32-arm64-msvc": {
- "version": "13.5.4",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.5.4.tgz",
- "integrity": "sha512-mDSQfqxAlfpeZOLPxLymZkX0hYF3juN57W6vFHTvwKlnHfmh12Pt7hPIRLYIShk8uYRsKPtMTth/EzpwRI+u8w==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-win32-ia32-msvc": {
- "version": "13.5.4",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.5.4.tgz",
- "integrity": "sha512-aoqAT2XIekIWoriwzOmGFAvTtVY5O7JjV21giozBTP5c6uZhpvTWRbmHXbmsjZqY4HnEZQRXWkSAppsIBweKqw==",
- "cpu": [
- "ia32"
- ],
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-win32-x64-msvc": {
- "version": "13.5.4",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.5.4.tgz",
- "integrity": "sha512-cyRvlAxwlddlqeB9xtPSfNSCRy8BOa4wtMo0IuI9P7Y0XT2qpDrpFKRyZ7kUngZis59mPVla5k8X1oOJ8RxDYg==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
}
}
}
diff --git a/dashboard/package.json b/dashboard/package.json
index bce604520..524ca343d 100644
--- a/dashboard/package.json
+++ b/dashboard/package.json
@@ -14,6 +14,7 @@
"test:watch": "jest --watch"
},
"dependencies": {
+ "@formbricks/js": "^1.1.2",
"@sentry/react": "^7.41.0",
"@sentry/tracing": "^7.41.0",
"@tippyjs/react": "^4.2.6",
diff --git a/dashboard/pages/_app.tsx b/dashboard/pages/_app.tsx
index c891d30d9..3ac787fa8 100644
--- a/dashboard/pages/_app.tsx
+++ b/dashboard/pages/_app.tsx
@@ -1,5 +1,8 @@
import '../styles/globals.css';
import type { AppProps } from 'next/app';
+import formbricks from '@formbricks/js';
+import { useRouter } from 'next/router';
+import { useEffect } from 'react';
import Layout from '../components/layout/Layout';
const printHiringMessage = () => {
@@ -22,9 +25,25 @@ const printHiringMessage = () => {
if (typeof window !== 'undefined') {
printHiringMessage();
+ formbricks.init({
+ environmentId: 'clnmmpeg01ci3o50fu5wy89zn',
+ apiHost: 'https://app.formbricks.com',
+ debug: true // remove when in production
+ });
}
export default function App({ Component, pageProps }: AppProps) {
+ const router = useRouter();
+
+ useEffect(() => {
+ // Connect next.js router to Formbricks
+ const handleRouteChange = formbricks?.registerRouteChange;
+ router.events.on('routeChangeComplete', handleRouteChange);
+
+ return () => {
+ router.events.off('routeChangeComplete', handleRouteChange);
+ };
+ }, []);
return (
From 2a6c587da57c9478d2a095db0b5ffd4937c7ea3b Mon Sep 17 00:00:00 2001
From: Shubham Palriwala
Date: Tue, 17 Oct 2023 09:52:28 +0530
Subject: [PATCH 083/113] fix: make formbricks debug false
---
dashboard/pages/_app.tsx | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dashboard/pages/_app.tsx b/dashboard/pages/_app.tsx
index 3ac787fa8..56a29b068 100644
--- a/dashboard/pages/_app.tsx
+++ b/dashboard/pages/_app.tsx
@@ -28,7 +28,7 @@ if (typeof window !== 'undefined') {
formbricks.init({
environmentId: 'clnmmpeg01ci3o50fu5wy89zn',
apiHost: 'https://app.formbricks.com',
- debug: true // remove when in production
+ debug: false // remove when in production
});
}
From 25c9c28dd2fe2fd93c02c875d9173b0831bf71a7 Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Le Duigou
Date: Tue, 17 Oct 2023 07:33:58 +0200
Subject: [PATCH 084/113] fix: log message when failed to retrieve tags
Co-authored-by: Azanul Haque <42029519+Azanul@users.noreply.github.com>
---
providers/aws/kinesis/streams.go | 2 ++
1 file changed, 2 insertions(+)
diff --git a/providers/aws/kinesis/streams.go b/providers/aws/kinesis/streams.go
index e7306e5cd..6052ba3ae 100644
--- a/providers/aws/kinesis/streams.go
+++ b/providers/aws/kinesis/streams.go
@@ -41,6 +41,8 @@ func Streams(ctx context.Context, client ProviderClient) ([]Resource, error) {
Value: aws.ToString(t.Value),
})
}
+ } else {
+ log.Warn("Failed to fetch tags for kinesis streams")
}
resources = append(resources, Resource{
Provider: "AWS",
From 8ce39e9f87699c0e553f9f7389bfc12e0d728617 Mon Sep 17 00:00:00 2001
From: LABOUARDY Mohamed
Date: Tue, 17 Oct 2023 09:27:14 +0200
Subject: [PATCH 085/113] include ph badge
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index ce3a84c85..39dcc3ed1 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
---
-
+
Komiser is an open-source cloud-agnostic resource manager designed to analyze and manage cloud cost, usage, security, and governance all in one place. It integrates seamlessly with multiple cloud providers, including AWS, Azure, Civo, Digital Ocean, OCI, Linode, Tencent, Scaleway and [more](#supported-cloud-providers). Interested? read more about Komiser on our [website](https://komiser.io?utm_source=github&utm_medium=social).
From 6b7b3d29c6c7fca22cf780536ba946c57e3d1f19 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 17 Oct 2023 10:24:42 +0000
Subject: [PATCH 086/113] chore(deps-dev): bump @storybook/addons in /dashboard
Bumps [@storybook/addons](https://github.com/storybookjs/storybook/tree/HEAD/code/deprecated/addons) from 7.4.3 to 7.4.6.
- [Release notes](https://github.com/storybookjs/storybook/releases)
- [Changelog](https://github.com/storybookjs/storybook/blob/next/CHANGELOG.md)
- [Commits](https://github.com/storybookjs/storybook/commits/v7.4.6/code/deprecated/addons)
---
updated-dependencies:
- dependency-name: "@storybook/addons"
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
dashboard/package-lock.json | 383 +++++++++++++++++++++++-------------
dashboard/package.json | 2 +-
2 files changed, 244 insertions(+), 141 deletions(-)
diff --git a/dashboard/package-lock.json b/dashboard/package-lock.json
index ce948cb7f..278859860 100644
--- a/dashboard/package-lock.json
+++ b/dashboard/package-lock.json
@@ -35,7 +35,7 @@
"@storybook/addon-essentials": "^7.4.6",
"@storybook/addon-interactions": "^7.0.0-beta.52",
"@storybook/addon-links": "^7.0.0-beta.52",
- "@storybook/addons": "^7.0.0-beta.52",
+ "@storybook/addons": "^7.4.6",
"@storybook/blocks": "^7.4.5",
"@storybook/nextjs": "^7.0.0-alpha.41",
"@storybook/preview-api": "^7.4.6",
@@ -3575,6 +3575,126 @@
"node": ">= 10"
}
},
+ "node_modules/@next/swc-darwin-x64": {
+ "version": "13.5.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.5.4.tgz",
+ "integrity": "sha512-siPuUwO45PnNRMeZnSa8n/Lye5ZX93IJom9wQRB5DEOdFrw0JjOMu1GINB8jAEdwa7Vdyn1oJ2xGNaQpdQQ9Pw==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-arm64-gnu": {
+ "version": "13.5.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.5.4.tgz",
+ "integrity": "sha512-l/k/fvRP/zmB2jkFMfefmFkyZbDkYW0mRM/LB+tH5u9pB98WsHXC0WvDHlGCYp3CH/jlkJPL7gN8nkTQVrQ/2w==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-arm64-musl": {
+ "version": "13.5.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.5.4.tgz",
+ "integrity": "sha512-YYGb7SlLkI+XqfQa8VPErljb7k9nUnhhRrVaOdfJNCaQnHBcvbT7cx/UjDQLdleJcfyg1Hkn5YSSIeVfjgmkTg==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-x64-gnu": {
+ "version": "13.5.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.5.4.tgz",
+ "integrity": "sha512-uE61vyUSClnCH18YHjA8tE1prr/PBFlBFhxBZis4XBRJoR+txAky5d7gGNUIbQ8sZZ7LVkSVgm/5Fc7mwXmRAg==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-linux-x64-musl": {
+ "version": "13.5.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.5.4.tgz",
+ "integrity": "sha512-qVEKFYML/GvJSy9CfYqAdUexA6M5AklYcQCW+8JECmkQHGoPxCf04iMh7CPR7wkHyWWK+XLt4Ja7hhsPJtSnhg==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-win32-arm64-msvc": {
+ "version": "13.5.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.5.4.tgz",
+ "integrity": "sha512-mDSQfqxAlfpeZOLPxLymZkX0hYF3juN57W6vFHTvwKlnHfmh12Pt7hPIRLYIShk8uYRsKPtMTth/EzpwRI+u8w==",
+ "cpu": [
+ "arm64"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-win32-ia32-msvc": {
+ "version": "13.5.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.5.4.tgz",
+ "integrity": "sha512-aoqAT2XIekIWoriwzOmGFAvTtVY5O7JjV21giozBTP5c6uZhpvTWRbmHXbmsjZqY4HnEZQRXWkSAppsIBweKqw==",
+ "cpu": [
+ "ia32"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
+ "node_modules/@next/swc-win32-x64-msvc": {
+ "version": "13.5.4",
+ "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.5.4.tgz",
+ "integrity": "sha512-cyRvlAxwlddlqeB9xtPSfNSCRy8BOa4wtMo0IuI9P7Y0XT2qpDrpFKRyZ7kUngZis59mPVla5k8X1oOJ8RxDYg==",
+ "cpu": [
+ "x64"
+ ],
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">= 10"
+ }
+ },
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@@ -6252,14 +6372,14 @@
}
},
"node_modules/@storybook/addons": {
- "version": "7.4.3",
- "resolved": "https://registry.npmjs.org/@storybook/addons/-/addons-7.4.3.tgz",
- "integrity": "sha512-6XvXE3sRl78MceRDAnfPd6N6j9ltMCuTITjjqU2GU8iyAexJ4bYodfKcmUmAQmixuc+6UPbWmlrQKNmBDlp3rw==",
+ "version": "7.4.6",
+ "resolved": "https://registry.npmjs.org/@storybook/addons/-/addons-7.4.6.tgz",
+ "integrity": "sha512-c+4awrtwNlJayFdgLkEXa5H2Gj+KNlxuN+Z5oDAdZBLqXI8g0gn7eYO2F/eCSIDWdd/+zcU2uq57XPFKc8veHQ==",
"dev": true,
"dependencies": {
- "@storybook/manager-api": "7.4.3",
- "@storybook/preview-api": "7.4.3",
- "@storybook/types": "7.4.3"
+ "@storybook/manager-api": "7.4.6",
+ "@storybook/preview-api": "7.4.6",
+ "@storybook/types": "7.4.6"
},
"funding": {
"type": "opencollective",
@@ -6270,26 +6390,110 @@
"react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
}
},
- "node_modules/@storybook/addons/node_modules/@storybook/preview-api": {
- "version": "7.4.3",
- "resolved": "https://registry.npmjs.org/@storybook/preview-api/-/preview-api-7.4.3.tgz",
- "integrity": "sha512-qKwfH2+qN1Zpz2UX6dQLiTU5x2JH3o/+jOY4GYF6c3atTm5WAu1OvCYAJVb6MdXfAhZNuPwDKnJR8VmzWplWBg==",
+ "node_modules/@storybook/addons/node_modules/@storybook/channels": {
+ "version": "7.4.6",
+ "resolved": "https://registry.npmjs.org/@storybook/channels/-/channels-7.4.6.tgz",
+ "integrity": "sha512-yPv/sfo2c18fM3fvG0i1xse63vG8l33Al/OU0k/dtovltPu001/HVa1QgBgsb/QrEfZtvGjGhmtdVeYb39fv3A==",
"dev": true,
"dependencies": {
- "@storybook/channels": "7.4.3",
- "@storybook/client-logger": "7.4.3",
- "@storybook/core-events": "7.4.3",
+ "@storybook/client-logger": "7.4.6",
+ "@storybook/core-events": "7.4.6",
+ "@storybook/global": "^5.0.0",
+ "qs": "^6.10.0",
+ "telejson": "^7.2.0",
+ "tiny-invariant": "^1.3.1"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/storybook"
+ }
+ },
+ "node_modules/@storybook/addons/node_modules/@storybook/client-logger": {
+ "version": "7.4.6",
+ "resolved": "https://registry.npmjs.org/@storybook/client-logger/-/client-logger-7.4.6.tgz",
+ "integrity": "sha512-XDw31ZziU//86PKuMRnmc+L/G0VopaGKENQOGEpvAXCU9IZASwGKlKAtcyosjrpi+ZiUXlMgUXCpXM7x3b1Ehw==",
+ "dev": true,
+ "dependencies": {
+ "@storybook/global": "^5.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/storybook"
+ }
+ },
+ "node_modules/@storybook/addons/node_modules/@storybook/core-events": {
+ "version": "7.4.6",
+ "resolved": "https://registry.npmjs.org/@storybook/core-events/-/core-events-7.4.6.tgz",
+ "integrity": "sha512-r5vrE+32lwrJh1NGFr1a0mWjvxo7q8FXYShylcwRWpacmL5NTtLkrXOoJSeGvJ4yKNYkvxQFtOPId4lzDxa32w==",
+ "dev": true,
+ "dependencies": {
+ "ts-dedent": "^2.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/storybook"
+ }
+ },
+ "node_modules/@storybook/addons/node_modules/@storybook/manager-api": {
+ "version": "7.4.6",
+ "resolved": "https://registry.npmjs.org/@storybook/manager-api/-/manager-api-7.4.6.tgz",
+ "integrity": "sha512-inrm3DIbCp8wjXSN/wK6e6i2ysQ/IEmtC7IN0OJ7vdrp+USCooPT448SQTUmVctUGCFmOU3fxXByq8g77oIi7w==",
+ "dev": true,
+ "dependencies": {
+ "@storybook/channels": "7.4.6",
+ "@storybook/client-logger": "7.4.6",
+ "@storybook/core-events": "7.4.6",
"@storybook/csf": "^0.1.0",
"@storybook/global": "^5.0.0",
- "@storybook/types": "7.4.3",
- "@types/qs": "^6.9.5",
+ "@storybook/router": "7.4.6",
+ "@storybook/theming": "7.4.6",
+ "@storybook/types": "7.4.6",
"dequal": "^2.0.2",
"lodash": "^4.17.21",
"memoizerific": "^1.11.3",
- "qs": "^6.10.0",
- "synchronous-promise": "^2.0.15",
- "ts-dedent": "^2.0.0",
- "util-deprecate": "^1.0.2"
+ "semver": "^7.3.7",
+ "store2": "^2.14.2",
+ "telejson": "^7.2.0",
+ "ts-dedent": "^2.0.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/storybook"
+ },
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
+ }
+ },
+ "node_modules/@storybook/addons/node_modules/@storybook/router": {
+ "version": "7.4.6",
+ "resolved": "https://registry.npmjs.org/@storybook/router/-/router-7.4.6.tgz",
+ "integrity": "sha512-Vl1esrHkcHxDKqc+HY7+6JQpBPW3zYvGk0cQ2rxVMhWdLZTAz1hss9DqzN9tFnPyfn0a1Q77EpMySkUrvWKKNQ==",
+ "dev": true,
+ "dependencies": {
+ "@storybook/client-logger": "7.4.6",
+ "memoizerific": "^1.11.3",
+ "qs": "^6.10.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/storybook"
+ },
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
+ }
+ },
+ "node_modules/@storybook/addons/node_modules/@storybook/types": {
+ "version": "7.4.6",
+ "resolved": "https://registry.npmjs.org/@storybook/types/-/types-7.4.6.tgz",
+ "integrity": "sha512-6QLXtMVsFZFpzPkdGWsu/iuc8na9dnS67AMOBKm5qCLPwtUJOYkwhMdFRSSeJthLRpzV7JLAL8Kwvl7MFP3QSw==",
+ "dev": true,
+ "dependencies": {
+ "@storybook/channels": "7.4.6",
+ "@types/babel__core": "^7.0.0",
+ "@types/express": "^4.7.0",
+ "file-system-cache": "2.3.0"
},
"funding": {
"type": "opencollective",
@@ -6744,6 +6948,25 @@
}
}
},
+ "node_modules/@storybook/builder-webpack5/node_modules/@storybook/addons": {
+ "version": "7.4.3",
+ "resolved": "https://registry.npmjs.org/@storybook/addons/-/addons-7.4.3.tgz",
+ "integrity": "sha512-6XvXE3sRl78MceRDAnfPd6N6j9ltMCuTITjjqU2GU8iyAexJ4bYodfKcmUmAQmixuc+6UPbWmlrQKNmBDlp3rw==",
+ "dev": true,
+ "dependencies": {
+ "@storybook/manager-api": "7.4.3",
+ "@storybook/preview-api": "7.4.3",
+ "@storybook/types": "7.4.3"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/storybook"
+ },
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0"
+ }
+ },
"node_modules/@storybook/builder-webpack5/node_modules/@storybook/preview-api": {
"version": "7.4.3",
"resolved": "https://registry.npmjs.org/@storybook/preview-api/-/preview-api-7.4.3.tgz",
@@ -23985,126 +24208,6 @@
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
- },
- "node_modules/@next/swc-darwin-x64": {
- "version": "13.5.4",
- "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-13.5.4.tgz",
- "integrity": "sha512-siPuUwO45PnNRMeZnSa8n/Lye5ZX93IJom9wQRB5DEOdFrw0JjOMu1GINB8jAEdwa7Vdyn1oJ2xGNaQpdQQ9Pw==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "darwin"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-linux-arm64-gnu": {
- "version": "13.5.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-13.5.4.tgz",
- "integrity": "sha512-l/k/fvRP/zmB2jkFMfefmFkyZbDkYW0mRM/LB+tH5u9pB98WsHXC0WvDHlGCYp3CH/jlkJPL7gN8nkTQVrQ/2w==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-linux-arm64-musl": {
- "version": "13.5.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-13.5.4.tgz",
- "integrity": "sha512-YYGb7SlLkI+XqfQa8VPErljb7k9nUnhhRrVaOdfJNCaQnHBcvbT7cx/UjDQLdleJcfyg1Hkn5YSSIeVfjgmkTg==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-linux-x64-gnu": {
- "version": "13.5.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-13.5.4.tgz",
- "integrity": "sha512-uE61vyUSClnCH18YHjA8tE1prr/PBFlBFhxBZis4XBRJoR+txAky5d7gGNUIbQ8sZZ7LVkSVgm/5Fc7mwXmRAg==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-linux-x64-musl": {
- "version": "13.5.4",
- "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-13.5.4.tgz",
- "integrity": "sha512-qVEKFYML/GvJSy9CfYqAdUexA6M5AklYcQCW+8JECmkQHGoPxCf04iMh7CPR7wkHyWWK+XLt4Ja7hhsPJtSnhg==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "linux"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-win32-arm64-msvc": {
- "version": "13.5.4",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-13.5.4.tgz",
- "integrity": "sha512-mDSQfqxAlfpeZOLPxLymZkX0hYF3juN57W6vFHTvwKlnHfmh12Pt7hPIRLYIShk8uYRsKPtMTth/EzpwRI+u8w==",
- "cpu": [
- "arm64"
- ],
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-win32-ia32-msvc": {
- "version": "13.5.4",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-13.5.4.tgz",
- "integrity": "sha512-aoqAT2XIekIWoriwzOmGFAvTtVY5O7JjV21giozBTP5c6uZhpvTWRbmHXbmsjZqY4HnEZQRXWkSAppsIBweKqw==",
- "cpu": [
- "ia32"
- ],
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
- },
- "node_modules/@next/swc-win32-x64-msvc": {
- "version": "13.5.4",
- "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.5.4.tgz",
- "integrity": "sha512-cyRvlAxwlddlqeB9xtPSfNSCRy8BOa4wtMo0IuI9P7Y0XT2qpDrpFKRyZ7kUngZis59mPVla5k8X1oOJ8RxDYg==",
- "cpu": [
- "x64"
- ],
- "optional": true,
- "os": [
- "win32"
- ],
- "engines": {
- "node": ">= 10"
- }
}
}
}
diff --git a/dashboard/package.json b/dashboard/package.json
index 0a9667039..107a7f2e6 100644
--- a/dashboard/package.json
+++ b/dashboard/package.json
@@ -42,7 +42,7 @@
"@storybook/addon-essentials": "^7.4.6",
"@storybook/addon-interactions": "^7.0.0-beta.52",
"@storybook/addon-links": "^7.0.0-beta.52",
- "@storybook/addons": "^7.0.0-beta.52",
+ "@storybook/addons": "^7.4.6",
"@storybook/blocks": "^7.4.5",
"@storybook/nextjs": "^7.0.0-alpha.41",
"@storybook/preview-api": "^7.4.6",
From fb0bf02aa5fc844490ea0c12d2c89deb4876beed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexander=20R=C3=B6sel?=
<320272+Traxmaxx@users.noreply.github.com>
Date: Tue, 17 Oct 2023 12:34:17 +0200
Subject: [PATCH 087/113] feat: fetch DynamoDB costs for RCUs and WCUs
---
providers/aws/dynamodb/tables.go | 62 +++++++++++++++++++++++++++++++-
1 file changed, 61 insertions(+), 1 deletion(-)
diff --git a/providers/aws/dynamodb/tables.go b/providers/aws/dynamodb/tables.go
index 284c5b262..14e719fc0 100644
--- a/providers/aws/dynamodb/tables.go
+++ b/providers/aws/dynamodb/tables.go
@@ -7,16 +7,54 @@ import (
log "github.com/sirupsen/logrus"
+ "github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/service/dynamodb"
+ "github.com/aws/aws-sdk-go-v2/service/pricing"
+ "github.com/aws/aws-sdk-go-v2/service/pricing/types"
"github.com/aws/aws-sdk-go-v2/service/sts"
+ awsUtils "github.com/tailwarden/komiser/providers/aws/utils"
+ // "github.com/tailwarden/komiser/utils"
. "github.com/tailwarden/komiser/models"
. "github.com/tailwarden/komiser/providers"
)
+func int64PtrToFloat64(i *int64) float64 {
+ if i == nil {
+ return 0.0 // or any default value you prefer
+ }
+ return float64(*i)
+}
+
+
func Tables(ctx context.Context, client ProviderClient) ([]Resource, error) {
resources := make([]Resource, 0)
var config dynamodb.ListTablesInput
dynamodbClient := dynamodb.NewFromConfig(*client.AWSClient)
+ pricingClient := pricing.NewFromConfig(*client.AWSClient)
+
+ pricingOutput, err := pricingClient.GetProducts(ctx, &pricing.GetProductsInput{
+ ServiceCode: aws.String("AmazonDynamoDB"),
+ Filters: []types.Filter{
+ {
+ Field: aws.String("regionCode"),
+ Value: aws.String(client.AWSClient.Region),
+ Type: types.FilterTypeTermMatch,
+ },
+ },
+ })
+
+ if err != nil {
+ log.Errorf("ERROR: Couldn't fetch pricing info for AWS Lambda: %v", err)
+ return resources, err
+ }
+
+ priceMap, err := awsUtils.GetPriceMap(pricingOutput, "group")
+ if err != nil {
+ log.Errorf("ERROR: Failed to calculate cost per month: %v", err)
+ return resources, err
+ }
+
+
output, err := dynamodbClient.ListTables(ctx, &config)
if err != nil {
return resources, err
@@ -47,6 +85,28 @@ func Tables(ctx context.Context, client ProviderClient) ([]Resource, error) {
}
}
+ tableDetails, err := dynamodbClient.DescribeTable(ctx, &dynamodb.DescribeTableInput{
+ TableName: aws.String(table),
+ })
+
+ if err != nil {
+ return resources, err
+ }
+
+ var provisionedRCUs *int64
+ var provisionedWCUs *int64
+
+ if tableDetails != nil && tableDetails.Table != nil && tableDetails.Table.ProvisionedThroughput != nil {
+ provisionedRCUs = tableDetails.Table.ProvisionedThroughput.ReadCapacityUnits
+ provisionedWCUs = tableDetails.Table.ProvisionedThroughput.WriteCapacityUnits
+ }
+
+ log.Errorf("ERROR: Failed to calculate cost per month: %v", err)
+
+ RCUCharges := awsUtils.GetCost(priceMap["AWS-DynamoDB-ProvisionedReadCapacityUnits"], int64PtrToFloat64(provisionedRCUs))
+ PWUCharges := awsUtils.GetCost(priceMap["AWS-DynamoDB-ProvisionedWriteCapacityUnits"], int64PtrToFloat64(provisionedWCUs))
+ monthlyCost := RCUCharges + PWUCharges
+
resources = append(resources, Resource{
Provider: "AWS",
Account: client.Name,
@@ -54,7 +114,7 @@ func Tables(ctx context.Context, client ProviderClient) ([]Resource, error) {
ResourceId: resourceArn,
Region: client.AWSClient.Region,
Name: table,
- Cost: 0,
+ Cost: monthlyCost,
Tags: tags,
FetchedAt: time.Now(),
Link: fmt.Sprintf("https://%s.console.aws.amazon.com/dynamodbv2/home?region=%s#table?initialTagKey=&name=%s", client.AWSClient.Region, client.AWSClient.Region, table),
From 49eb3a7ab950c848d0d09f19aea76dabfc66e5bc Mon Sep 17 00:00:00 2001
From: ShubhamPalriwala
Date: Tue, 17 Oct 2023 17:58:29 +0530
Subject: [PATCH 088/113] fix: shift env id to environment file
---
dashboard/environments/environment.ts | 3 ++-
dashboard/pages/_app.tsx | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dashboard/environments/environment.ts b/dashboard/environments/environment.ts
index 1e6515876..5b3eb666e 100644
--- a/dashboard/environments/environment.ts
+++ b/dashboard/environments/environment.ts
@@ -5,7 +5,8 @@ const environment = {
: '',
GA_TRACKING_ID: 'G-9HF3HT6S6W',
SENTRY_URL:
- 'https://b4b98ad60a89468284cf8aa5d66cf2cd@o1267000.ingest.sentry.io/4504797672701952'
+ 'https://b4b98ad60a89468284cf8aa5d66cf2cd@o1267000.ingest.sentry.io/4504797672701952',
+ FORMBRICKS_ENV_ID: 'clnmmpeg01ci3o50fu5wy89zn'
};
export default environment;
diff --git a/dashboard/pages/_app.tsx b/dashboard/pages/_app.tsx
index 56a29b068..31306ed39 100644
--- a/dashboard/pages/_app.tsx
+++ b/dashboard/pages/_app.tsx
@@ -4,6 +4,7 @@ import formbricks from '@formbricks/js';
import { useRouter } from 'next/router';
import { useEffect } from 'react';
import Layout from '../components/layout/Layout';
+import environment from '../environments/environment';
const printHiringMessage = () => {
// eslint-disable-next-line no-console
@@ -26,7 +27,7 @@ const printHiringMessage = () => {
if (typeof window !== 'undefined') {
printHiringMessage();
formbricks.init({
- environmentId: 'clnmmpeg01ci3o50fu5wy89zn',
+ environmentId: environment.FORMBRICKS_ENV_ID,
apiHost: 'https://app.formbricks.com',
debug: false // remove when in production
});
From 2fadb5c9bcde98130d7a034e4d1232226718890c Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 17 Oct 2023 12:37:32 +0000
Subject: [PATCH 089/113] chore(deps-dev): bump @types/cytoscape-popper in
/dashboard
Bumps [@types/cytoscape-popper](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/cytoscape-popper) from 2.0.1 to 2.0.2.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/cytoscape-popper)
---
updated-dependencies:
- dependency-name: "@types/cytoscape-popper"
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
dashboard/package-lock.json | 8 ++++----
dashboard/package.json | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dashboard/package-lock.json b/dashboard/package-lock.json
index f482cbdce..cff92fac1 100644
--- a/dashboard/package-lock.json
+++ b/dashboard/package-lock.json
@@ -46,7 +46,7 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@types/cytoscape": "^3.19.11",
- "@types/cytoscape-popper": "^2.0.1",
+ "@types/cytoscape-popper": "^2.0.2",
"@types/jest": "^29.4.0",
"@types/node": "20.7.0",
"@types/react": "18.2.22",
@@ -9233,9 +9233,9 @@
"devOptional": true
},
"node_modules/@types/cytoscape-popper": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/@types/cytoscape-popper/-/cytoscape-popper-2.0.1.tgz",
- "integrity": "sha512-WHm20xrcy1qahcSbjc+DDYJHzIOyxBNrMo6jN2naHT/OgQZt4/Rw6vcC7hNaX0/RUVxuJc3+GRfdGOIVSZ6XiQ==",
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/@types/cytoscape-popper/-/cytoscape-popper-2.0.2.tgz",
+ "integrity": "sha512-iRa+XgJu5jBayPx3+fvlQXp6Fx25zDOBPYDGyKUJrcw2b7pIDMShHlh+G9g/BdwpfZYFMgiAoP6fYq0TEXmEKw==",
"dev": true,
"dependencies": {
"@popperjs/core": "^2.0.0",
diff --git a/dashboard/package.json b/dashboard/package.json
index 2a6d688bf..ae755643d 100644
--- a/dashboard/package.json
+++ b/dashboard/package.json
@@ -53,7 +53,7 @@
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@types/cytoscape": "^3.19.11",
- "@types/cytoscape-popper": "^2.0.1",
+ "@types/cytoscape-popper": "^2.0.2",
"@types/jest": "^29.4.0",
"@types/node": "20.7.0",
"@types/react": "18.2.22",
From 4e88c97b496428031ed6f4e595e208372e02cee7 Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Tue, 17 Oct 2023 12:37:35 +0000
Subject: [PATCH 090/113] chore(deps-dev): bump eslint-plugin-jest in
/dashboard
Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 27.4.0 to 27.4.2.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v27.4.0...v27.4.2)
---
updated-dependencies:
- dependency-name: eslint-plugin-jest
dependency-type: direct:development
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot]
---
dashboard/package-lock.json | 8 ++++----
dashboard/package.json | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dashboard/package-lock.json b/dashboard/package-lock.json
index f482cbdce..07608422d 100644
--- a/dashboard/package-lock.json
+++ b/dashboard/package-lock.json
@@ -58,7 +58,7 @@
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-next": "13.5.4",
"eslint-config-prettier": "^9.0.0",
- "eslint-plugin-jest": "^27.4.0",
+ "eslint-plugin-jest": "^27.4.2",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-storybook": "^0.6.15",
"husky": "^8.0.0",
@@ -13997,9 +13997,9 @@
}
},
"node_modules/eslint-plugin-jest": {
- "version": "27.4.0",
- "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.4.0.tgz",
- "integrity": "sha512-ukVeKmMPAUA5SWjHenvyyXnirKfHKMdOsTZdn5tZx5EW05HGVQwBohigjFZGGj3zuv1cV6hc82FvWv6LdIbkgg==",
+ "version": "27.4.2",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-27.4.2.tgz",
+ "integrity": "sha512-3Nfvv3wbq2+PZlRTf2oaAWXWwbdBejFRBR2O8tAO67o+P8zno+QGbcDYaAXODlreXVg+9gvWhKKmG2rgfb8GEg==",
"dev": true,
"dependencies": {
"@typescript-eslint/utils": "^5.10.0"
diff --git a/dashboard/package.json b/dashboard/package.json
index 2a6d688bf..e9a4cc5bc 100644
--- a/dashboard/package.json
+++ b/dashboard/package.json
@@ -65,7 +65,7 @@
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-next": "13.5.4",
"eslint-config-prettier": "^9.0.0",
- "eslint-plugin-jest": "^27.4.0",
+ "eslint-plugin-jest": "^27.4.2",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-storybook": "^0.6.15",
"husky": "^8.0.0",
From 9c70b10fbba3a327b589e853f13bbc24323f6d90 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexander=20R=C3=B6sel?=
<320272+Traxmaxx@users.noreply.github.com>
Date: Tue, 17 Oct 2023 17:55:58 +0200
Subject: [PATCH 091/113] chore: cleanup and add util test
---
providers/aws/dynamodb/tables.go | 8 +++++---
providers/aws/dynamodb/tables_test.go | 23 +++++++++++++++++++++++
2 files changed, 28 insertions(+), 3 deletions(-)
create mode 100644 providers/aws/dynamodb/tables_test.go
diff --git a/providers/aws/dynamodb/tables.go b/providers/aws/dynamodb/tables.go
index 14e719fc0..a0dc89cf7 100644
--- a/providers/aws/dynamodb/tables.go
+++ b/providers/aws/dynamodb/tables.go
@@ -13,7 +13,6 @@ import (
"github.com/aws/aws-sdk-go-v2/service/pricing/types"
"github.com/aws/aws-sdk-go-v2/service/sts"
awsUtils "github.com/tailwarden/komiser/providers/aws/utils"
- // "github.com/tailwarden/komiser/utils"
. "github.com/tailwarden/komiser/models"
. "github.com/tailwarden/komiser/providers"
)
@@ -90,6 +89,7 @@ func Tables(ctx context.Context, client ProviderClient) ([]Resource, error) {
})
if err != nil {
+ log.Errorf("ERROR: Failed to query DynamoDB table details: %v", err)
return resources, err
}
@@ -99,12 +99,14 @@ func Tables(ctx context.Context, client ProviderClient) ([]Resource, error) {
if tableDetails != nil && tableDetails.Table != nil && tableDetails.Table.ProvisionedThroughput != nil {
provisionedRCUs = tableDetails.Table.ProvisionedThroughput.ReadCapacityUnits
provisionedWCUs = tableDetails.Table.ProvisionedThroughput.WriteCapacityUnits
+ } else {
+ log.Errorf("ERROR: Failed to calculate cost per month: %v", err)
+ return resources, err
}
- log.Errorf("ERROR: Failed to calculate cost per month: %v", err)
-
RCUCharges := awsUtils.GetCost(priceMap["AWS-DynamoDB-ProvisionedReadCapacityUnits"], int64PtrToFloat64(provisionedRCUs))
PWUCharges := awsUtils.GetCost(priceMap["AWS-DynamoDB-ProvisionedWriteCapacityUnits"], int64PtrToFloat64(provisionedWCUs))
+
monthlyCost := RCUCharges + PWUCharges
resources = append(resources, Resource{
diff --git a/providers/aws/dynamodb/tables_test.go b/providers/aws/dynamodb/tables_test.go
new file mode 100644
index 000000000..79faa5a0f
--- /dev/null
+++ b/providers/aws/dynamodb/tables_test.go
@@ -0,0 +1,23 @@
+package dynamodb
+
+import ("testing")
+
+func Testint64PtrToFloat64_ValidInput(t *testing.T) {
+ var number int64 = 1
+ pointer := &number
+
+ returnValue := int64PtrToFloat64(pointer)
+ var expected float64 = 0.0
+ if returnValue != expected {
+ t.Errorf("Expected return value: %f, but got: %f", expected, returnValue)
+ }
+}
+
+func Testint64PtrToFloat64_InvalidInput(t *testing.T) {
+ // nil input
+ returnValue := int64PtrToFloat64(nil)
+ var expected float64 = 3.0
+ if returnValue != expected {
+ t.Errorf("Expected return value: %f, but got: %f", expected, returnValue)
+ }
+}
From 4d876d60187fc2ee6f5e1de17300e7a8ec739c21 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexander=20R=C3=B6sel?=
<320272+Traxmaxx@users.noreply.github.com>
Date: Tue, 17 Oct 2023 18:44:18 +0200
Subject: [PATCH 092/113] fix: address linter errors
---
providers/aws/dynamodb/tables.go | 7 ++++---
providers/aws/dynamodb/tables_test.go | 8 ++++----
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/providers/aws/dynamodb/tables.go b/providers/aws/dynamodb/tables.go
index a0dc89cf7..9340dcb17 100644
--- a/providers/aws/dynamodb/tables.go
+++ b/providers/aws/dynamodb/tables.go
@@ -17,7 +17,7 @@ import (
. "github.com/tailwarden/komiser/providers"
)
-func int64PtrToFloat64(i *int64) float64 {
+func Int64PtrToFloat64(i *int64) float64 {
if i == nil {
return 0.0 // or any default value you prefer
}
@@ -55,6 +55,7 @@ func Tables(ctx context.Context, client ProviderClient) ([]Resource, error) {
output, err := dynamodbClient.ListTables(ctx, &config)
+
if err != nil {
return resources, err
}
@@ -104,8 +105,8 @@ func Tables(ctx context.Context, client ProviderClient) ([]Resource, error) {
return resources, err
}
- RCUCharges := awsUtils.GetCost(priceMap["AWS-DynamoDB-ProvisionedReadCapacityUnits"], int64PtrToFloat64(provisionedRCUs))
- PWUCharges := awsUtils.GetCost(priceMap["AWS-DynamoDB-ProvisionedWriteCapacityUnits"], int64PtrToFloat64(provisionedWCUs))
+ RCUCharges := awsUtils.GetCost(priceMap["AWS-DynamoDB-ProvisionedReadCapacityUnits"], Int64PtrToFloat64(provisionedRCUs))
+ PWUCharges := awsUtils.GetCost(priceMap["AWS-DynamoDB-ProvisionedWriteCapacityUnits"], Int64PtrToFloat64(provisionedWCUs))
monthlyCost := RCUCharges + PWUCharges
diff --git a/providers/aws/dynamodb/tables_test.go b/providers/aws/dynamodb/tables_test.go
index 79faa5a0f..d543f8271 100644
--- a/providers/aws/dynamodb/tables_test.go
+++ b/providers/aws/dynamodb/tables_test.go
@@ -2,20 +2,20 @@ package dynamodb
import ("testing")
-func Testint64PtrToFloat64_ValidInput(t *testing.T) {
+func TestInt64PtrToFloat64_ValidInput(t *testing.T) {
var number int64 = 1
pointer := &number
- returnValue := int64PtrToFloat64(pointer)
+ returnValue := Int64PtrToFloat64(pointer)
var expected float64 = 0.0
if returnValue != expected {
t.Errorf("Expected return value: %f, but got: %f", expected, returnValue)
}
}
-func Testint64PtrToFloat64_InvalidInput(t *testing.T) {
+func TestInt64PtrToFloat64_InvalidInput(t *testing.T) {
// nil input
- returnValue := int64PtrToFloat64(nil)
+ returnValue := Int64PtrToFloat64(nil)
var expected float64 = 3.0
if returnValue != expected {
t.Errorf("Expected return value: %f, but got: %f", expected, returnValue)
From 454aa9fa5675d280f00176d67e32141e0330331a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexander=20R=C3=B6sel?=
<320272+Traxmaxx@users.noreply.github.com>
Date: Tue, 17 Oct 2023 20:31:12 +0200
Subject: [PATCH 093/113] fix: set correct expect values
---
providers/aws/dynamodb/tables_test.go | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/providers/aws/dynamodb/tables_test.go b/providers/aws/dynamodb/tables_test.go
index d543f8271..953545a76 100644
--- a/providers/aws/dynamodb/tables_test.go
+++ b/providers/aws/dynamodb/tables_test.go
@@ -7,16 +7,16 @@ func TestInt64PtrToFloat64_ValidInput(t *testing.T) {
pointer := &number
returnValue := Int64PtrToFloat64(pointer)
- var expected float64 = 0.0
+ var expected float64 = 1.0
if returnValue != expected {
t.Errorf("Expected return value: %f, but got: %f", expected, returnValue)
}
}
-func TestInt64PtrToFloat64_InvalidInput(t *testing.T) {
+func TestInt64PtrToFloat64_NilInput(t *testing.T) {
// nil input
returnValue := Int64PtrToFloat64(nil)
- var expected float64 = 3.0
+ var expected float64 = 0.0
if returnValue != expected {
t.Errorf("Expected return value: %f, but got: %f", expected, returnValue)
}
From cbe7a7950de5e3811da7cd03dc5d2e8fdd3468bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Alexander=20R=C3=B6sel?=
<320272+Traxmaxx@users.noreply.github.com>
Date: Tue, 17 Oct 2023 20:36:19 +0200
Subject: [PATCH 094/113] fix: fix log
---
providers/aws/dynamodb/tables.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/providers/aws/dynamodb/tables.go b/providers/aws/dynamodb/tables.go
index 9340dcb17..37c5a4ea5 100644
--- a/providers/aws/dynamodb/tables.go
+++ b/providers/aws/dynamodb/tables.go
@@ -43,7 +43,7 @@ func Tables(ctx context.Context, client ProviderClient) ([]Resource, error) {
})
if err != nil {
- log.Errorf("ERROR: Couldn't fetch pricing info for AWS Lambda: %v", err)
+ log.Errorf("ERROR: Couldn't fetch pricing info for AWS DynamoDB: %v", err)
return resources, err
}
From 1dfb814ff34eefa3f9659fa9e15888eef50d51fd Mon Sep 17 00:00:00 2001
From: Saba Shavidze
Date: Wed, 18 Oct 2023 11:51:25 +0400
Subject: [PATCH 095/113] refactor: changed toast to have centrilized state
management ans singleton approach
---
.../feedback-widget/FeedbackWidget.tsx | 2 +-
.../hooks/useInventory/useInventory.tsx | 2 +-
dashboard/components/layout/Layout.tsx | 143 +++++++++---------
.../onboarding-wizard/ProviderContent.tsx | 2 +-
dashboard/components/toast/Toast.tsx | 3 +-
dashboard/components/toast/ToastProvider.tsx | 56 +++++++
dashboard/components/toast/hooks/useToast.tsx | 30 ----
dashboard/pages/cloud-accounts.tsx | 3 +-
.../pages/onboarding/cloud-accounts/index.tsx | 3 +-
.../pages/onboarding/database/postgres.tsx | 3 +-
.../pages/onboarding/database/sqlite.tsx | 3 +-
11 files changed, 142 insertions(+), 108 deletions(-)
create mode 100644 dashboard/components/toast/ToastProvider.tsx
delete mode 100644 dashboard/components/toast/hooks/useToast.tsx
diff --git a/dashboard/components/feedback-widget/FeedbackWidget.tsx b/dashboard/components/feedback-widget/FeedbackWidget.tsx
index 51bf836d4..c36db5543 100644
--- a/dashboard/components/feedback-widget/FeedbackWidget.tsx
+++ b/dashboard/components/feedback-widget/FeedbackWidget.tsx
@@ -8,8 +8,8 @@ import Modal from '@components/modal/Modal';
import Input from '@components/input/Input';
import settingsService from '@services/settingsService';
import Button from '@components/button/Button';
-import useToast from '@components/toast/hooks/useToast';
import Toast from '@components/toast/Toast';
+import { useToast } from '@components/toast/ToastProvider';
// We define the placeholder here for convenience
// It's difficult to read when passed inline
diff --git a/dashboard/components/inventory/hooks/useInventory/useInventory.tsx b/dashboard/components/inventory/hooks/useInventory/useInventory.tsx
index 37960eff8..2f2e12cd7 100644
--- a/dashboard/components/inventory/hooks/useInventory/useInventory.tsx
+++ b/dashboard/components/inventory/hooks/useInventory/useInventory.tsx
@@ -1,7 +1,7 @@
+import { useToast } from '@components/toast/ToastProvider';
import { useRouter } from 'next/router';
import { ChangeEvent, useEffect, useRef, useState } from 'react';
import settingsService from '../../../../services/settingsService';
-import useToast from '../../../toast/hooks/useToast';
import useIsVisible from '../useIsVisible/useIsVisible';
import getCustomViewInventoryListAndStats from './helpers/getCustomViewInventoryListAndStats';
import getInventoryListAndStats from './helpers/getInventoryListAndStats';
diff --git a/dashboard/components/layout/Layout.tsx b/dashboard/components/layout/Layout.tsx
index b2b8f08b4..0ca6e3c3e 100644
--- a/dashboard/components/layout/Layout.tsx
+++ b/dashboard/components/layout/Layout.tsx
@@ -4,6 +4,7 @@ import { BrowserTracing } from '@sentry/tracing';
import { useRouter } from 'next/router';
import { ReactNode, useEffect } from 'react';
import settingsService from '@services/settingsService';
+import { ToastProvider } from '@components/toast/ToastProvider';
import environment from '../../environments/environment';
import Banner from '../banner/Banner';
import useGithubStarBanner from '../banner/hooks/useGithubStarBanner';
@@ -72,80 +73,82 @@ function Layout({ children }: LayoutProps) {
betaFlagOnboardingWizard
}}
>
- {isOnboarding && <>{children}>}
+
+ {isOnboarding && <>{children}>}
- {!isOnboarding && (
- <>
-
-
-
- {canRender && children}
+ {!isOnboarding && (
+ <>
+
+
+
+ {canRender && children}
- {hasNoAccounts && betaFlagOnboardingWizard && !isOnboarding && (
- {
- router.push('/onboarding/choose-cloud');
- }}
- actionLabel="Begin Onboarding"
- secondaryAction={() => {
- router.push(
- 'https://github.com/tailwarden/komiser/issues/new/choose'
- );
- }}
- secondaryActionLabel="Report an issue"
- mascotPose="greetings"
- />
- )}
+ {hasNoAccounts && betaFlagOnboardingWizard && !isOnboarding && (
+ {
+ router.push('/onboarding/choose-cloud');
+ }}
+ actionLabel="Begin Onboarding"
+ secondaryAction={() => {
+ router.push(
+ 'https://github.com/tailwarden/komiser/issues/new/choose'
+ );
+ }}
+ secondaryActionLabel="Report an issue"
+ mascotPose="greetings"
+ />
+ )}
- {/* This block would be removed when onboarding Wizard is stable leaving the block above */}
- {hasNoAccounts && !betaFlagOnboardingWizard && (
- {
- router.push(
- 'https://docs.komiser.io/docs/introduction/getting-started?utm_source=komiser&utm_medium=referral&utm_campaign=static'
- );
- }}
- actionLabel="Guide to connect account"
- secondaryAction={() => {
- router.push(
- 'https://github.com/tailwarden/komiser/issues/new/choose'
- );
- }}
- secondaryActionLabel="Report an issue"
- mascotPose="thinking"
- />
- )}
- {/* This block would be removed when onboarding Wizard is stable leaving the block above */}
+ {/* This block would be removed when onboarding Wizard is stable leaving the block above */}
+ {hasNoAccounts && !betaFlagOnboardingWizard && (
+ {
+ router.push(
+ 'https://docs.komiser.io/docs/introduction/getting-started?utm_source=komiser&utm_medium=referral&utm_campaign=static'
+ );
+ }}
+ actionLabel="Guide to connect account"
+ secondaryAction={() => {
+ router.push(
+ 'https://github.com/tailwarden/komiser/issues/new/choose'
+ );
+ }}
+ secondaryActionLabel="Report an issue"
+ mascotPose="thinking"
+ />
+ )}
+ {/* This block would be removed when onboarding Wizard is stable leaving the block above */}
- {error && (
- router.reload()}
- >
- Refresh the page
-
- }
- />
- )}
-
- >
- )}
+ {error && (
+ router.reload()}
+ >
+ Refresh the page
+
+ }
+ />
+ )}
+
+ >
+ )}
+
);
}
diff --git a/dashboard/components/onboarding-wizard/ProviderContent.tsx b/dashboard/components/onboarding-wizard/ProviderContent.tsx
index f1d959b96..7c3dbf2ca 100644
--- a/dashboard/components/onboarding-wizard/ProviderContent.tsx
+++ b/dashboard/components/onboarding-wizard/ProviderContent.tsx
@@ -10,9 +10,9 @@ import OnboardingWizardLayout, {
import PurplinCloud from '@components/onboarding-wizard/PurplinCloud';
import CredentialsButton from '@components/onboarding-wizard/CredentialsButton';
import Toast from '@components/toast/Toast';
-import useToast from '@components/toast/hooks/useToast';
import { Provider } from '@utils/providerHelper';
import { CloudAccountPayload } from '@components/cloud-account/hooks/useCloudAccounts/useCloudAccount';
+import { useToast } from '@components/toast/ToastProvider';
interface ChildProps {
cloudAccountData?: CloudAccountPayload;
diff --git a/dashboard/components/toast/Toast.tsx b/dashboard/components/toast/Toast.tsx
index 6afe259f5..4d4207bb5 100644
--- a/dashboard/components/toast/Toast.tsx
+++ b/dashboard/components/toast/Toast.tsx
@@ -1,8 +1,9 @@
import classNames from 'classnames';
import Button from '../button/Button';
-import { ToastProps } from './hooks/useToast';
+
import ErrorIcon from '../icons/ErrorIcon';
import CheckIcon from '../icons/CheckIcon';
+import { ToastProps } from './ToastProvider';
type ToastProp = ToastProps & {
dismissToast: () => void;
diff --git a/dashboard/components/toast/ToastProvider.tsx b/dashboard/components/toast/ToastProvider.tsx
new file mode 100644
index 000000000..0a2188519
--- /dev/null
+++ b/dashboard/components/toast/ToastProvider.tsx
@@ -0,0 +1,56 @@
+import React, {
+ createContext,
+ useContext,
+ useState,
+ useEffect,
+ FC,
+ ReactNode,
+ Dispatch,
+ SetStateAction
+} from 'react';
+
+export type ToastProps = {
+ hasError: boolean;
+ title: string;
+ message: string;
+};
+
+type ToastContextType = {
+ setToast: Dispatch>;
+ dismissToast: () => void;
+ toast: ToastProps | null;
+};
+
+const ToastContext = createContext(undefined);
+
+export const ToastProvider: FC<{ children: ReactNode }> = ({ children }) => {
+ const [toast, setToast] = useState(null);
+
+ const dismissToast = () => {
+ setToast(null);
+ };
+
+ useEffect(() => {
+ let timeout: any;
+ if (toast) {
+ timeout = setTimeout(dismissToast, 5000);
+ }
+ return () => clearTimeout(timeout);
+ }, [toast]);
+
+ return (
+
+ {children}
+
+ );
+};
+
+export const useToast = () => {
+ const context = useContext(ToastContext);
+
+ if (context === undefined) {
+ throw new Error('useToast must be used within a ToastProvider');
+ }
+
+ return context;
+};
diff --git a/dashboard/components/toast/hooks/useToast.tsx b/dashboard/components/toast/hooks/useToast.tsx
deleted file mode 100644
index 35f828355..000000000
--- a/dashboard/components/toast/hooks/useToast.tsx
+++ /dev/null
@@ -1,30 +0,0 @@
-import { useEffect, useState } from 'react';
-
-export type ToastProps = {
- hasError: boolean;
- title: string;
- message: string;
-};
-
-function useToast() {
- const [toast, setToast] = useState(undefined);
-
- function dismissToast() {
- setToast(undefined);
- }
-
- useEffect(() => {
- const timeout = setTimeout(dismissToast, 5000);
- return () => {
- clearTimeout(timeout);
- };
- }, [toast]);
-
- return {
- toast,
- setToast,
- dismissToast
- };
-}
-
-export default useToast;
diff --git a/dashboard/pages/cloud-accounts.tsx b/dashboard/pages/cloud-accounts.tsx
index 8e94c263c..e5e771310 100644
--- a/dashboard/pages/cloud-accounts.tsx
+++ b/dashboard/pages/cloud-accounts.tsx
@@ -11,7 +11,8 @@ import CloudAccountsLayout from '@components/cloud-account/components/CloudAccou
import useCloudAccount from '@components/cloud-account/hooks/useCloudAccounts/useCloudAccount';
import CloudAccountsSidePanel from '@components/cloud-account/components/CloudAccountsSidePanel';
import CloudAccountDeleteContents from '@components/cloud-account/components/CloudAccountDeleteContents';
-import useToast from '@components/toast/hooks/useToast';
+import { useToast } from '@components/toast/ToastProvider';
+
import EmptyState from '@components/empty-state/EmptyState';
function CloudAccounts() {
diff --git a/dashboard/pages/onboarding/cloud-accounts/index.tsx b/dashboard/pages/onboarding/cloud-accounts/index.tsx
index 3959713e2..b8bad619e 100644
--- a/dashboard/pages/onboarding/cloud-accounts/index.tsx
+++ b/dashboard/pages/onboarding/cloud-accounts/index.tsx
@@ -13,9 +13,10 @@ import DeleteIcon from '@components/icons/DeleteIcon';
import Modal from '@components/modal/Modal';
import CloudAccountDeleteContents from '@components/cloud-account/components/CloudAccountDeleteContents';
import Toast from '@components/toast/Toast';
-import useToast from '@components/toast/hooks/useToast';
+
import useCloudAccount from '@components/cloud-account/hooks/useCloudAccounts/useCloudAccount';
import Button from '@components/button/Button';
+import { useToast } from '@components/toast/ToastProvider';
export default function CloudAccounts() {
const [isDeleteModalOpen, setIsDeleteModalOpen] = useState(false);
diff --git a/dashboard/pages/onboarding/database/postgres.tsx b/dashboard/pages/onboarding/database/postgres.tsx
index ce7c342d0..54d453ee5 100644
--- a/dashboard/pages/onboarding/database/postgres.tsx
+++ b/dashboard/pages/onboarding/database/postgres.tsx
@@ -12,9 +12,10 @@ import LabelledInput from '@components/onboarding-wizard/LabelledInput';
import DatabasePurplin from '@components/onboarding-wizard/DatabasePurplin';
import CredentialsButton from '@components/onboarding-wizard/CredentialsButton';
import settingsService from '@services/settingsService';
-import useToast from '@components/toast/hooks/useToast';
+
import Toast from '@components/toast/Toast';
import DatabaseErrorMessage from '@components/onboarding-wizard/DatabaseErrorMessage';
+import { useToast } from '@components/toast/ToastProvider';
export default function PostgreSQLCredentials() {
const databaseProvider = allDBProviders.POSTGRES;
diff --git a/dashboard/pages/onboarding/database/sqlite.tsx b/dashboard/pages/onboarding/database/sqlite.tsx
index 5cdbb9b3f..ea013f2ee 100644
--- a/dashboard/pages/onboarding/database/sqlite.tsx
+++ b/dashboard/pages/onboarding/database/sqlite.tsx
@@ -13,9 +13,10 @@ import DatabasePurplin from '@components/onboarding-wizard/DatabasePurplin';
import InputFileSelect from '@components/onboarding-wizard/InputFileSelect';
import CredentialsButton from '@components/onboarding-wizard/CredentialsButton';
import settingsService from '@services/settingsService';
-import useToast from '@components/toast/hooks/useToast';
+
import Toast from '@components/toast/Toast';
import DatabaseErrorMessage from '@components/onboarding-wizard/DatabaseErrorMessage';
+import { useToast } from '@components/toast/ToastProvider';
export default function SqliteCredentials() {
const database = allDBProviders.SQLITE;
From 2f528045c0e544107b13025b3006d5816153ce31 Mon Sep 17 00:00:00 2001
From: Saba Shavidze
Date: Wed, 18 Oct 2023 12:03:54 +0400
Subject: [PATCH 096/113] refactor: updated imports for ToastProps
---
.../cloud-account/components/CloudAccountDeleteContents.tsx | 2 +-
.../cloud-account/components/CloudAccountsSidePanel.tsx | 2 +-
dashboard/components/export-csv/ExportCSV.tsx | 2 +-
.../components/inventory/components/InventorySearchBar.tsx | 2 +-
dashboard/components/inventory/components/InventoryTable.tsx | 2 +-
.../inventory/components/filter/InventoryFilterValue.tsx | 2 +-
.../components/inventory/components/view/InventoryView.tsx | 2 +-
.../inventory/components/view/InventoryViewHeader.tsx | 2 +-
.../inventory/components/view/alerts/InventoryViewAlerts.tsx | 2 +-
.../components/view/alerts/InventoryViewAlertsDeleteAlert.tsx | 2 +-
.../components/view/alerts/InventoryViewAlertsEditAlert.tsx | 2 +-
.../inventory/components/view/alerts/hooks/useEditAlerts.tsx | 2 +-
.../components/inventory/components/view/hooks/useViews.tsx | 2 +-
.../useInventory/helpers/getCustomViewInventoryListAndStats.ts | 2 +-
.../hooks/useInventory/helpers/getInventoryListFromAFilter.ts | 2 +-
.../hooks/useInventory/helpers/infiniteScrollCustomViewList.ts | 2 +-
.../hooks/useInventory/helpers/infiniteScrollFilteredList.ts | 2 +-
.../hooks/useInventory/helpers/infiniteScrollInventoryList.ts | 2 +-
.../helpers/infiniteScrollSearchedAndFilteredList.ts | 2 +-
.../helpers/infiniteScrollSearchedCustomViewList.ts | 2 +-
.../hooks/useInventory/helpers/infiniteScrollSearchedList.ts | 2 +-
21 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/dashboard/components/cloud-account/components/CloudAccountDeleteContents.tsx b/dashboard/components/cloud-account/components/CloudAccountDeleteContents.tsx
index 69398b196..f90639782 100644
--- a/dashboard/components/cloud-account/components/CloudAccountDeleteContents.tsx
+++ b/dashboard/components/cloud-account/components/CloudAccountDeleteContents.tsx
@@ -1,9 +1,9 @@
import { useState } from 'react';
+import { ToastProps } from '@components/toast/ToastProvider';
import AlertCircleIcon from '../../icons/AlertCircleIcon';
import Button from '../../button/Button';
import { CloudAccount } from '../hooks/useCloudAccounts/useCloudAccount';
import settingsService from '../../../services/settingsService';
-import { ToastProps } from '../../toast/hooks/useToast';
interface CloudAccountDeleteContentsProps {
cloudAccount: CloudAccount;
diff --git a/dashboard/components/cloud-account/components/CloudAccountsSidePanel.tsx b/dashboard/components/cloud-account/components/CloudAccountsSidePanel.tsx
index a9dcb1d6e..21d0e1104 100644
--- a/dashboard/components/cloud-account/components/CloudAccountsSidePanel.tsx
+++ b/dashboard/components/cloud-account/components/CloudAccountsSidePanel.tsx
@@ -10,6 +10,7 @@ import MongoDbAtlasAccountDetails from '@components/account-details/MongoDBAtlas
import OciAccountDetails from '@components/account-details/OciAccountDetails';
import ScalewayAccountDetails from '@components/account-details/ScalewayAccountDetails';
import { getPayloadFromForm } from '@utils/cloudAccountHelpers';
+import { ToastProps } from '@components/toast/ToastProvider';
import providers, {
allProviders,
Provider
@@ -24,7 +25,6 @@ import {
CloudAccount,
CloudAccountsPage
} from '../hooks/useCloudAccounts/useCloudAccount';
-import { ToastProps } from '../../toast/hooks/useToast';
import settingsService from '../../../services/settingsService';
interface CloudAccountsSidePanelProps {
diff --git a/dashboard/components/export-csv/ExportCSV.tsx b/dashboard/components/export-csv/ExportCSV.tsx
index fd17946c8..835cdbdaf 100644
--- a/dashboard/components/export-csv/ExportCSV.tsx
+++ b/dashboard/components/export-csv/ExportCSV.tsx
@@ -1,6 +1,6 @@
+import { ToastProps } from '@components/toast/ToastProvider';
import { useRouter } from 'next/router';
import settingsService from '../../services/settingsService';
-import { ToastProps } from '../toast/hooks/useToast';
import ExportCSVButton from './ExportCSVButton';
type ExportCSVProps = {
diff --git a/dashboard/components/inventory/components/InventorySearchBar.tsx b/dashboard/components/inventory/components/InventorySearchBar.tsx
index 2631e9d7d..13fd5b09d 100644
--- a/dashboard/components/inventory/components/InventorySearchBar.tsx
+++ b/dashboard/components/inventory/components/InventorySearchBar.tsx
@@ -1,7 +1,7 @@
+import { ToastProps } from '@components/toast/ToastProvider';
import ExportCSV from '../../export-csv/ExportCSV';
import CloseIcon from '../../icons/CloseIcon';
import SearchIcon from '../../icons/SearchIcon';
-import { ToastProps } from '../../toast/hooks/useToast';
type InventorySearchBarProps = {
query: string;
diff --git a/dashboard/components/inventory/components/InventoryTable.tsx b/dashboard/components/inventory/components/InventoryTable.tsx
index eb226295c..d25712411 100644
--- a/dashboard/components/inventory/components/InventoryTable.tsx
+++ b/dashboard/components/inventory/components/InventoryTable.tsx
@@ -1,10 +1,10 @@
+import { ToastProps } from '@components/toast/ToastProvider';
import { NextRouter } from 'next/router';
import { ChangeEvent } from 'react';
import formatNumber from '../../../utils/formatNumber';
import providers from '../../../utils/providerHelper';
import Checkbox from '../../checkbox/Checkbox';
import SkeletonInventory from '../../skeleton/SkeletonInventory';
-import { ToastProps } from '../../toast/hooks/useToast';
import {
InventoryItem,
InventoryStats
diff --git a/dashboard/components/inventory/components/filter/InventoryFilterValue.tsx b/dashboard/components/inventory/components/filter/InventoryFilterValue.tsx
index 0ed019754..e1acbc860 100644
--- a/dashboard/components/inventory/components/filter/InventoryFilterValue.tsx
+++ b/dashboard/components/inventory/components/filter/InventoryFilterValue.tsx
@@ -1,8 +1,8 @@
+import { ToastProps } from '@components/toast/ToastProvider';
import { ChangeEvent, useEffect, useState } from 'react';
import settingsService from '../../../../services/settingsService';
import Checkbox from '../../../checkbox/Checkbox';
import Input from '../../../input/Input';
-import { ToastProps } from '../../../toast/hooks/useToast';
import { InventoryFilterData } from '../../hooks/useInventory/types/useInventoryTypes';
import { CostBetween } from './hooks/useFilterWizard';
diff --git a/dashboard/components/inventory/components/view/InventoryView.tsx b/dashboard/components/inventory/components/view/InventoryView.tsx
index 1cc5f0ed7..8f692e3ec 100644
--- a/dashboard/components/inventory/components/view/InventoryView.tsx
+++ b/dashboard/components/inventory/components/view/InventoryView.tsx
@@ -1,5 +1,6 @@
import Image from 'next/image';
import { NextRouter } from 'next/router';
+import { ToastProps } from '@components/toast/ToastProvider';
import formatNumber from '../../../../utils/formatNumber';
import providers, { Provider } from '../../../../utils/providerHelper';
import Button from '../../../button/Button';
@@ -10,7 +11,6 @@ import Sidepanel from '../../../sidepanel/Sidepanel';
import SidepanelHeader from '../../../sidepanel/SidepanelHeader';
import SidepanelPage from '../../../sidepanel/SidepanelPage';
import SidepanelTabs from '../../../sidepanel/SidepanelTabs';
-import { ToastProps } from '../../../toast/hooks/useToast';
import {
HiddenResource,
InventoryFilterData,
diff --git a/dashboard/components/inventory/components/view/InventoryViewHeader.tsx b/dashboard/components/inventory/components/view/InventoryViewHeader.tsx
index b51e18cdb..b0487caa8 100644
--- a/dashboard/components/inventory/components/view/InventoryViewHeader.tsx
+++ b/dashboard/components/inventory/components/view/InventoryViewHeader.tsx
@@ -1,3 +1,4 @@
+import { ToastProps } from '@components/toast/ToastProvider';
import { NextRouter } from 'next/router';
import { FormEvent, useState } from 'react';
import Button from '../../../button/Button';
@@ -10,7 +11,6 @@ import EditIcon from '../../../icons/EditIcon';
import LinkIcon from '../../../icons/LinkIcon';
import WarningIcon from '../../../icons/WarningIcon';
import Modal from '../../../modal/Modal';
-import { ToastProps } from '../../../toast/hooks/useToast';
import {
InventoryFilterData,
View
diff --git a/dashboard/components/inventory/components/view/alerts/InventoryViewAlerts.tsx b/dashboard/components/inventory/components/view/alerts/InventoryViewAlerts.tsx
index 8042fec6c..dbb3327f8 100644
--- a/dashboard/components/inventory/components/view/alerts/InventoryViewAlerts.tsx
+++ b/dashboard/components/inventory/components/view/alerts/InventoryViewAlerts.tsx
@@ -1,4 +1,4 @@
-import { ToastProps } from '../../../../toast/hooks/useToast';
+import { ToastProps } from '@components/toast/ToastProvider';
import useAlerts from './hooks/useAlerts';
import InventoryViewAlertsDeleteAlert from './InventoryViewAlertsDeleteAlert';
import InventoryViewAlertDisplayAlerts from './InventoryViewAlertsDisplay';
diff --git a/dashboard/components/inventory/components/view/alerts/InventoryViewAlertsDeleteAlert.tsx b/dashboard/components/inventory/components/view/alerts/InventoryViewAlertsDeleteAlert.tsx
index db792db22..67f814da3 100644
--- a/dashboard/components/inventory/components/view/alerts/InventoryViewAlertsDeleteAlert.tsx
+++ b/dashboard/components/inventory/components/view/alerts/InventoryViewAlertsDeleteAlert.tsx
@@ -1,8 +1,8 @@
+import { ToastProps } from '@components/toast/ToastProvider';
import Image from 'next/image';
import Button from '../../../../button/Button';
import { AlertMethod, Alert } from './hooks/useAlerts';
import useEditAlerts from './hooks/useEditAlerts';
-import { ToastProps } from '../../../../toast/hooks/useToast';
type InventoryViewAlertsDeleteAlertProps = {
alertMethod: AlertMethod;
diff --git a/dashboard/components/inventory/components/view/alerts/InventoryViewAlertsEditAlert.tsx b/dashboard/components/inventory/components/view/alerts/InventoryViewAlertsEditAlert.tsx
index 589fa7fe8..a80b6c3c7 100644
--- a/dashboard/components/inventory/components/view/alerts/InventoryViewAlertsEditAlert.tsx
+++ b/dashboard/components/inventory/components/view/alerts/InventoryViewAlertsEditAlert.tsx
@@ -1,11 +1,11 @@
import classNames from 'classnames';
import { useState } from 'react';
import Image from 'next/image';
+import { ToastProps } from '@components/toast/ToastProvider';
import Button from '../../../../button/Button';
import Grid from '../../../../grid/Grid';
import ArrowLeftIcon from '../../../../icons/ArrowLeftIcon';
import Input from '../../../../input/Input';
-import { ToastProps } from '../../../../toast/hooks/useToast';
import useEditAlerts from './hooks/useEditAlerts';
import { AlertMethod, Alert } from './hooks/useAlerts';
import settingsService from '../../../../../services/settingsService';
diff --git a/dashboard/components/inventory/components/view/alerts/hooks/useEditAlerts.tsx b/dashboard/components/inventory/components/view/alerts/hooks/useEditAlerts.tsx
index 9f1c72ec0..86a13c8f1 100644
--- a/dashboard/components/inventory/components/view/alerts/hooks/useEditAlerts.tsx
+++ b/dashboard/components/inventory/components/view/alerts/hooks/useEditAlerts.tsx
@@ -1,6 +1,6 @@
+import { ToastProps } from '@components/toast/ToastProvider';
import { FormEvent, useState } from 'react';
import settingsService from '../../../../../../services/settingsService';
-import { ToastProps } from '../../../../../toast/hooks/useToast';
import { AlertMethod, Alert } from './useAlerts';
type AlertType = 'BUDGET' | 'USAGE';
diff --git a/dashboard/components/inventory/components/view/hooks/useViews.tsx b/dashboard/components/inventory/components/view/hooks/useViews.tsx
index 657ad9a91..b34a71d14 100644
--- a/dashboard/components/inventory/components/view/hooks/useViews.tsx
+++ b/dashboard/components/inventory/components/view/hooks/useViews.tsx
@@ -1,7 +1,7 @@
+import { ToastProps } from '@components/toast/ToastProvider';
import { NextRouter } from 'next/router';
import { ChangeEvent, FormEvent, useState } from 'react';
import settingsService from '../../../../../services/settingsService';
-import { ToastProps } from '../../../../toast/hooks/useToast';
import {
HiddenResource,
InventoryFilterData,
diff --git a/dashboard/components/inventory/hooks/useInventory/helpers/getCustomViewInventoryListAndStats.ts b/dashboard/components/inventory/hooks/useInventory/helpers/getCustomViewInventoryListAndStats.ts
index 6288037b0..acae4c110 100644
--- a/dashboard/components/inventory/hooks/useInventory/helpers/getCustomViewInventoryListAndStats.ts
+++ b/dashboard/components/inventory/hooks/useInventory/helpers/getCustomViewInventoryListAndStats.ts
@@ -1,7 +1,7 @@
+import { ToastProps } from '@components/toast/ToastProvider';
import { NextRouter } from 'next/router';
import { SetStateAction } from 'react';
import settingsService from '../../../../../services/settingsService';
-import { ToastProps } from '../../../../toast/hooks/useToast';
import {
HiddenResource,
InventoryFilterData,
diff --git a/dashboard/components/inventory/hooks/useInventory/helpers/getInventoryListFromAFilter.ts b/dashboard/components/inventory/hooks/useInventory/helpers/getInventoryListFromAFilter.ts
index 9858e31da..bdca50329 100644
--- a/dashboard/components/inventory/hooks/useInventory/helpers/getInventoryListFromAFilter.ts
+++ b/dashboard/components/inventory/hooks/useInventory/helpers/getInventoryListFromAFilter.ts
@@ -1,7 +1,7 @@
+import { ToastProps } from '@components/toast/ToastProvider';
import { NextRouter } from 'next/router';
import { SetStateAction } from 'react';
import settingsService from '../../../../../services/settingsService';
-import { ToastProps } from '../../../../toast/hooks/useToast';
import {
InventoryFilterData,
InventoryItem,
diff --git a/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollCustomViewList.ts b/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollCustomViewList.ts
index 8e75df240..e9eeeaf90 100644
--- a/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollCustomViewList.ts
+++ b/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollCustomViewList.ts
@@ -1,7 +1,7 @@
+import { ToastProps } from '@components/toast/ToastProvider';
import { NextRouter } from 'next/router';
import { SetStateAction } from 'react';
import settingsService from '../../../../../services/settingsService';
-import { ToastProps } from '../../../../toast/hooks/useToast';
import { InventoryItem, View } from '../types/useInventoryTypes';
type InfiniteScrollCustomViewListProps = {
diff --git a/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollFilteredList.ts b/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollFilteredList.ts
index 3a55f91b9..531289dd9 100644
--- a/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollFilteredList.ts
+++ b/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollFilteredList.ts
@@ -1,6 +1,6 @@
+import { ToastProps } from '@components/toast/ToastProvider';
import { SetStateAction } from 'react';
import settingsService from '../../../../../services/settingsService';
-import { ToastProps } from '../../../../toast/hooks/useToast';
import { InventoryFilterData, InventoryItem } from '../types/useInventoryTypes';
type InfiniteScrollFilteredListProps = {
diff --git a/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollInventoryList.ts b/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollInventoryList.ts
index 010b7d386..83d504328 100644
--- a/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollInventoryList.ts
+++ b/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollInventoryList.ts
@@ -1,7 +1,7 @@
+import { ToastProps } from '@components/toast/ToastProvider';
import { NextRouter } from 'next/router';
import { SetStateAction } from 'react';
import settingsService from '../../../../../services/settingsService';
-import { ToastProps } from '../../../../toast/hooks/useToast';
import {
InventoryFilterData,
InventoryItem,
diff --git a/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollSearchedAndFilteredList.ts b/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollSearchedAndFilteredList.ts
index 8e671511d..9a199af8e 100644
--- a/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollSearchedAndFilteredList.ts
+++ b/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollSearchedAndFilteredList.ts
@@ -1,7 +1,7 @@
+import { ToastProps } from '@components/toast/ToastProvider';
import { NextRouter } from 'next/router';
import { SetStateAction } from 'react';
import settingsService from '../../../../../services/settingsService';
-import { ToastProps } from '../../../../toast/hooks/useToast';
import { InventoryFilterData, InventoryItem } from '../types/useInventoryTypes';
type InfiniteScrollSearchedAndFilteredList = {
diff --git a/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollSearchedCustomViewList.ts b/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollSearchedCustomViewList.ts
index 546e83132..c9a9b282b 100644
--- a/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollSearchedCustomViewList.ts
+++ b/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollSearchedCustomViewList.ts
@@ -1,7 +1,7 @@
+import { ToastProps } from '@components/toast/ToastProvider';
import { NextRouter } from 'next/router';
import { SetStateAction } from 'react';
import settingsService from '../../../../../services/settingsService';
-import { ToastProps } from '../../../../toast/hooks/useToast';
import { InventoryItem, View } from '../types/useInventoryTypes';
type InfiniteScrollSearchedCustomViewListProps = {
diff --git a/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollSearchedList.ts b/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollSearchedList.ts
index fcf38caba..4e19aaee6 100644
--- a/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollSearchedList.ts
+++ b/dashboard/components/inventory/hooks/useInventory/helpers/infiniteScrollSearchedList.ts
@@ -1,7 +1,7 @@
+import { ToastProps } from '@components/toast/ToastProvider';
import { NextRouter } from 'next/router';
import { SetStateAction } from 'react';
import settingsService from '../../../../../services/settingsService';
-import { ToastProps } from '../../../../toast/hooks/useToast';
import { InventoryItem } from '../types/useInventoryTypes';
type InfiniteScrollSearchedListProps = {
From 5e44c2654228f6e939f8205cd64ba11bb3a40975 Mon Sep 17 00:00:00 2001
From: Saba Shavidze
Date: Wed, 18 Oct 2023 12:33:47 +0400
Subject: [PATCH 097/113] refactor: updated imports for ToastProps
---
.../components/CloudAccountDeleteContents.tsx | 8 ++--
.../components/CloudAccountsSidePanel.tsx | 10 ++---
.../filter/DependencyGraphFilterDropdown.tsx | 4 +-
dashboard/components/export-csv/ExportCSV.tsx | 6 +--
.../feedback-widget/FeedbackWidget.tsx | 14 +++---
.../components/InventoryFilterDropdown.tsx | 4 +-
.../components/InventorySearchBar.tsx | 6 +--
.../inventory/components/InventoryTable.tsx | 6 +--
.../filter/InventoryFilterValue.tsx | 12 ++---
.../components/view/InventoryView.tsx | 10 ++---
.../components/view/InventoryViewHeader.tsx | 8 ++--
.../view/alerts/InventoryViewAlerts.tsx | 10 ++---
.../alerts/InventoryViewAlertsDeleteAlert.tsx | 6 +--
.../alerts/InventoryViewAlertsEditAlert.tsx | 6 +--
.../view/alerts/hooks/useEditAlerts.tsx | 16 +++----
.../components/view/hooks/useViews.tsx | 28 ++++++------
.../getCustomViewInventoryListAndStats.ts | 8 ++--
.../helpers/getInventoryListFromAFilter.ts | 8 ++--
.../helpers/infiniteScrollCustomViewList.ts | 6 +--
.../helpers/infiniteScrollFilteredList.ts | 6 +--
.../helpers/infiniteScrollInventoryList.ts | 6 +--
.../infiniteScrollSearchedAndFilteredList.ts | 6 +--
.../infiniteScrollSearchedCustomViewList.ts | 6 +--
.../helpers/infiniteScrollSearchedList.ts | 6 +--
.../hooks/useInventory/useInventory.tsx | 44 +++++++++----------
.../onboarding-wizard/ProviderContent.tsx | 4 +-
dashboard/components/toast/ToastProvider.tsx | 12 ++---
dashboard/pages/cloud-accounts.tsx | 6 +--
dashboard/pages/inventory.tsx | 6 +--
.../pages/onboarding/cloud-accounts/index.tsx | 4 +-
.../pages/onboarding/database/postgres.tsx | 4 +-
.../pages/onboarding/database/sqlite.tsx | 4 +-
dashboard/utils/cloudAccountHelpers.ts | 28 ++++++------
33 files changed, 160 insertions(+), 158 deletions(-)
diff --git a/dashboard/components/cloud-account/components/CloudAccountDeleteContents.tsx b/dashboard/components/cloud-account/components/CloudAccountDeleteContents.tsx
index f90639782..51b1c9c45 100644
--- a/dashboard/components/cloud-account/components/CloudAccountDeleteContents.tsx
+++ b/dashboard/components/cloud-account/components/CloudAccountDeleteContents.tsx
@@ -9,14 +9,14 @@ interface CloudAccountDeleteContentsProps {
cloudAccount: CloudAccount;
onCancel: () => void;
handleAfterDelete: (account: CloudAccount) => void;
- setToast: (toast: ToastProps) => void;
+ showToast: (toast: ToastProps) => void;
}
function CloudAccountDeleteContents({
cloudAccount,
onCancel,
handleAfterDelete,
- setToast
+ showToast
}: CloudAccountDeleteContentsProps) {
const [loading, setLoading] = useState(false);
@@ -28,14 +28,14 @@ function CloudAccountDeleteContents({
settingsService.deleteCloudAccount(cloudAccount.id).then(res => {
setLoading(false);
if (res === Error) {
- setToast({
+ showToast({
hasError: true,
title: 'Cloud account was not deleted',
message:
'There was an error deleting this cloud account. Please try again.'
});
} else {
- setToast({
+ showToast({
hasError: false,
title: 'Cloud account deleted',
message: `The cloud account was successfully deleted!`
diff --git a/dashboard/components/cloud-account/components/CloudAccountsSidePanel.tsx b/dashboard/components/cloud-account/components/CloudAccountsSidePanel.tsx
index 21d0e1104..0976ef508 100644
--- a/dashboard/components/cloud-account/components/CloudAccountsSidePanel.tsx
+++ b/dashboard/components/cloud-account/components/CloudAccountsSidePanel.tsx
@@ -36,7 +36,7 @@ interface CloudAccountsSidePanelProps {
handleAfterDelete: (account: CloudAccount) => void;
page: CloudAccountsPage;
goTo: (page: CloudAccountsPage) => void;
- setToast: (toast: ToastProps) => void;
+ showToast: (toast: ToastProps) => void;
}
function AccountDetails({
@@ -81,7 +81,7 @@ function CloudAccountsSidePanel({
handleAfterDelete,
page,
goTo,
- setToast
+ showToast
}: CloudAccountsSidePanelProps) {
const [isDeleteOpen, setIsDeleteOpen] = useState(false);
const [loading, setLoading] = useState(false);
@@ -101,7 +101,7 @@ function CloudAccountsSidePanel({
settingsService.editCloudAccount(id, payloadJson).then(res => {
if (res === Error || res.error) {
setLoading(false);
- setToast({
+ showToast({
hasError: true,
title: 'Cloud account not edited',
message:
@@ -109,7 +109,7 @@ function CloudAccountsSidePanel({
});
} else {
setLoading(false);
- setToast({
+ showToast({
hasError: false,
title: 'Cloud account edited',
message: `The cloud account was successfully edited!`
@@ -182,7 +182,7 @@ function CloudAccountsSidePanel({
setIsDeleteOpen(false);
closeModal();
}}
- setToast={setToast}
+ showToast={showToast}
/>
) : (
diff --git a/dashboard/components/explorer/filter/DependencyGraphFilterDropdown.tsx b/dashboard/components/explorer/filter/DependencyGraphFilterDropdown.tsx
index c2c927f1d..20e0e1b78 100644
--- a/dashboard/components/explorer/filter/DependencyGraphFilterDropdown.tsx
+++ b/dashboard/components/explorer/filter/DependencyGraphFilterDropdown.tsx
@@ -19,7 +19,7 @@ export default function InventoryFilterDropdown({
toggle,
closeDropdownAfterAdd
}: InventoryFilterDropdownProps) {
- const { setSkippedSearch, router, setToast } = useInventory();
+ const { setSkippedSearch, router, showToast } = useInventory();
const {
// toggle,
@@ -93,7 +93,7 @@ export default function InventoryFilterDropdown({
handleValueCheck={handleValueCheck}
handleValueInput={handleValueInput}
cleanValues={cleanValues}
- setToast={setToast}
+ showToast={showToast}
costBetween={costBetween}
handleCostBetween={handleCostBetween}
/>
diff --git a/dashboard/components/export-csv/ExportCSV.tsx b/dashboard/components/export-csv/ExportCSV.tsx
index 835cdbdaf..0029a4976 100644
--- a/dashboard/components/export-csv/ExportCSV.tsx
+++ b/dashboard/components/export-csv/ExportCSV.tsx
@@ -4,15 +4,15 @@ import settingsService from '../../services/settingsService';
import ExportCSVButton from './ExportCSVButton';
type ExportCSVProps = {
- setToast: (toast: ToastProps | undefined) => void;
+ showToast: (toast: ToastProps) => void;
};
-function ExportCSV({ setToast }: ExportCSVProps) {
+function ExportCSV({ showToast }: ExportCSVProps) {
const router = useRouter();
function exportCSV(id?: string) {
settingsService.exportCSV(id);
- setToast({
+ showToast({
hasError: false,
title: 'CSV exported',
message: 'The download of the CSV file should begin shortly.'
diff --git a/dashboard/components/feedback-widget/FeedbackWidget.tsx b/dashboard/components/feedback-widget/FeedbackWidget.tsx
index c36db5543..9aa803604 100644
--- a/dashboard/components/feedback-widget/FeedbackWidget.tsx
+++ b/dashboard/components/feedback-widget/FeedbackWidget.tsx
@@ -54,7 +54,7 @@ const useFeedbackWidget = (defaultState: boolean = false) => {
const [isTakingScreenCapture, setIsTakingScreenCapture] = useState(false);
const [fileAttachement, setFileAttachement] = useState