diff --git a/libs/i18n/locales/en/translation.json b/libs/i18n/locales/en/translation.json
index bf792953d..7894ca373 100644
--- a/libs/i18n/locales/en/translation.json
+++ b/libs/i18n/locales/en/translation.json
@@ -209,6 +209,7 @@
"Alias devices using a custom template. Add a number using": "Alias devices using a custom template. Add a number using",
"All {{ resumedCount }} devices resumed successfully": "All {{ resumedCount }} devices resumed successfully",
"All application workloads are healthy": "All application workloads are healthy",
+ "All export formats from this image build are already included in this promotion": "All export formats from this image build are already included in this promotion",
"All good!": "All good!",
"All images are stored under the same repository path in this registry.": "All images are stored under the same repository path in this registry.",
"All levels": "All levels",
@@ -988,6 +989,7 @@
"Exporting...": "Exporting...",
"External organization name": "External organization name",
"Failed": "Failed",
+ "Failed image promotions cannot be edited. Create a new image promotion to retry.": "Failed image promotions cannot be edited. Create a new image promotion to retry.",
"Failed to cancel image build": "Failed to cancel image build",
"Failed to connect to device": "Failed to connect to device",
"Failed to connect to device terminal": "Failed to connect to device terminal",
@@ -1203,8 +1205,11 @@
"Image output reference URL": "Image output reference URL",
"Image output tag": "Image output tag",
"Image placement": "Image placement",
+ "Image promotion cannot be edited while publishing is in progress": "Image promotion cannot be edited while publishing is in progress",
"Image Promotion name": "Image Promotion name",
"Image promotions": "Image promotions",
+ "Image promotions for canceled image builds cannot be edited. Create a new image promotion to retry.": "Image promotions for canceled image builds cannot be edited. Create a new image promotion to retry.",
+ "Image promotions for failed image builds cannot be edited. Create a new image promotion to retry.": "Image promotions for failed image builds cannot be edited. Create a new image promotion to retry.",
"Image reference": "Image reference",
"Image reference is required for this volume type": "Image reference is required for this volume type",
"Image reference URL": "Image reference URL",
@@ -1465,6 +1470,7 @@
"No fleet eligible for catalog deployment is available": "No fleet eligible for catalog deployment is available",
"No fleets currently match the selected labels.": "No fleets currently match the selected labels.",
"No fleets yet": "No fleets yet",
+ "No formats selected": "No formats selected",
"No Git repositories found": "No Git repositories found",
"No GPUs found": "No GPUs found",
"No image promotions yet": "No image promotions yet",
@@ -2403,6 +2409,7 @@
"View fleet": "View fleet",
"View fleet configurations": "View fleet configurations",
"View fleet details": "View fleet details",
+ "View image promotion": "View image promotion",
"View in repository": "View in repository",
"View logs": "View logs",
"View more": "View more",
@@ -2506,6 +2513,7 @@
"You do not have permissions to list devices": "You do not have permissions to list devices",
"You do not have permissions to list fleets": "You do not have permissions to list fleets",
"You do not have permissions to promote builds to the catalog": "You do not have permissions to promote builds to the catalog",
+ "You do not have permissions to update image promotions": "You do not have permissions to update image promotions",
"You don't have access to this section.": "You don't have access to this section.",
"You don't have permissions to create catalogs": "You don't have permissions to create catalogs",
"You don't have permissions to create image builds": "You don't have permissions to create image builds",
diff --git a/libs/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildDetailsTab.tsx b/libs/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildDetailsTab.tsx
index 35ed05a5d..9f8c22cfd 100644
--- a/libs/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildDetailsTab.tsx
+++ b/libs/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildDetailsTab.tsx
@@ -20,10 +20,13 @@ import {
StackItem,
} from '@patternfly/react-core';
import { type TFunction, Trans } from 'react-i18next';
+import { ActionsColumn, type IAction, Tbody, Td, Tr } from '@patternfly/react-table';
import { InfoCircleIcon } from '@patternfly/react-icons/dist/js/icons/info-circle-icon';
import { BindingType, type ImagePromotion } from '@flightctl/types/imagebuilder';
import ImagePromotionModal from '../../ImagePromotion/ImagePromotionModal';
+import { getAvailableExportFormats, getPromotionEditDisabledReason } from '../../ImagePromotion/utils';
+import { getDisabledTooltipProps } from '../../../utils/tooltip';
import ImagePromotionStatus from '../../ImagePromotion/ImagePromotionStatus';
import { getDateDisplay } from '../../../utils/dates';
import { getExportFormatLabel, getImageReference } from '../../../utils/imageBuilds';
@@ -37,7 +40,6 @@ import { ImageBuildStatusDisplay } from '../ImageBuildAndExportStatus';
import ImageUrl from '../ImageUrl';
import { getErrorMessage } from '../../../utils/error';
import Table from '../../Table/Table';
-import { ActionsColumn, type IAction, Tbody, Td, Tr } from '@patternfly/react-table';
import TablePagination from '../../Table/TablePagination';
import { getResourceId } from '../../../utils/resource';
import DeleteImagePromotionModal from '../../ImagePromotion/DeleteImagePromotionModal';
@@ -52,38 +54,53 @@ const detailsPermissions = [
{ kind: RESOURCE.IMAGE_PROMOTION, verb: VERB.DELETE },
];
+type PromotionAction = 'view' | 'edit' | 'delete';
+
+type PromotionActionState = {
+ id: string;
+ action: PromotionAction;
+};
+
const ImagePromotionRow = ({
imagePromotion,
- onDeleteClick,
- onEditClick,
+ editDisabledReason,
+ onActionClick,
canEditPromotions,
canDeletePromotions,
}: {
imagePromotion: ImagePromotion;
- onDeleteClick: VoidFunction;
- onEditClick: VoidFunction;
+ editDisabledReason?: string;
+ onActionClick: (action: PromotionAction) => void;
canEditPromotions: boolean;
canDeletePromotions: boolean;
}) => {
const { t } = useTranslation();
- const regularActions: IAction[] = canEditPromotions
- ? [
- {
- title: t('Edit image promotion'),
- onClick: onEditClick,
- },
- ]
- : [];
- const dangerActions: IAction[] = canDeletePromotions
- ? [
- {
- title: t('Delete image promotion'),
- onClick: onDeleteClick,
- },
- ]
- : [];
- const actions = buildAllDropdownActions(regularActions, dangerActions);
+ const actions: IAction[] = [
+ {
+ title: t('View image promotion'),
+ onClick: () => onActionClick('view'),
+ },
+ ];
+ if (canEditPromotions) {
+ actions.push({
+ title: t('Edit image promotion'),
+ onClick: () => onActionClick('edit'),
+ ...getDisabledTooltipProps(editDisabledReason),
+ });
+ }
+
+ const allActions = buildAllDropdownActions(
+ actions,
+ canDeletePromotions
+ ? [
+ {
+ title: t('Delete image promotion'),
+ onClick: () => onActionClick('delete'),
+ },
+ ]
+ : [],
+ );
return (