Skip to content

Commit

Permalink
Merge pull request #683 from tailwarden/feature/tech-952
Browse files Browse the repository at this point in the history
Fix routing
  • Loading branch information
eneskaya authored Mar 31, 2023
2 parents 55be150 + bce3ba1 commit 1d49704
Show file tree
Hide file tree
Showing 5 changed files with 224 additions and 153 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Geography,
Marker
} from 'react-simple-maps';
import Link from 'next/link';
import { DashboardCloudMapRegions } from './hooks/useCloudMap';
import { DashboardCloudMapTooltipProps } from './hooks/useCloudMapTooltip';

Expand Down Expand Up @@ -54,12 +55,7 @@ function DashboardCloudMapChart({
</Geographies>
{regionsAscendingByNumberOfResources &&
regionsAscendingByNumberOfResources.map((region, idx) => (
<a
key={idx}
href={`/inventory?region:IS:${region.label}`}
target="_blank"
rel="noreferrer"
>
<Link key={idx} href={`/inventory?region:IS:${region.label}`}>
<Marker
coordinates={[Number(region.longitude), Number(region.latitude)]}
onMouseEnter={e =>
Expand Down Expand Up @@ -87,7 +83,7 @@ function DashboardCloudMapChart({
strokeWidth={1.5}
/>
</Marker>
</a>
</Link>
))}
</ComposableMap>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ChartData, ChartOptions } from 'chart.js';
import { Dispatch, SetStateAction, useState } from 'react';
import { useRouter } from 'next/router';
import formatNumber from '../../../../../utils/formatNumber';
import {
ResourcesManagerData,
Expand All @@ -23,6 +24,7 @@ function useResourcesManagerChart({
setQuery,
initialQuery
}: useResourcesManagerChartProps) {
const router = useRouter();
const colors = ['#FF9A87', '#6DB7FF', '#B6D3B4', '#FFB459', '#59ACAC'];

/* To be un-commented when 'view' is supported
Expand Down Expand Up @@ -78,10 +80,7 @@ function useResourcesManagerChart({
const clickedIndex = legendItem[0].index || 0;
const labels = legend.config.data.labels ?? [];

window.open(
`./inventory?${currentQuery}:IS:${labels[clickedIndex]}`,
'_blank'
);
router.push(`/inventory?${currentQuery}:IS:${labels[clickedIndex]}`);
},
aspectRatio: 2,
layout: {
Expand Down
2 changes: 1 addition & 1 deletion dashboard/components/navbar/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function Navbar() {
<div className="flex items-center gap-8 text-sm font-semibold text-black-400">
<Link href="/dashboard">
<Image
src="./assets/img/komiser.svg"
src="/assets/img/komiser.svg"
width={40}
height={40}
alt="Komiser logo"
Expand Down
3 changes: 2 additions & 1 deletion dashboard/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ const nextConfig = {
swcMinify: true,
images: {
unoptimized: true
}
},
trailingSlash: true
};

module.exports = nextConfig;
355 changes: 215 additions & 140 deletions internal/api/v1/template.go

Large diffs are not rendered by default.

0 comments on commit 1d49704

Please sign in to comment.