Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
99d7f78
init
lucasgoral Oct 6, 2025
31416d8
Merge branch 'main' into edit-resources
lucasgoral Oct 7, 2025
4c78673
fix
lucasgoral Oct 8, 2025
667bb38
fixes
lucasgoral Oct 8, 2025
cae0b1d
fix
lucasgoral Oct 8, 2025
a7524f9
fixes
lucasgoral Oct 8, 2025
b71be75
Update ManagedResources.tsx
lucasgoral Oct 8, 2025
1b65dde
refactor
lucasgoral Oct 8, 2025
dc27602
fix
lucasgoral Oct 8, 2025
3548a2f
Update YamlSidePanel.tsx
lucasgoral Oct 9, 2025
2dbea4b
Update ManagedResources.tsx
lucasgoral Oct 9, 2025
39533d5
Merge branch 'main' into edit-resources
lucasgoral Oct 9, 2025
23dba77
refactor
lucasgoral Oct 9, 2025
e5b3d3c
Update ProvidersConfig.tsx
lucasgoral Oct 9, 2025
27a6e75
Update src/components/YamlEditor/YamlDiffEditor.tsx
lucasgoral Oct 9, 2025
7309a85
Update src/components/YamlEditor/YamlEditor.tsx
lucasgoral Oct 9, 2025
5d2af7c
refactor
lucasgoral Oct 10, 2025
e3d4f02
removed finalizers
lucasgoral Oct 10, 2025
6082362
refactor
lucasgoral Oct 10, 2025
80035ae
fix
lucasgoral Oct 10, 2025
f42c67c
fix
lucasgoral Oct 10, 2025
918f04c
refactor
lucasgoral Oct 10, 2025
54fa61f
fix
lucasgoral Oct 10, 2025
2407778
Merge branch 'main' into edit-resources
lucasgoral Oct 10, 2025
0d8c56b
Merge branch 'main' into edit-resources
Hubert-Szczepanski-SAP Oct 20, 2025
3b59674
Update convertToResourceConfig.ts
lucasgoral Oct 20, 2025
f24a383
Update convertToResourceConfig.ts
lucasgoral Oct 20, 2025
40440fd
Merge branch 'main' into edit-resources
lucasgoral Oct 23, 2025
60629f9
fix
lucasgoral Oct 23, 2025
ac411c5
fix
lucasgoral Oct 23, 2025
7eaa038
refactor
lucasgoral Oct 24, 2025
53c0b3b
Update YamlEditor.module.css
lucasgoral Oct 24, 2025
0391900
refactor
lucasgoral Oct 24, 2025
841b024
Update YamlSidePanel.module.css
lucasgoral Oct 27, 2025
2a8f6f8
refactor
lucasgoral Oct 27, 2025
e1d3874
Merge branch 'main' into edit-resources
lucasgoral Oct 27, 2025
ba93909
Update ActionsMenu.tsx
lucasgoral Oct 27, 2025
0a94eca
fix
lucasgoral Oct 27, 2025
3c33acf
Merge branch 'main' into edit-resources
lucasgoral Oct 27, 2025
b55f44f
Update monaco.ts
lucasgoral Oct 27, 2025
f2fd02f
fix
lucasgoral Oct 27, 2025
c54e0e5
refactor
lucasgoral Oct 28, 2025
3fe0bfc
Update YamlEditor.tsx
lucasgoral Oct 28, 2025
bbb8b87
Merge branch 'main' into edit-resources
lucasgoral Oct 28, 2025
619242c
Merge branch 'main' into edit-resources
lucasgoral Oct 31, 2025
4f97b88
Merge branch 'main' into edit-resources
lucasgoral Oct 31, 2025
7dd1332
refactor
lucasgoral Oct 31, 2025
ec59e3c
Merge branch 'edit-resources' of https://github.com/openmcp-project/u…
lucasgoral Oct 31, 2025
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
8 changes: 5 additions & 3 deletions public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -417,19 +417,21 @@
"back": "Back",
"cancel": "Cancel",
"update": "Update",
"applyChanges": "Apply changes"
"applyChanges": "Apply changes",
"edit": "Edit"
},
"yaml": {
"YAML": "File",
"showOnlyImportant": "Show only important fields",
"panelTitle": "YAML",
"editorTitle": "YAML Editor",
"applySuccess2": "The Managed Control Plane will reconcile this resource shortly.",
"applySuccess": "Update submitted ",
"diffConfirmTitle": "Review changes",
"diffConfirmMessage": "Are you sure that you want to apply these changes?",
"diffNo": "No, go back",
"diffYes": "Yes"
"diffYes": "Yes",
"validationErrors": "Validation errors",
"fluxManaged": "This resource is managed by Flux and cannot be edited here"
},
"createMCP": {
"dialogTitle": "Create Managed Control Plane",
Expand Down
10 changes: 9 additions & 1 deletion src/components/ControlPlane/ActionsMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export type ActionItem<T> = {
icon?: string;
disabled?: boolean;
onClick: (item: T) => void;
tooltip?: string;
};

export type ActionsMenuProps<T> = {
Expand Down Expand Up @@ -45,7 +46,14 @@ export function ActionsMenu<T>({ item, actions, buttonIcon = 'overflow' }: Actio
}}
>
{actions.map((a) => (
<MenuItem key={a.key} text={a.text} icon={a.icon} data-action-key={a.key} disabled={a.disabled} />
<MenuItem
key={a.key}
text={a.text}
icon={a.icon}
data-action-key={a.key}
disabled={a.disabled}
tooltip={a.tooltip}
/>
))}
</Menu>
</>
Expand Down
38 changes: 34 additions & 4 deletions src/components/ControlPlane/GitRepositories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import ConfiguredAnalyticstable from '../Shared/ConfiguredAnalyticsTable.tsx';
import { AnalyticalTableColumnDefinition, Panel, Title, Toolbar, ToolbarSpacer } from '@ui5/webcomponents-react';
import {
AnalyticalTableColumnDefinition,
Panel,
Title,
Toolbar,
ToolbarSpacer,
Button,
} from '@ui5/webcomponents-react';
import IllustratedError from '../Shared/IllustratedError.tsx';
import { useApiResource } from '../../lib/api/useApiResource';
import { FluxRequest } from '../../lib/api/types/flux/listGitRepo';
Expand All @@ -17,6 +24,7 @@ import { useHandleResourcePatch } from '../../lib/api/types/crossplane/useHandle
import { ErrorDialog, ErrorDialogHandle } from '../Shared/ErrorMessageBox.tsx';
import type { GitReposResponse } from '../../lib/api/types/flux/listGitRepo';
import { ActionsMenu, type ActionItem } from './ActionsMenu';
import { useHasMcpAdminRights } from '../../spaces/mcp/auth/useHasMcpAdminRights.ts';

export type GitRepoItem = GitReposResponse['items'][0] & {
apiVersion?: string;
Expand All @@ -39,7 +47,6 @@ export function GitRepositories() {
readyMessage: string;
revision?: string;
};

const openEditPanel = useCallback(
(item: GitRepoItem) => {
const identityKey = `${item.kind}:${item.metadata.namespace ?? ''}:${item.metadata.name}`;
Expand All @@ -56,6 +63,7 @@ export function GitRepositories() {
},
[openInAside, handlePatch],
);
const hasMCPAdminRights = useHasMcpAdminRights();

const columns = useMemo<AnalyticalTableColumnDefinition[]>(
() =>
Expand Down Expand Up @@ -96,7 +104,28 @@ export function GitRepositories() {
width: 75,
accessor: 'yaml',
disableFilters: true,
Cell: ({ row }) => <YamlViewButton variant="resource" resource={row.original.item as unknown as Resource} />,
Cell: ({ row }) => {
const item = row.original?.item;
return item ? (
<YamlViewButton
variant="resource"
resource={item as unknown as Resource}
toolbarContent={
hasMCPAdminRights ? (
<Button
icon={'edit'}
design={'Transparent'}
onClick={() => {
openEditPanel(item);
}}
>
{t('buttons.edit')}
</Button>
) : undefined
}
/>
) : undefined;
},
},
{
Header: t('ManagedResources.actionColumnHeader'),
Expand All @@ -113,13 +142,14 @@ export function GitRepositories() {
text: t('ManagedResources.editAction', 'Edit'),
icon: 'edit',
onClick: openEditPanel,
disabled: !hasMCPAdminRights,
},
];
return <ActionsMenu item={item} actions={actions} />;
},
},
] as AnalyticalTableColumnDefinition[],
[t, openEditPanel],
[t, hasMCPAdminRights, openEditPanel],
);

if (error) {
Expand Down
38 changes: 34 additions & 4 deletions src/components/ControlPlane/Kustomizations.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import ConfiguredAnalyticstable from '../Shared/ConfiguredAnalyticsTable.tsx';
import { AnalyticalTableColumnDefinition, Panel, Title, Toolbar, ToolbarSpacer } from '@ui5/webcomponents-react';
import {
AnalyticalTableColumnDefinition,
Panel,
Title,
Toolbar,
ToolbarSpacer,
Button,
} from '@ui5/webcomponents-react';
import IllustratedError from '../Shared/IllustratedError.tsx';
import { useApiResource } from '../../lib/api/useApiResource';
import { FluxKustomization } from '../../lib/api/types/flux/listKustomization';
Expand All @@ -17,6 +24,7 @@ import { useHandleResourcePatch } from '../../lib/api/types/crossplane/useHandle
import { ErrorDialog, ErrorDialogHandle } from '../Shared/ErrorMessageBox.tsx';
import type { KustomizationsResponse } from '../../lib/api/types/flux/listKustomization';
import { ActionsMenu, type ActionItem } from './ActionsMenu';
import { useHasMcpAdminRights } from '../../spaces/mcp/auth/useHasMcpAdminRights.ts';

export type KustomizationItem = KustomizationsResponse['items'][0] & {
apiVersion?: string;
Expand Down Expand Up @@ -55,7 +63,7 @@ export function Kustomizations() {
},
[openInAside, handlePatch],
);

const hasMCPAdminRights = useHasMcpAdminRights();
const columns = useMemo<AnalyticalTableColumnDefinition[]>(
() =>
[
Expand Down Expand Up @@ -91,7 +99,28 @@ export function Kustomizations() {
width: 75,
accessor: 'yaml',
disableFilters: true,
Cell: ({ row }) => <YamlViewButton variant="resource" resource={row.original.item as unknown as Resource} />,
Cell: ({ row }) => {
const item = row.original?.item;
return item ? (
<YamlViewButton
variant="resource"
resource={item as unknown as Resource}
toolbarContent={
hasMCPAdminRights ? (
<Button
icon={'edit'}
design={'Transparent'}
onClick={() => {
openEditPanel(item);
}}
>
{t('buttons.edit')}
</Button>
) : undefined
}
/>
) : undefined;
},
},
{
Header: t('ManagedResources.actionColumnHeader'),
Expand All @@ -108,13 +137,14 @@ export function Kustomizations() {
text: t('ManagedResources.editAction', 'Edit'),
icon: 'edit',
onClick: openEditPanel,
disabled: !hasMCPAdminRights,
},
];
return <ActionsMenu item={item} actions={actions} />;
},
},
] as AnalyticalTableColumnDefinition[],
[t, openEditPanel],
[t, openEditPanel, hasMCPAdminRights],
);

if (error) {
Expand Down
50 changes: 41 additions & 9 deletions src/components/ControlPlane/ManagedResources.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
AnalyticalTable,
AnalyticalTableColumnDefinition,
AnalyticalTableScaleWidthMode,
Button,
Panel,
Title,
Toolbar,
Expand Down Expand Up @@ -35,6 +36,7 @@ import { YamlSidePanel } from '../Yaml/YamlSidePanel.tsx';
import { ErrorDialog, ErrorDialogHandle } from '../Shared/ErrorMessageBox.tsx';
import { APIError } from '../../lib/api/error.ts';
import { useHandleResourcePatch } from '../../lib/api/types/crossplane/useHandleResourcePatch.ts';
import { useHasMcpAdminRights } from '../../spaces/mcp/auth/useHasMcpAdminRights.ts';

interface StatusFilterColumn {
filterValue?: string;
Expand All @@ -54,6 +56,19 @@ type ResourceRow = {
conditionSyncedMessage: string;
};

/**
* Checks if a resource is managed by Flux based on the kustomize.toolkit.fluxcd.io/name label
*/
const isResourceFluxManaged = (item: ManagedResourceItem | undefined): boolean => {
if (!item) return false;

const fluxLabelValue = (item?.metadata?.labels as unknown as Record<string, unknown> | undefined)?.[
'kustomize.toolkit.fluxcd.io/name'
];

return fluxLabelValue != null && (typeof fluxLabelValue !== 'string' || fluxLabelValue.trim() !== '');
};

export function ManagedResources() {
const { t } = useTranslation();
const toast = useToast();
Expand Down Expand Up @@ -105,7 +120,7 @@ export function ManagedResources() {
},
[openInAside, handlePatch],
);

const hasMCPAdminRights = useHasMcpAdminRights();
const columns = useMemo<AnalyticalTableColumnDefinition[]>(
() =>
[
Expand Down Expand Up @@ -167,8 +182,27 @@ export function ManagedResources() {
disableFilters: true,
Cell: ({ row }) => {
const { original } = row;
const isFluxManaged = isResourceFluxManaged(original?.item);
return original?.item ? (
<YamlViewButton variant="resource" resource={original.item as unknown as Resource} />
<YamlViewButton
variant="resource"
resource={original.item as unknown as Resource}
toolbarContent={
hasMCPAdminRights ? (
<Button
icon={'edit'}
design={'Transparent'}
disabled={isFluxManaged}
tooltip={t('yaml.fluxManaged')}
onClick={() => {
openEditPanel(original?.item);
}}
>
{t('buttons.edit')}
</Button>
) : undefined
}
/>
) : undefined;
},
},
Expand All @@ -182,12 +216,7 @@ export function ManagedResources() {
const item = original?.item;
if (!item) return undefined;

// Flux-managed check for disabling Edit
const fluxLabelValue = (item?.metadata?.labels as unknown as Record<string, unknown> | undefined)?.[
'kustomize.toolkit.fluxcd.io/name'
];
const isFluxManaged =
typeof fluxLabelValue === 'string' ? fluxLabelValue.trim() !== '' : fluxLabelValue != null;
const isFluxManaged = isResourceFluxManaged(item);

const actions: ActionItem<ManagedResourceItem>[] = [
{
Expand All @@ -196,20 +225,23 @@ export function ManagedResources() {
icon: 'edit',
disabled: isFluxManaged,
onClick: openEditPanel,
tooltip: isFluxManaged && hasMCPAdminRights ? t('yaml.fluxManaged') : undefined,
},

{
key: 'delete',
text: t('ManagedResources.deleteAction'),
icon: 'delete',
onClick: openDeleteDialog,
disabled: !hasMCPAdminRights,
},
];

return <ActionsMenu item={item} actions={actions} />;
},
},
] as AnalyticalTableColumnDefinition[],
[t, openEditPanel, openDeleteDialog],
[t, openEditPanel, openDeleteDialog, hasMCPAdminRights],
);

const rows: ResourceRow[] =
Expand Down
27 changes: 24 additions & 3 deletions src/components/ControlPlane/ProvidersConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
AnalyticalTable,
AnalyticalTableColumnDefinition,
AnalyticalTableScaleWidthMode,
Button,
Panel,
Title,
Toolbar,
Expand All @@ -23,6 +24,7 @@ import { useSplitter } from '../Splitter/SplitterContext.tsx';
import { YamlSidePanel } from '../Yaml/YamlSidePanel.tsx';
import { useHandleResourcePatch } from '../../lib/api/types/crossplane/useHandleResourcePatch.ts';
import { ErrorDialog, ErrorDialogHandle } from '../Shared/ErrorMessageBox.tsx';
import { useHasMcpAdminRights } from '../../spaces/mcp/auth/useHasMcpAdminRights.ts';

type Rows = {
parent: string;
Expand Down Expand Up @@ -74,7 +76,7 @@ export function ProvidersConfig() {
},
[openInAside, handlePatch],
);

const hasMCPAdminRights = useHasMcpAdminRights();
const columns = useMemo<AnalyticalTableColumnDefinition[]>(
() =>
[
Expand Down Expand Up @@ -102,7 +104,25 @@ export function ProvidersConfig() {
disableFilters: true,
Cell: ({ row }) => {
const item = row.original?.resource;
return item ? <YamlViewButton variant="resource" resource={item as unknown as Resource} /> : undefined;
return item ? (
<YamlViewButton
variant="resource"
resource={item as unknown as Resource}
toolbarContent={
hasMCPAdminRights ? (
<Button
icon={'edit'}
design={'Transparent'}
onClick={() => {
openEditPanel(item);
}}
>
{t('buttons.edit')}
</Button>
) : undefined
}
/>
) : undefined;
},
},
{
Expand All @@ -120,13 +140,14 @@ export function ProvidersConfig() {
text: t('ManagedResources.editAction', 'Edit'),
icon: 'edit',
onClick: openEditPanel,
disabled: !hasMCPAdminRights,
},
];
return <ActionsMenu item={item} actions={actions} />;
},
},
] as AnalyticalTableColumnDefinition[],
[t, openEditPanel],
[t, openEditPanel, hasMCPAdminRights],
);

return (
Expand Down
Loading
Loading