Skip to content

Commit 0e7e78d

Browse files
committed
Merge branch 'main' into feat/theming
2 parents 2346be7 + 16c8b83 commit 0e7e78d

File tree

79 files changed

+279
-982
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+279
-982
lines changed

.github/workflows/build.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ jobs:
2121
- name: Install dependencies
2222
run: npm ci
2323

24+
- name: Lint
25+
run: npm run lint
26+
2427
- name: Run Vitest Tests
2528
run: npm run test:vi
2629

src/components/ComponentsSelection/ComponentsSelection.tsx

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,15 @@ export interface ComponentsSelectionProps {
2828
setComponentsList: (components: ComponentsListItem[]) => void;
2929
}
3030

31-
export const ComponentsSelection: React.FC<ComponentsSelectionProps> = ({
32-
componentsList,
33-
setComponentsList,
34-
}) => {
31+
export const ComponentsSelection: React.FC<ComponentsSelectionProps> = ({ componentsList, setComponentsList }) => {
3532
const [searchTerm, setSearchTerm] = useState('');
3633
const { t } = useTranslation();
3734

38-
const selectedComponents = useMemo(
39-
() => getSelectedComponents(componentsList),
40-
[componentsList],
41-
);
35+
const selectedComponents = useMemo(() => getSelectedComponents(componentsList), [componentsList]);
4236

4337
const searchResults = useMemo(() => {
4438
const lowerSearch = searchTerm.toLowerCase();
45-
return componentsList.filter(({ name }) =>
46-
name.toLowerCase().includes(lowerSearch),
47-
);
39+
return componentsList.filter(({ name }) => name.toLowerCase().includes(lowerSearch));
4840
}, [componentsList, searchTerm]);
4941

5042
const handleSelectionChange = useCallback(
@@ -53,9 +45,7 @@ export const ComponentsSelection: React.FC<ComponentsSelectionProps> = ({
5345
if (!id) return;
5446
setComponentsList(
5547
componentsList.map((component) =>
56-
component.name === id
57-
? { ...component, isSelected: !component.isSelected }
58-
: component,
48+
component.name === id ? { ...component, isSelected: !component.isSelected } : component,
5949
),
6050
);
6151
},
@@ -74,9 +64,7 @@ export const ComponentsSelection: React.FC<ComponentsSelectionProps> = ({
7464
if (!name) return;
7565
setComponentsList(
7666
componentsList.map((component) =>
77-
component.name === name
78-
? { ...component, selectedVersion: version || '' }
79-
: component,
67+
component.name === name ? { ...component, selectedVersion: version || '' } : component,
8068
),
8169
);
8270
},
@@ -86,9 +74,7 @@ export const ComponentsSelection: React.FC<ComponentsSelectionProps> = ({
8674
const isProviderDisabled = useCallback(
8775
(component: ComponentsListItem) => {
8876
if (!component.name?.includes('provider')) return false;
89-
const crossplane = componentsList.find(
90-
({ name }) => name === 'crossplane',
91-
);
77+
const crossplane = componentsList.find(({ name }) => name === 'crossplane');
9278
return crossplane?.isSelected === false;
9379
},
9480
[componentsList],
@@ -130,11 +116,7 @@ export const ComponentsSelection: React.FC<ComponentsSelectionProps> = ({
130116
aria-label={component.name}
131117
onChange={handleSelectionChange}
132118
/>
133-
<FlexBox
134-
gap={10}
135-
justifyContent="SpaceBetween"
136-
alignItems="Baseline"
137-
>
119+
<FlexBox gap={10} justifyContent="SpaceBetween" alignItems="Baseline">
138120
{/* TODO: Add documentation link */}
139121
{component.documentationUrl && (
140122
<Button

src/components/ComponentsSelection/ComponentsSelectionContainer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import IllustratedError from '../Shared/IllustratedError.tsx';
55
import { sortVersions } from '../../utils/componentsVersions.ts';
66

77
import { ListManagedComponents } from '../../lib/api/types/crate/listManagedComponents.ts';
8-
import useApiResource from '../../lib/api/useApiResource.ts';
8+
import { useApiResource } from '../../lib/api/useApiResource.ts';
99
import Loading from '../Shared/Loading.tsx';
1010
import { ComponentsListItem, removeComponents } from '../../lib/api/types/crate/createManagedControlPlane.ts';
1111
import { useTranslation } from 'react-i18next';

src/components/ControlPlane/ComponentList.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
import {
2-
AnalyticalTable,
3-
AnalyticalTableColumnDefinition,
4-
} from '@ui5/webcomponents-react';
1+
import { AnalyticalTable, AnalyticalTableColumnDefinition } from '@ui5/webcomponents-react';
52
import { ControlPlaneType } from '../../lib/api/types/crate/controlPlanes';
63
import { useTranslation } from 'react-i18next';
74

src/components/ControlPlane/FluxList.tsx

Lines changed: 16 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
import ConfiguredAnalyticstable from '../Shared/ConfiguredAnalyticsTable.tsx';
2-
import {
3-
AnalyticalTableColumnDefinition,
4-
FlexBox,
5-
Title,
6-
} from '@ui5/webcomponents-react';
2+
import { AnalyticalTableColumnDefinition, FlexBox, Title } from '@ui5/webcomponents-react';
73
import IllustratedError from '../Shared/IllustratedError.tsx';
8-
import useResource from '../../lib/api/useApiResource';
4+
import { useApiResource } from '../../lib/api/useApiResource';
95
import { FluxRequest } from '../../lib/api/types/flux/listGitRepo';
10-
import {
11-
FluxKustomization,
12-
KustomizationsResponse,
13-
} from '../../lib/api/types/flux/listKustomization';
6+
import { FluxKustomization, KustomizationsResponse } from '../../lib/api/types/flux/listKustomization';
147
import { useTranslation } from 'react-i18next';
158
import { timeAgo } from '../../utils/i18n/timeAgo.ts';
169
import { ResourceStatusCell } from '../Shared/ResourceStatusCell.tsx';
@@ -19,16 +12,12 @@ import { useMemo } from 'react';
1912
import StatusFilter from '../Shared/StatusFilter/StatusFilter.tsx';
2013

2114
export default function FluxList() {
22-
const {
23-
data: gitReposData,
24-
error: repoErr,
25-
isLoading: repoIsLoading,
26-
} = useResource(FluxRequest); //404 if component not enabled
15+
const { data: gitReposData, error: repoErr, isLoading: repoIsLoading } = useApiResource(FluxRequest); //404 if component not enabled
2716
const {
2817
data: kustmizationData,
2918
error: kustomizationErr,
3019
isLoading: kustomizationIsLoading,
31-
} = useResource(FluxKustomization); //404 if component not enabled
20+
} = useApiResource(FluxKustomization); //404 if component not enabled
3221

3322
const { t } = useTranslation();
3423

@@ -75,9 +64,7 @@ export default function FluxList() {
7564
<ResourceStatusCell
7665
value={cellData.cell.row.original?.isReady}
7766
transitionTime={
78-
cellData.cell.row.original?.statusUpdateTime
79-
? cellData.cell.row.original?.statusUpdateTime
80-
: ''
67+
cellData.cell.row.original?.statusUpdateTime ? cellData.cell.row.original?.statusUpdateTime : ''
8168
}
8269
/>
8370
) : null,
@@ -93,7 +80,7 @@ export default function FluxList() {
9380
),
9481
},
9582
],
96-
[],
83+
[t],
9784
);
9885

9986
const kustomizationsColumns: AnalyticalTableColumnDefinition[] = useMemo(
@@ -118,9 +105,7 @@ export default function FluxList() {
118105
<ResourceStatusCell
119106
value={cellData.cell.row.original?.isReady}
120107
transitionTime={
121-
cellData.cell.row.original?.statusUpdateTime
122-
? cellData.cell.row.original?.statusUpdateTime
123-
: ''
108+
cellData.cell.row.original?.statusUpdateTime ? cellData.cell.row.original?.statusUpdateTime : ''
124109
}
125110
/>
126111
) : null,
@@ -132,22 +117,16 @@ export default function FluxList() {
132117
width: 85,
133118
accessor: 'yaml',
134119
disableFilters: true,
135-
Cell: (cellData: CellData<FluxRow>) => (
136-
<YamlViewButton resourceObject={cellData.cell.row.original?.item} />
137-
),
120+
Cell: (cellData: CellData<FluxRow>) => <YamlViewButton resourceObject={cellData.cell.row.original?.item} />,
138121
},
139122
],
140-
[],
123+
[t],
141124
);
142125

143126
if (repoErr || kustomizationErr) {
144127
return (
145128
<IllustratedError
146-
details={
147-
repoErr?.message ||
148-
kustomizationErr?.message ||
149-
t('FluxList.undefinedError')
150-
}
129+
details={repoErr?.message || kustomizationErr?.message || t('FluxList.undefinedError')}
151130
title={t('FluxList.noFluxError')}
152131
/>
153132
);
@@ -157,12 +136,8 @@ export default function FluxList() {
157136
gitReposData?.items?.map((item) => {
158137
return {
159138
name: item.metadata.name,
160-
isReady:
161-
item?.status?.conditions?.find((x) => x.type === 'Ready')?.status ===
162-
'True',
163-
statusUpdateTime: item.status?.conditions?.find(
164-
(x) => x.type === 'Ready',
165-
)?.lastTransitionTime,
139+
isReady: item?.status?.conditions?.find((x) => x.type === 'Ready')?.status === 'True',
140+
statusUpdateTime: item.status?.conditions?.find((x) => x.type === 'Ready')?.lastTransitionTime,
166141
revision: shortenCommitHash(item.status.artifact?.revision ?? '-'),
167142
created: timeAgo.format(new Date(item.metadata.creationTimestamp)),
168143
item: item,
@@ -173,12 +148,8 @@ export default function FluxList() {
173148
kustmizationData?.items?.map((item) => {
174149
return {
175150
name: item.metadata.name,
176-
isReady:
177-
item.status?.conditions?.find((x) => x.type === 'Ready')?.status ===
178-
'True',
179-
statusUpdateTime: item.status?.conditions?.find(
180-
(x) => x.type === 'Ready',
181-
)?.lastTransitionTime,
151+
isReady: item.status?.conditions?.find((x) => x.type === 'Ready')?.status === 'True',
152+
statusUpdateTime: item.status?.conditions?.find((x) => x.type === 'Ready')?.lastTransitionTime,
182153
created: timeAgo.format(new Date(item.metadata.creationTimestamp)),
183154
item: item,
184155
};
@@ -191,11 +162,7 @@ export default function FluxList() {
191162
<Title level="H4">{t('FluxList.gitOpsTitle')}</Title>
192163
<YamlViewButton resourceObject={gitReposData} />
193164
</FlexBox>
194-
<ConfiguredAnalyticstable
195-
columns={gitReposColumns}
196-
isLoading={repoIsLoading}
197-
data={gitReposRows}
198-
/>
165+
<ConfiguredAnalyticstable columns={gitReposColumns} isLoading={repoIsLoading} data={gitReposRows} />
199166
</div>
200167
<div className="crossplane-table-element">
201168
<FlexBox justifyContent={'Start'} alignItems={'Center'} gap={'0.5em'}>

src/components/ControlPlane/Landscapers.tsx

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9,55 +9,30 @@ import {
99
} from '@ui5/webcomponents-react';
1010
import { useState, JSX } from 'react';
1111
import { resourcesInterval } from '../../lib/shared/constants';
12-
import useResource, {
13-
useMultipleApiResources,
14-
} from '../../lib/api/useApiResource';
12+
import { useApiResource, useMultipleApiResources } from '../../lib/api/useApiResource';
1513
import { ListNamespaces } from '../../lib/api/types/k8s/listNamespaces';
16-
import {
17-
Installation,
18-
InstallationsRequest,
19-
} from '../../lib/api/types/landscaper/listInstallations';
20-
import {
21-
Execution,
22-
ExecutionsRequest,
23-
} from '../../lib/api/types/landscaper/listExecutions';
24-
import {
25-
DeployItem,
26-
DeployItemsRequest,
27-
} from '../../lib/api/types/landscaper/listDeployItems';
14+
import { Installation, InstallationsRequest } from '../../lib/api/types/landscaper/listInstallations';
15+
import { Execution, ExecutionsRequest } from '../../lib/api/types/landscaper/listExecutions';
16+
import { DeployItem, DeployItemsRequest } from '../../lib/api/types/landscaper/listDeployItems';
2817

2918
import { MultiComboBoxSelectionChangeEventDetail } from '@ui5/webcomponents/dist/MultiComboBox.js';
3019

3120
export function Landscapers() {
3221
const { t } = useTranslation();
3322

34-
const { data: namespaces } = useResource(ListNamespaces, {
23+
const { data: namespaces } = useApiResource(ListNamespaces, {
3524
refreshInterval: resourcesInterval,
3625
});
3726

3827
const [selectedNamespaces, setSelectedNamespaces] = useState<string[]>([]);
3928

40-
const { data: installations = [] } = useMultipleApiResources<Installation>(
41-
selectedNamespaces,
42-
InstallationsRequest,
43-
);
29+
const { data: installations = [] } = useMultipleApiResources<Installation>(selectedNamespaces, InstallationsRequest);
4430

45-
const { data: executions = [] } = useMultipleApiResources<Execution>(
46-
selectedNamespaces,
47-
ExecutionsRequest,
48-
);
31+
const { data: executions = [] } = useMultipleApiResources<Execution>(selectedNamespaces, ExecutionsRequest);
4932

50-
const { data: deployItems = [] } = useMultipleApiResources<DeployItem>(
51-
selectedNamespaces,
52-
DeployItemsRequest,
53-
);
33+
const { data: deployItems = [] } = useMultipleApiResources<DeployItem>(selectedNamespaces, DeployItemsRequest);
5434

55-
const handleSelectionChange = (
56-
e: Ui5CustomEvent<
57-
MultiComboBoxDomRef,
58-
MultiComboBoxSelectionChangeEventDetail
59-
>,
60-
) => {
35+
const handleSelectionChange = (e: Ui5CustomEvent<MultiComboBoxDomRef, MultiComboBoxSelectionChangeEventDetail>) => {
6136
const selectedItems = Array.from(e.detail.items || []);
6237
const selectedValues = selectedItems
6338
.map((item) => item.text)
@@ -85,9 +60,7 @@ export function Landscapers() {
8560
(installation.status?.subInstCache?.activeSubs
8661
?.map((sub) =>
8762
installations.find(
88-
(i) =>
89-
i.metadata.name === sub.objectName &&
90-
i.metadata.namespace === installation.metadata.namespace,
63+
(i) => i.metadata.name === sub.objectName && i.metadata.namespace === installation.metadata.namespace,
9164
),
9265
)
9366
.filter(Boolean) as Installation[]) || [];
@@ -102,9 +75,7 @@ export function Landscapers() {
10275
(execution?.status?.deployItemCache?.activeDIs
10376
?.map((di) =>
10477
deployItems.find(
105-
(item) =>
106-
item.metadata.name === di.objectName &&
107-
item.metadata.namespace === execution.metadata.namespace,
78+
(item) => item.metadata.name === di.objectName && item.metadata.namespace === execution.metadata.namespace,
10879
),
10980
)
11081
.filter(Boolean) as DeployItem[]) || [];
@@ -154,8 +125,7 @@ export function Landscapers() {
154125
return !installations.some((parent) =>
155126
parent.status?.subInstCache?.activeSubs?.some(
156127
(sub: { objectName: string }) =>
157-
sub.objectName === inst.metadata.name &&
158-
parent.metadata.namespace === inst.metadata.namespace,
128+
sub.objectName === inst.metadata.name && parent.metadata.namespace === inst.metadata.namespace,
159129
),
160130
);
161131
});

src/components/ControlPlane/MCPHealthPopoverButton.tsx

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,9 @@
1-
import {
2-
AnalyticalTable,
3-
Icon,
4-
Popover,
5-
FlexBox,
6-
FlexBoxJustifyContent,
7-
Button,
8-
} from '@ui5/webcomponents-react';
1+
import { AnalyticalTable, Icon, Popover, FlexBox, FlexBoxJustifyContent, Button } from '@ui5/webcomponents-react';
92
import { AnalyticalTableColumnDefinition } from '@ui5/webcomponents-react/wrappers';
103
import PopoverPlacement from '@ui5/webcomponents/dist/types/PopoverPlacement.js';
114
import '@ui5/webcomponents-icons/dist/copy';
125
import { JSX, useRef, useState } from 'react';
13-
import {
14-
ControlPlaneStatusType,
15-
ReadyStatus,
16-
} from '../../lib/api/types/crate/controlPlanes';
6+
import { ControlPlaneStatusType, ReadyStatus } from '../../lib/api/types/crate/controlPlanes';
177
import ReactTimeAgo from 'react-time-ago';
188
import { AnimatedHoverTextButton } from '../Helper/AnimatedHoverTextButton.tsx';
199
import { useTranslation } from 'react-i18next';
@@ -67,10 +57,8 @@ export default function MCPHealthPopoverButton({
6757
mcpStatus?.conditions
6858
.map((condition) => {
6959
let text = `- ${condition.type}: ${condition.status}\n`;
70-
if (condition.reason)
71-
text += ` - ${t('MCPHealthPopoverButton.reasonHeader')}: ${condition.reason}\n`;
72-
if (condition.message)
73-
text += ` - ${t('MCPHealthPopoverButton.messageHeader')}: ${condition.message}\n`;
60+
if (condition.reason) text += ` - ${t('MCPHealthPopoverButton.reasonHeader')}: ${condition.reason}\n`;
61+
if (condition.message) text += ` - ${t('MCPHealthPopoverButton.messageHeader')}: ${condition.message}\n`;
7462
return text;
7563
})
7664
.join('')
@@ -189,14 +177,9 @@ function StatusTable({
189177
}) ?? []
190178
}
191179
/>
192-
<FlexBox
193-
justifyContent={FlexBoxJustifyContent.End}
194-
style={{ marginTop: '0.5rem' }}
195-
>
180+
<FlexBox justifyContent={FlexBoxJustifyContent.End} style={{ marginTop: '0.5rem' }}>
196181
<a href={githubIssuesLink} target="_blank" rel="noreferrer">
197-
<Button>
198-
{t('MCPHealthPopoverButton.createSupportTicketButton')}
199-
</Button>
182+
<Button>{t('MCPHealthPopoverButton.createSupportTicketButton')}</Button>
200183
</a>
201184
</FlexBox>
202185
</div>

0 commit comments

Comments
 (0)