Skip to content

Commit 86797e1

Browse files
Merge branch 'main' into pin-dependencies
2 parents 5d0f9d0 + 50559a8 commit 86797e1

File tree

18 files changed

+94
-130
lines changed

18 files changed

+94
-130
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ jobs:
2424
- name: Lint
2525
run: npm run lint
2626

27+
- name: TypeScript Type Check
28+
run: npm run type-check
29+
2730
- name: Run Vitest Tests
2831
run: npm run test:vi
2932

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"test:cy": "cypress run --component --browser chrome",
2222
"test:cy:open": "cypress open --component --browser chrome",
2323
"generate-graphql-types": "graphql-codegen --config graphql.config.yaml",
24-
"generate-graphql-types:watch": "graphql-codegen --config graphql.config.yaml --watch"
24+
"generate-graphql-types:watch": "graphql-codegen --config graphql.config.yaml --watch",
25+
"type-check": "tsc --noEmit"
2526
},
2627
"dependencies": {
2728
"@apollo/client": "3.14.0",

src/components/ComponentsSelection/ComponentsSelectionContainer.tsx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react';
22
import { ComponentsSelection } from './ComponentsSelection.tsx';
33
import IllustratedError from '../Shared/IllustratedError.tsx';
44
import Loading from '../Shared/Loading.tsx';
5-
import { ComponentsListItem } from '../../lib/api/types/crate/createManagedControlPlane.ts';
5+
import { ComponentsListItem, replaceComponentsName } from '../../lib/api/types/crate/createManagedControlPlane.ts';
66
import { useTranslation } from 'react-i18next';
77

88
export interface ComponentsSelectionProps {
@@ -19,11 +19,16 @@ export interface ComponentsSelectionProps {
1919
*/
2020
export const getSelectedComponents = (components: ComponentsListItem[]) => {
2121
const isCrossplaneSelected = components.some(({ name, isSelected }) => name === 'crossplane' && isSelected);
22-
return components.filter((component) => {
23-
if (!component.isSelected) return false;
24-
if (component.name?.includes('provider') && !isCrossplaneSelected) return false;
25-
return true;
26-
});
22+
23+
return components
24+
.filter(({ isSelected, name }) => isSelected && (isCrossplaneSelected || !name?.includes('provider')))
25+
.map((component) => {
26+
const mapping = replaceComponentsName.find((m) => m.replaceName === component.name);
27+
return {
28+
...component,
29+
name: mapping ? mapping.originalName : component.name,
30+
};
31+
});
2732
};
2833

2934
export const ComponentsSelectionContainer: React.FC<ComponentsSelectionProps> = ({

src/components/ControlPlane/GitRepositories.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ export type GitRepoItem = GitReposResponse['items'][0] & {
2323
metadata: GitReposResponse['items'][0]['metadata'] & { namespace?: string };
2424
};
2525

26-
interface CellRow<T> {
27-
original: T;
28-
}
29-
3026
export function GitRepositories() {
3127
const { data, error, isLoading } = useApiResource(FluxRequest); //404 if component not enabled
3228
const { t } = useTranslation();
@@ -83,7 +79,7 @@ export function GitRepositories() {
8379
width: 125,
8480
hAlign: 'Center',
8581
Filter: ({ column }) => <StatusFilter column={column} />,
86-
Cell: ({ row }: { row: CellRow<FluxRow> }) =>
82+
Cell: ({ row }) =>
8783
row.original?.isReady != null ? (
8884
<ResourceStatusCell
8985
positiveText={t('common.ready')}
@@ -100,17 +96,15 @@ export function GitRepositories() {
10096
width: 75,
10197
accessor: 'yaml',
10298
disableFilters: true,
103-
Cell: ({ row }: { row: CellRow<FluxRow> }) => (
104-
<YamlViewButton variant="resource" resource={row.original.item as unknown as Resource} />
105-
),
99+
Cell: ({ row }) => <YamlViewButton variant="resource" resource={row.original.item as unknown as Resource} />,
106100
},
107101
{
108102
Header: t('ManagedResources.actionColumnHeader'),
109103
hAlign: 'Center',
110104
width: 60,
111105
disableFilters: true,
112106
accessor: 'actions',
113-
Cell: ({ row }: { row: CellRow<FluxRow> }) => {
107+
Cell: ({ row }) => {
114108
const item = row.original?.item;
115109
if (!item) return undefined;
116110
const actions: ActionItem<GitRepoItem>[] = [

src/components/ControlPlane/Kustomizations.tsx

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,6 @@ export function Kustomizations() {
3030
const errorDialogRef = useRef<ErrorDialogHandle>(null);
3131
const handlePatch = useHandleResourcePatch(errorDialogRef);
3232

33-
interface CellRow<T> {
34-
original: T;
35-
}
36-
3733
type FluxRow = {
3834
name: string;
3935
created: string;
@@ -78,7 +74,7 @@ export function Kustomizations() {
7874
width: 125,
7975
hAlign: 'Center',
8076
Filter: ({ column }) => <StatusFilter column={column} />,
81-
Cell: ({ row }: { row: CellRow<FluxRow> }) =>
77+
Cell: ({ row }) =>
8278
row.original?.isReady != null ? (
8379
<ResourceStatusCell
8480
positiveText={t('common.ready')}
@@ -95,17 +91,15 @@ export function Kustomizations() {
9591
width: 75,
9692
accessor: 'yaml',
9793
disableFilters: true,
98-
Cell: ({ row }: { row: CellRow<FluxRow> }) => (
99-
<YamlViewButton variant="resource" resource={row.original.item as unknown as Resource} />
100-
),
94+
Cell: ({ row }) => <YamlViewButton variant="resource" resource={row.original.item as unknown as Resource} />,
10195
},
10296
{
10397
Header: t('ManagedResources.actionColumnHeader'),
10498
hAlign: 'Center',
10599
width: 60,
106100
disableFilters: true,
107101
accessor: 'actions',
108-
Cell: ({ row }: { row: CellRow<FluxRow> }) => {
102+
Cell: ({ row }) => {
109103
const item = row.original?.item;
110104
if (!item) return undefined;
111105
const actions: ActionItem<KustomizationItem>[] = [

src/components/ControlPlane/MCPHealthPopoverButton.tsx

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
import { AnalyticalTableColumnDefinition } from '@ui5/webcomponents-react/wrappers';
1212
import PopoverPlacement from '@ui5/webcomponents/dist/types/PopoverPlacement.js';
1313
import '@ui5/webcomponents-icons/dist/copy';
14-
import { JSX, useRef, useState, ReactNode } from 'react';
14+
import { JSX, useRef, useState } from 'react';
1515
import type { ButtonClickEventDetail } from '@ui5/webcomponents/dist/Button.js';
1616
import {
1717
ControlPlaneStatusType,
@@ -25,17 +25,6 @@ import { useLink } from '../../lib/shared/useLink.ts';
2525
import TooltipCell from '../Shared/TooltipCell.tsx';
2626
import type { Ui5CustomEvent } from '@ui5/webcomponents-react-base';
2727

28-
interface CellData<T> {
29-
cell: {
30-
value: ReactNode;
31-
};
32-
row: {
33-
original: T;
34-
[key: string]: unknown;
35-
};
36-
[key: string]: unknown;
37-
}
38-
3928
type MCPHealthPopoverButtonProps = {
4029
mcpStatus: ControlPlaneStatusType | undefined;
4130
projectName: string;
@@ -99,7 +88,7 @@ const MCPHealthPopoverButton = ({ mcpStatus, projectName, workspaceName, mcpName
9988
Header: t('MCPHealthPopoverButton.statusHeader'),
10089
accessor: 'status',
10190
width: 50,
102-
Cell: (instance: CellData<ControlPlaneStatusCondition>) => {
91+
Cell: (instance) => {
10392
const isReady = instance.cell.value === 'True';
10493
return (
10594
<Icon
@@ -113,31 +102,31 @@ const MCPHealthPopoverButton = ({ mcpStatus, projectName, workspaceName, mcpName
113102
Header: t('MCPHealthPopoverButton.typeHeader'),
114103
accessor: 'type',
115104
width: 150,
116-
Cell: (instance: CellData<ControlPlaneStatusCondition>) => {
105+
Cell: (instance) => {
117106
return <TooltipCell>{instance.cell.value}</TooltipCell>;
118107
},
119108
},
120109
{
121110
Header: t('MCPHealthPopoverButton.messageHeader'),
122111
accessor: 'message',
123112
width: 350,
124-
Cell: (instance: CellData<ControlPlaneStatusCondition>) => {
113+
Cell: (instance) => {
125114
return <TooltipCell>{instance.cell.value}</TooltipCell>;
126115
},
127116
},
128117
{
129118
Header: t('MCPHealthPopoverButton.reasonHeader'),
130119
accessor: 'reason',
131120
width: 100,
132-
Cell: (instance: CellData<ControlPlaneStatusCondition>) => {
121+
Cell: (instance) => {
133122
return <TooltipCell>{instance.cell.value}</TooltipCell>;
134123
},
135124
},
136125
{
137126
Header: t('MCPHealthPopoverButton.transitionHeader'),
138127
accessor: 'lastTransitionTime',
139128
width: 125,
140-
Cell: (instance: CellData<ControlPlaneStatusCondition>) => {
129+
Cell: (instance) => {
141130
const rawDate = instance.cell.value;
142131
const date = new Date(rawDate as string);
143132
return (

src/components/ControlPlane/ManagedResources.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ interface StatusFilterColumn {
4040
filterValue?: string;
4141
setFilter?: (value?: string) => void;
4242
}
43-
interface CellRow<T> {
44-
original: T;
45-
}
4643

4744
type ResourceRow = {
4845
kind: string;
@@ -130,7 +127,7 @@ export function ManagedResources() {
130127
hAlign: 'Center',
131128
width: 125,
132129
Filter: ({ column }: { column: StatusFilterColumn }) => <StatusFilter column={column} />,
133-
Cell: ({ row }: { row: CellRow<ResourceRow> }) => {
130+
Cell: ({ row }) => {
134131
const { original } = row;
135132
return original?.synced != null ? (
136133
<ResourceStatusCell
@@ -149,7 +146,7 @@ export function ManagedResources() {
149146
hAlign: 'Center',
150147
width: 125,
151148
Filter: ({ column }: { column: StatusFilterColumn }) => <StatusFilter column={column} />,
152-
Cell: ({ row }: { row: CellRow<ResourceRow> }) => {
149+
Cell: ({ row }) => {
153150
const { original } = row;
154151
return original?.ready != null ? (
155152
<ResourceStatusCell
@@ -168,7 +165,7 @@ export function ManagedResources() {
168165
width: 75,
169166
accessor: 'yaml',
170167
disableFilters: true,
171-
Cell: ({ row }: { row: CellRow<ResourceRow> }) => {
168+
Cell: ({ row }) => {
172169
const { original } = row;
173170
return original?.item ? (
174171
<YamlViewButton variant="resource" resource={original.item as unknown as Resource} />
@@ -180,7 +177,7 @@ export function ManagedResources() {
180177
hAlign: 'Center',
181178
width: 60,
182179
disableFilters: true,
183-
Cell: ({ row }: { row: CellRow<ResourceRow> }) => {
180+
Cell: ({ row }) => {
184181
const { original } = row;
185182
const item = original?.item;
186183
if (!item) return undefined;

src/components/ControlPlane/Providers.tsx

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,6 @@ import StatusFilter from '../Shared/StatusFilter/StatusFilter.tsx';
2424
import { ResourceStatusCell } from '../Shared/ResourceStatusCell.tsx';
2525
import { Resource } from '../../utils/removeManagedFieldsAndFilterData.ts';
2626

27-
interface CellData<T> {
28-
cell: {
29-
value: T | null;
30-
row: {
31-
original?: ProvidersRow;
32-
};
33-
};
34-
}
35-
3627
type ProvidersRow = {
3728
name: string;
3829
version: string;
@@ -78,14 +69,14 @@ export function Providers() {
7869
width: 125,
7970
Filter: ({ column }) => <StatusFilter column={column} />,
8071
filter: 'equals',
81-
Cell: (cellData: CellData<ProvidersRow['installed']>) =>
72+
Cell: (cellData) =>
8273
cellData.cell.row.original?.installed != null ? (
8374
<ResourceStatusCell
8475
isOk={cellData.cell.row.original?.installed === 'true'}
85-
transitionTime={cellData.cell.row.original?.installedTransitionTime}
76+
transitionTime={cellData.cell.row.original?.installedTransitionTime as string}
8677
positiveText={t('common.installed')}
8778
negativeText={t('errors.installError')}
88-
message={cellData.cell.row.original?.installedMessage}
79+
message={cellData.cell.row.original?.installedMessage as string}
8980
/>
9081
) : null,
9182
},
@@ -96,14 +87,14 @@ export function Providers() {
9687
width: 125,
9788
Filter: ({ column }) => <StatusFilter column={column} />,
9889
filter: 'equals',
99-
Cell: (cellData: CellData<ProvidersRow['healthy']>) =>
90+
Cell: (cellData) =>
10091
cellData.cell.row.original?.installed != null ? (
10192
<ResourceStatusCell
10293
isOk={cellData.cell.row.original?.healthy === 'true'}
103-
transitionTime={cellData.cell.row.original?.healthyTransitionTime}
94+
transitionTime={cellData.cell.row.original?.healthyTransitionTime as string}
10495
positiveText={t('common.healthy')}
10596
negativeText={t('errors.notHealthy')}
106-
message={cellData.cell.row.original?.healthyMessage}
97+
message={cellData.cell.row.original?.healthyMessage as string}
10798
/>
10899
) : null,
109100
},
@@ -113,7 +104,7 @@ export function Providers() {
113104
width: 75,
114105
accessor: 'yaml',
115106
disableFilters: true,
116-
Cell: (cellData: CellData<ProvidersRow>) => (
107+
Cell: (cellData) => (
117108
<YamlViewButton variant="resource" resource={cellData.cell.row.original?.item as Resource} />
118109
),
119110
},

src/components/ControlPlane/ProvidersConfig.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,6 @@ type Rows = {
3232
resource: ProviderConfigItem;
3333
};
3434

35-
interface CellRow<T> {
36-
original: T;
37-
}
38-
3935
export function ProvidersConfig() {
4036
const { t } = useTranslation();
4137
const { openInAside } = useSplitter();
@@ -104,7 +100,7 @@ export function ProvidersConfig() {
104100
width: 75,
105101
accessor: 'yaml',
106102
disableFilters: true,
107-
Cell: ({ row }: { row: CellRow<Rows> }) => {
103+
Cell: ({ row }) => {
108104
const item = row.original?.resource;
109105
return item ? <YamlViewButton variant="resource" resource={item as unknown as Resource} /> : undefined;
110106
},
@@ -115,7 +111,7 @@ export function ProvidersConfig() {
115111
width: 60,
116112
disableFilters: true,
117113
accessor: 'actions',
118-
Cell: ({ row }: { row: CellRow<Rows> }) => {
114+
Cell: ({ row }) => {
119115
const item = row.original?.resource;
120116
if (!item) return undefined;
121117
const actions: ActionItem<ProviderConfigItem>[] = [

src/components/ControlPlanes/List/ControlPlaneListWorkspaceGridTile.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export function ControlPlaneListWorkspaceGridTile({ projectName, workspace }: Pr
5252
const errorView = createErrorView(cpsError);
5353
const shouldCollapsePanel = !!errorView;
5454

55-
function createErrorView(error: APIError) {
55+
function createErrorView(error: APIError | undefined) {
5656
if (error) {
5757
if (error.status === 403) {
5858
return (

0 commit comments

Comments
 (0)