Skip to content

Commit bf417c3

Browse files
committed
fixes
1 parent 60d9100 commit bf417c3

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

src/components/Projects/ProjectsList.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import '@ui5/webcomponents-icons/dist/copy';
99
import '@ui5/webcomponents-icons/dist/arrow-right';
1010
import { ListProjectNames } from '../../lib/api/types/crate/listProjectNames';
1111
import { t } from 'i18next';
12+
import { YamlViewButton } from '@components/Yaml/YamlViewButton.tsx';
1213

1314
export default function ProjectsList() {
1415
const navigate = useLuigiNavigate();
@@ -18,7 +19,6 @@ export default function ProjectsList() {
1819
if (error) {
1920
return <IllustratedError error={error} />;
2021
}
21-
2222
return (
2323
<>
2424
<AnalyticalTable
@@ -37,6 +37,10 @@ export default function ProjectsList() {
3737
}}
3838
>
3939
{instance.cell.value}
40+
<YamlViewButton
41+
resourceType={'projects'}
42+
resourceName={instance.cell.value}
43+
/>
4044
</div>
4145
),
4246
},

src/components/Yaml/YamlLoader.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ export const YamlLoader: FC<ResourceProps> = ({
1414
resourceName,
1515
}) => {
1616
const { isLoading, data, error } = useResource(
17-
ResourceObject(workspaceName, resourceType, resourceName),
17+
ResourceObject(workspaceName ?? '', resourceType, resourceName),
1818
);
1919
const { t } = useTranslation();
2020
if (isLoading) return <Loading />;
21-
if (!workspaceName || !resourceName || !resourceType || error) {
21+
if (error) {
2222
return <IllustratedError error={t('common.cannotLoadData')} />;
2323
}
2424

src/components/Yaml/YamlViewButton.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { YamlLoader } from './YamlLoader.tsx';
44
import { useTranslation } from 'react-i18next';
55

66
export type ResourceProps = {
7-
workspaceName: string;
8-
resourceType: string;
7+
workspaceName?: string;
8+
resourceType: 'projects' | 'workspaces' | 'managedcontrolplanes';
99
resourceName: string;
1010
};
1111

src/lib/api/types/crate/resourceObject.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ export const ResourceObject = (
77
resourceName: string,
88
): Resource<ControlPlaneType> => {
99
return {
10-
path: `/apis/core.openmcp.cloud/v1alpha1/namespaces/${workspaceName}/${resourceType}/${resourceName}`,
10+
path: `/apis/core.openmcp.cloud/v1alpha1/${workspaceName ? `namespaces/${workspaceName}/` : ''}${resourceType}/${resourceName}`,
1111
};
1212
};

0 commit comments

Comments
 (0)