Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

frontend: Fix a circular dependency in KubeObject #2786

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions frontend/src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { render, waitFor } from '@testing-library/react';
import React from 'react';
import App from './App';

// todo: enable this after https://github.com/vitest-dev/vitest/issues/4143 is fixed
test.skip('renders without crashing', async () => {
test('renders without crashing', async () => {
const { getByText } = render(
<React.Suspense fallback="Loading...">
<App />
Expand Down
8 changes: 8 additions & 0 deletions frontend/src/components/App/RouteSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import { useDispatch } from 'react-redux';
import { Redirect, Route, RouteProps, Switch, useHistory } from 'react-router-dom';
import { getToken } from '../../lib/auth';
import { useClustersConf } from '../../lib/k8s';
import { redirects } from '../../lib/redirects';
import {
createRouteURL,
getDefaultRoutes,
getRoute,
getRoutePath,
getRouteUseClusterURL,
NotFoundRoute,
Expand Down Expand Up @@ -38,6 +40,12 @@ export default function RouteSwitcher(props: { requiresToken: () => boolean }) {
return (
<Suspense fallback={null}>
<Switch>
{redirects.map(({ fromPath, toRouteName }) => {
const targetRoute = getRoute(toRouteName);
if (!targetRoute) return null;

return <Redirect from={fromPath} to={getRoutePath(targetRoute)} exact />;
})}
{filteredRoutes.map((route, index) =>
route.name === 'OidcAuth' ? (
<Route
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//pods/default/imagepullbackoff"
>
imagepullbackoff
</a>
Expand Down Expand Up @@ -533,7 +533,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//pods/default/imagepullbackoff"
>
imagepullbackoff
</a>
Expand Down Expand Up @@ -625,7 +625,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//pods/default/imagepullbackoff"
>
imagepullbackoff
</a>
Expand Down Expand Up @@ -717,7 +717,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//pods/default/imagepullbackoff"
>
imagepullbackoff
</a>
Expand Down Expand Up @@ -809,7 +809,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//pods/default/imagepullbackoff"
>
imagepullbackoff
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//pods/MyNamespace0/mypod0"
>
mypod0
</a>
Expand Down Expand Up @@ -348,7 +348,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//pods/MyNamespace1/mypod1"
>
mypod1
</a>
Expand Down Expand Up @@ -384,7 +384,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//pods/MyNamespace2/mypod2"
>
mypod2
</a>
Expand Down Expand Up @@ -420,7 +420,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//pods/MyNamespace3/mypod3"
>
mypod3
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//pods/MyNamespace0/mypod0"
>
mypod0
</a>
Expand Down Expand Up @@ -348,7 +348,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//pods/MyNamespace1/mypod1"
>
mypod1
</a>
Expand Down Expand Up @@ -384,7 +384,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//pods/MyNamespace2/mypod2"
>
mypod2
</a>
Expand Down Expand Up @@ -420,7 +420,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//pods/MyNamespace3/mypod3"
>
mypod3
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//pods/MyNamespace0/mypod0"
>
mypod0
</a>
Expand All @@ -283,7 +283,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//pods/MyNamespace1/mypod1"
>
mypod1
</a>
Expand All @@ -309,7 +309,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//pods/MyNamespace2/mypod2"
>
mypod2
</a>
Expand All @@ -335,7 +335,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//pods/MyNamespace3/mypod3"
>
mypod3
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//configmaps/default/my-pvc"
>
my-pvc
</a>
Expand Down Expand Up @@ -694,7 +694,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//configmaps/default/my-pvc"
>
my-pvc
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//daemonsets/gadget/gadget"
>
gadget
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//endpoints//undefined"
/>
</td>
<td
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//gatewayclasses/default-gateway-class"
>
default-gateway-class
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//grpcroutes/default/default-httproute"
>
default-httproute
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//gateways/default/default-gateway"
>
default-gateway
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//httproutes/default/default-httproute"
>
default-httproute
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//deployments/default/php-apache"
>
Deployment
/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//horizontalpodautoscalers/default/php-apache"
>
php-apache
</a>
Expand All @@ -837,7 +837,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//deployments/default/php-apache"
>
Deployment
/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//ingressclasses/resource-example-ingress"
>
resource-example-ingress
</a>
Expand Down Expand Up @@ -574,7 +574,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//ingressclasses/resource-example-ingress"
>
resource-example-ingress
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//ingresses/default/tls-example-ingress"
>
tls-example-ingress
</a>
Expand Down Expand Up @@ -825,7 +825,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//ingresses/default/resource-example-ingress"
>
resource-example-ingress
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//jobs/default/job-0"
>
job-0
</a>
Expand Down Expand Up @@ -945,7 +945,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//jobs/default/job-1"
>
job-1
</a>
Expand Down Expand Up @@ -1085,7 +1085,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//jobs/default/job-2"
>
job-2
</a>
Expand Down Expand Up @@ -1225,7 +1225,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//jobs/default/job-3"
>
job-3
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//leases/default/lease"
>
lease
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//limitranges/default/limit-range"
>
limit-range
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@
>
<a
class="MuiTypography-root MuiTypography-inherit MuiLink-root MuiLink-underlineHover css-srrjpp-MuiTypography-root-MuiLink-root"
href="/"
href="/c//namespaces/default"
>
default
</a>
Expand Down
Loading
Loading