Skip to content

Commit f42c67c

Browse files
committed
fix
1 parent 80035ae commit f42c67c

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

public/locales/en.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,8 @@
397397
"showOnlyImportant": "Show only important fields",
398398
"panelTitle": "YAML",
399399
"editorTitle": "YAML Editor",
400-
"applySuccess": "Changes applied successfully",
401-
"applySuccess2": "Your resource update was submitted.",
400+
"applySuccess2": "The Managed Control Plane will reconcile this resource shortly.",
401+
"applySuccess": "Update submitted ",
402402
"diffConfirmTitle": "Review changes",
403403
"diffConfirmMessage": "Are you sure that you want to apply these changes?",
404404
"diffNo": "No, go back",

src/components/ControlPlane/GitRepositories.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import ConfiguredAnalyticstable from '../Shared/ConfiguredAnalyticsTable.tsx';
22
import { AnalyticalTableColumnDefinition, Panel, Title, Toolbar, ToolbarSpacer } from '@ui5/webcomponents-react';
33
import IllustratedError from '../Shared/IllustratedError.tsx';
44
import { useApiResource } from '../../lib/api/useApiResource';
5-
import { FluxRequest, GitReposResponse } from '../../lib/api/types/flux/listGitRepo';
5+
import { FluxRequest } from '../../lib/api/types/flux/listGitRepo';
66
import { useTranslation } from 'react-i18next';
77
import { formatDateAsTimeAgo } from '../../utils/i18n/timeAgo.ts';
88

src/components/ControlPlane/ManagedResourcesActionMenu.tsx

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ export const RowActionsMenu: FC<RowActionsMenuProps> = ({ item, onOpen, onEdit }
1616
const popoverRef = useRef<MenuDomRef>(null);
1717
const [open, setOpen] = useState(false);
1818

19+
// Determine if the resource is managed by Flux based on the presence of the Flux label
20+
21+
const isFluxManaged = !!(item?.metadata?.labels as unknown as Record<string, unknown> | undefined)?.[
22+
'kustomize.toolkit.fluxcd.io/name'
23+
];
24+
1925
const handleOpenerClick = (e: Ui5CustomEvent<ButtonDomRef, ButtonClickEventDetail>) => {
2026
if (popoverRef.current && e.currentTarget) {
2127
popoverRef.current.opener = e.currentTarget as unknown as HTMLElement;
@@ -30,8 +36,12 @@ export const RowActionsMenu: FC<RowActionsMenuProps> = ({ item, onOpen, onEdit }
3036
ref={popoverRef}
3137
open={open}
3238
onItemClick={(event) => {
33-
const element = event.detail.item as HTMLElement;
39+
const element = event.detail.item as HTMLElement & { disabled?: boolean };
3440
const action = element.dataset.action;
41+
// If Edit is disabled (Flux-managed), ignore the click
42+
if (action === 'edit' && isFluxManaged) {
43+
return;
44+
}
3545
if (action === 'delete') {
3646
onOpen(item);
3747
} else if (action === 'edit') {
@@ -40,7 +50,12 @@ export const RowActionsMenu: FC<RowActionsMenuProps> = ({ item, onOpen, onEdit }
4050
setOpen(false);
4151
}}
4252
>
43-
<MenuItem text={t('ManagedResources.editAction', 'Edit')} icon="edit" data-action="edit" />
53+
<MenuItem
54+
text={t('ManagedResources.editAction', 'Edit')}
55+
icon="edit"
56+
data-action="edit"
57+
disabled={isFluxManaged}
58+
/>
4459
<MenuItem text={t('ManagedResources.deleteAction')} icon="delete" data-action="delete" />
4560
</Menu>
4661
</>

0 commit comments

Comments
 (0)