Skip to content

Commit

Permalink
Merge pull request #680 from tailwarden/develop
Browse files Browse the repository at this point in the history
v3.0.9 release 🚀
  • Loading branch information
eneskaya authored Mar 31, 2023
2 parents ee21d99 + ec45de8 commit 2731527
Show file tree
Hide file tree
Showing 16 changed files with 452 additions and 207 deletions.
35 changes: 0 additions & 35 deletions .github/go.yml

This file was deleted.

72 changes: 0 additions & 72 deletions .github/workflows/codeql.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ jobs:
git add .
git config user.name "purplin"
git config user.email "purplin@tailwarden.com"
if [ -z "$(git status --porcelain)" ]; then
echo "No changes to commit"
exit 0
fi
git commit -m "chore: bump version to ${VERSION}"
git push
env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
Title,
Tooltip
} from 'chart.js';
import Image from 'next/image';
import { Dispatch, SetStateAction } from 'react';
import { Bar } from 'react-chartjs-2';
import SelectCheckbox from '../../../select-checkbox/SelectCheckbox';
Expand Down Expand Up @@ -113,6 +114,20 @@ function DashboardCostExplorerCard({
<div className="mt-8"></div>
<div className="h-full min-h-[22rem]">
{chartData && <Bar data={chartData} options={options} />}
{!chartData && (
<div className="relative flex flex-col items-center">
<p className="mt-10 text-lg text-black-900">
No data for this time period
</p>
<Image
src="/assets/img/others/empty-state-cost-explorer.png"
width={940}
height={330}
alt="No data to display image"
className="absolute top-0"
/>
</div>
)}
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ArcElement, Chart as ChartJS, Legend, Tooltip } from 'chart.js';
import Image from 'next/image';
import { Dispatch, SetStateAction } from 'react';
import { Doughnut } from 'react-chartjs-2';
import SelectCheckbox from '../../../select-checkbox/SelectCheckbox';
Expand Down Expand Up @@ -30,6 +31,9 @@ function DashboardResourcesManagerCard({
{ data, setQuery, initialQuery: query }
);

const displayChart =
chartData && chartData.labels && chartData.labels.length > 0;

return (
<div className="w-full rounded-lg bg-white py-4 px-6 pb-6">
<div className="-mx-6 flex items-center justify-between border-b border-black-200/40 px-6 pb-4">
Expand Down Expand Up @@ -62,7 +66,22 @@ function DashboardResourcesManagerCard({
</div>
<div className="mt-4"></div>
<div>
<Doughnut data={chartData} options={options} />
{displayChart && <Doughnut data={chartData} options={options} />}
{!displayChart && (
<div className="relative flex items-center gap-16 px-4 pt-10">
<Image
src="/assets/img/others/empty-state-resources-manager.png"
width={200}
height={200}
alt="No data to display image"
/>
<p className="text-center text-lg text-black-900">
No resource data
<br />
to display
</p>
</div>
)}
</div>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion dashboard/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "komiser-dashboard",
"version": "3.0.8",
"version": "3.0.9",
"private": true,
"scripts": {
"dev": "next dev -p 3002",
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 14 additions & 8 deletions internal/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,33 +181,39 @@ func setupSchema(c *models.Config) error {
untaggedResourcesView := models.View{
Name: "Untagged resources",
Filters: []models.Filter{
models.Filter{
{
Field: "tags",
Operator: "IS_EMPTY",
Values: []string{},
},
},
}

_, err = db.NewInsert().Model(&untaggedResourcesView).Exec(context.Background())
if err != nil {
return err
count, _ := db.NewSelect().Model(&untaggedResourcesView).Where("name = ?", untaggedResourcesView.Name).ScanAndCount(context.Background())
if count == 0 {
_, err = db.NewInsert().Model(&untaggedResourcesView).Exec(context.Background())
if err != nil {
return err
}
}

expensiveResourcesView := models.View{
Name: "Expensive resources",
Filters: []models.Filter{
models.Filter{
{
Field: "cost",
Operator: "GREATER_THAN",
Values: []string{"0"},
},
},
}

_, err = db.NewInsert().Model(&expensiveResourcesView).Exec(context.Background())
if err != nil {
return err
count, _ = db.NewSelect().Model(&expensiveResourcesView).Where("name = ?", expensiveResourcesView.Name).ScanAndCount(context.Background())
if count == 0 {
_, err = db.NewInsert().Model(&expensiveResourcesView).Exec(context.Background())
if err != nil {
return err
}
}

return nil
Expand Down
Loading

0 comments on commit 2731527

Please sign in to comment.