From ffe06eeb8b58634575c1a745c72cecb1a50aae7d Mon Sep 17 00:00:00 2001 From: Maayan Hadasi <60384172+mguetta1@users.noreply.github.com> Date: Fri, 21 Jun 2024 01:01:48 +0300 Subject: [PATCH] :sparkles: Update business services table to use ActionsColumn (#1921) Related to #1318 ![image](https://github.com/konveyor/tackle2-ui/assets/60384172/c8a51e2e-171d-4637-865b-2f784b213f89) OR ![image](https://github.com/konveyor/tackle2-ui/assets/60384172/cff3f0bf-99dc-41f2-b578-6e119e3b4d9c) --------- Signed-off-by: Maayan Hadasi Signed-off-by: Scott Dickerson Co-authored-by: Scott Dickerson --- client/public/locales/en/translation.json | 1 + .../controls/ControlTableActionButtons.tsx | 48 +++++++++++++++++++ .../business-services/business-services.tsx | 30 +++++++----- 3 files changed, 68 insertions(+), 11 deletions(-) create mode 100644 client/src/app/pages/controls/ControlTableActionButtons.tsx diff --git a/client/public/locales/en/translation.json b/client/public/locales/en/translation.json index bc5733294..fb35753ff 100644 --- a/client/public/locales/en/translation.json +++ b/client/public/locales/en/translation.json @@ -227,6 +227,7 @@ "unlinkTicket": "Unlink from Jira", "noTagsAvailable": "No tags available", "noAssociatedTags": "This tag category has no associated tags.", + "cannotRemoveBusinessServiceAssociatedWithApplication": "Cannot remove a business service associated with application(s)", "updateFailed": "Update failed.", "updateRequestSubmitted": "Update request submitted.", "cancelationFailed": "Cancelation failed.", diff --git a/client/src/app/pages/controls/ControlTableActionButtons.tsx b/client/src/app/pages/controls/ControlTableActionButtons.tsx new file mode 100644 index 000000000..8091dee88 --- /dev/null +++ b/client/src/app/pages/controls/ControlTableActionButtons.tsx @@ -0,0 +1,48 @@ +import React from "react"; +import { useTranslation } from "react-i18next"; +import { controlsWriteScopes, RBAC, RBAC_TYPE } from "@app/rbac"; +import { ActionsColumn, Td } from "@patternfly/react-table"; +import { Button, Tooltip } from "@patternfly/react-core"; +import { PencilAltIcon } from "@patternfly/react-icons"; + +export interface ControlTableActionButtonsProps { + isDeleteEnabled?: boolean; + deleteTooltipMessage?: string; + onEdit: () => void; + onDelete: () => void; +} + +export const ControlTableActionButtons: React.FC< + ControlTableActionButtonsProps +> = ({ + isDeleteEnabled = false, + deleteTooltipMessage = "", + onEdit, + onDelete, +}) => { + const { t } = useTranslation(); + return ( + + + + + + @@ -263,9 +269,11 @@ export const BusinessServices: React.FC = () => { {businessService.owner?.name} - setCreateUpdateModalState(businessService) }