| {
actions={
(canPromote || canNewVersion || canDelete || canCancel) && (
-
+
{canNewVersion && (
- navigate({ route: ROUTE.IMAGE_BUILD_NEW_VERSION, postfix: imageBuildId })}>
- {t('Rebuild')}
-
+
+ navigate({ route: ROUTE.IMAGE_BUILD_NEW_VERSION, postfix: imageBuildId })}
+ >
+ {t('Rebuild')}
+
+
)}
{canPromote && (
- setIsImagePromotionOpen(true)}>{t('Add to catalog')}
+
+ setIsImagePromotionOpen(true)}>{t('Add to catalog')}
+
)}
{canCancel && (
- setIsCancelModalOpen(true)}>{t('Cancel image build')}
+
+ setIsCancelModalOpen(true)}>{t('Cancel image build')}
+
)}
{canDelete && !canCancel && (
- setIsDeleteModalOpen(true)}>{t('Delete image build')}
+
+ setIsDeleteModalOpen(true)}>{t('Delete image build')}
+
)}
-
+
)
}
diff --git a/libs/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildDetailsTab.tsx b/libs/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildDetailsTab.tsx
index b70a0daed..a68b1f7b2 100644
--- a/libs/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildDetailsTab.tsx
+++ b/libs/ui-components/src/components/ImageBuilds/ImageBuildDetails/ImageBuildDetailsTab.tsx
@@ -41,6 +41,7 @@ import TablePagination from '../../Table/TablePagination';
import { getResourceId } from '../../../utils/resource';
import DeleteImagePromotionModal from '../../ImagePromotion/DeleteImagePromotionModal';
import { usePermissionsContext } from '../../common/PermissionsContext';
+import { buildAllDropdownActions } from '../../common/ActionsDropdownList';
import { RESOURCE, VERB } from '../../../types/rbac';
import { useImagePromotionsContext } from '../ImagePromotionsContext';
@@ -65,24 +66,23 @@ const ImagePromotionRow = ({
}) => {
const { t } = useTranslation();
- const actions: IAction[] = [
- ...(canEditPromotions
- ? [
- {
- title: t('Edit image promotion'),
- onClick: onEditClick,
- },
- ]
- : []),
- ...(canDeletePromotions
- ? [
- {
- title: t('Delete image promotion'),
- onClick: onDeleteClick,
- },
- ]
- : []),
- ];
+ 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);
return (
|