Skip to content

Commit 303bee3

Browse files
author
Alberto Gutierrez
committed
Fix tsc
1 parent 8838df1 commit 303bee3

File tree

7 files changed

+21
-14
lines changed

7 files changed

+21
-14
lines changed

plugins/kiali-backend/src/clients/fetch.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ describe('kiali Fetch', () => {
139139
);
140140

141141
jest.mock('./fetch', () => ({
142-
getAuthInfo: jest.fn(() => Promise.reject({})),
142+
getAuthInfo: Promise.reject({}),
143143
}));
144144
const validations = await kialiFetch.checkSession();
145145
expect(validations).toBeDefined();

plugins/kiali-backend/src/clients/fetch.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ export class KialiFetcher {
106106
* Check Configuration
107107
*/
108108
checkValidations = this.validateConfiguration(auth);
109-
} catch (error) {
109+
} catch (error: any) {
110110
return {
111111
verify: false,
112112
category: ValidationCategory.networking,
113113
title: 'Error reaching Kiali',
114-
message: error.message,
114+
message: error.message || '',
115115
helper: `Check if ${this.KialiDetails.url} works`,
116116
};
117117
}

plugins/kiali/dev/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { createDevApp } from '@backstage/dev-utils';
1212
import { EntityProvider } from '@backstage/plugin-catalog-react';
1313
import { TestApiProvider } from '@backstage/test-utils';
1414

15-
import { Card, CardMedia, Grid } from '@material-ui/core';
15+
import { Grid } from '@material-ui/core';
1616

1717
import { kialiPlugin } from '../src';
1818
import { getEntityRoutes, getRoutes } from '../src/components/Router';

plugins/kiali/src/components/BreadcrumbView/BreadcrumbView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as React from 'react';
2-
import { Link, Location, useLocation } from 'react-router-dom';
2+
import { Location, useLocation } from 'react-router-dom';
33

44
import { Breadcrumbs } from '@material-ui/core';
55

plugins/kiali/src/components/VirtualList/Renderers.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@ export const item: Renderer<TResource> = (
9494
cluster={resource.cluster}
9595
objectType={
9696
config.name === 'istio'
97-
? IstioTypes[resource.type].url
98-
: resource.type || undefined
97+
? IstioTypes[(resource as IstioConfigItem).type].url
98+
: (resource as WorkloadListItem).type || undefined
9999
}
100100
key={key}
101101
className={linkColor}

plugins/kiali/src/utils/janusLinks.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
import * as React from 'react';
22
import { Link as RouterLink } from 'react-router-dom';
33

4-
import { SubRouteRef, useRouteRef } from '@backstage/core-plugin-api';
4+
import {
5+
RouteFunc,
6+
SubRouteRef,
7+
useRouteRef,
8+
} from '@backstage/core-plugin-api';
59

610
import { Link } from '@material-ui/core';
711

@@ -18,6 +22,7 @@ import {
1822
workloadsRouteRef,
1923
} from '../routes';
2024

25+
type routeRefParams = undefined | { [key: string]: string };
2126
export const janusRoutesObject: {
2227
[key: string]: { id: string; ref: SubRouteRef };
2328
} = {
@@ -49,7 +54,7 @@ interface JanusLinkProps {
4954
className?: string;
5055
entity?: boolean;
5156
name?: string;
52-
type?: string;
57+
type: string;
5358
namespace?: string;
5459
objectType?: string;
5560
query?: string;
@@ -58,12 +63,12 @@ interface JanusLinkProps {
5863
}
5964

6065
export const JanusObjectLink = (props: JanusLinkProps) => {
61-
const { name, type, objectType, namespace, cluster, query } = props;
62-
const link = useRouteRef(
66+
const { name, type, objectType, namespace, query, cluster } = props;
67+
const link: RouteFunc<routeRefParams> = useRouteRef(
6368
props.entity ? rootRouteRef : janusRoutesObject[type].ref,
6469
);
6570
const items: { [key: string]: string } = { namespace: namespace || '' };
66-
if (type) {
71+
if (type && name) {
6772
items[janusRoutesObject[type].id] = name;
6873
}
6974
if (objectType) {
@@ -74,7 +79,9 @@ export const JanusObjectLink = (props: JanusLinkProps) => {
7479
<Link
7580
component={RouterLink}
7681
to={href}
77-
data-test={`${janusRoutesObject[type].id || ''}-${namespace}-${name}`}
82+
data-test={`${
83+
type ? janusRoutesObject[type].id : ''
84+
}-${namespace}-${name}`}
7885
{...props}
7986
>
8087
{props.children || `${namespace}/${name}`}

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36995,4 +36995,4 @@ zod@^3.22.4:
3699536995
zwitch@^2.0.0:
3699636996
version "2.0.4"
3699736997
resolved "https://registry.yarnpkg.com/zwitch/-/zwitch-2.0.4.tgz#c827d4b0acb76fc3e685a4c6ec2902d51070e9d7"
36998-
integrity sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==
36998+
integrity sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==

0 commit comments

Comments
 (0)