From 7680aeec2772b01991e55daf2ab6e58985ebabde Mon Sep 17 00:00:00 2001 From: Ian Bolton Date: Tue, 16 Apr 2024 11:08:52 -0400 Subject: [PATCH] =?UTF-8?q?:bug:=20MTA-1997=20fix=20for=20column=20layout?= =?UTF-8?q?=20changing=20widths=20upon=20creation/de=E2=80=A6=20(#1853)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit …letion (#1807) Resolves https://issues.redhat.com/browse/MTA-1997 Match space allocation between column headers and rows to prevent layout shift when the first / last item is added / removed from the table. Before: https://github.com/konveyor/tackle2-ui/assets/11218376/e5564ea6-e78c-4fc0-92f2-dea496d6b88f After: https://github.com/konveyor/tackle2-ui/assets/11218376/7d12ddbd-c46a-4b06-970d-876fe2f90421 - Also addresses mishandling of TBody resulting in several Tbody elements rendered for each row in the table. Signed-off-by: Ian Bolton --- .../app/components/AppTableActionButtons.tsx | 51 ++++--- .../applications-table/applications-table.tsx | 14 +- .../stakeholder-groups/stakeholder-groups.tsx | 124 ++++++++-------- .../controls/stakeholders/stakeholders.tsx | 136 +++++++++--------- client/src/app/pages/controls/tags/tags.tsx | 29 ++-- 5 files changed, 181 insertions(+), 173 deletions(-) diff --git a/client/src/app/components/AppTableActionButtons.tsx b/client/src/app/components/AppTableActionButtons.tsx index 9e01ceaf72..550f196568 100644 --- a/client/src/app/components/AppTableActionButtons.tsx +++ b/client/src/app/components/AppTableActionButtons.tsx @@ -1,8 +1,9 @@ import React from "react"; import { useTranslation } from "react-i18next"; -import { Button, Flex, FlexItem } from "@patternfly/react-core"; +import { Button } from "@patternfly/react-core"; import { applicationsWriteScopes, RBAC, RBAC_TYPE } from "@app/rbac"; import { ConditionalTooltip } from "./ConditionalTooltip"; +import { Td } from "@patternfly/react-table"; export interface AppTableActionButtonsProps { isDeleteEnabled?: boolean; @@ -24,34 +25,32 @@ export const AppTableActionButtons: React.FC = ({ allowedPermissions={applicationsWriteScopes} rbacType={RBAC_TYPE.Scope} > - - + + + + + - - - - - - - + + ); }; diff --git a/client/src/app/pages/applications/applications-table/applications-table.tsx b/client/src/app/pages/applications/applications-table/applications-table.tsx index 0193627b8f..78e71d5d95 100644 --- a/client/src/app/pages/applications/applications-table/applications-table.tsx +++ b/client/src/app/pages/applications/applications-table/applications-table.tsx @@ -844,17 +844,17 @@ export const ApplicationsTable: React.FC = () => { - + - - - + + + - + @@ -890,7 +890,7 @@ export const ApplicationsTable: React.FC = () => { rowIndex={rowIndex} > @@ -933,7 +933,7 @@ export const ApplicationsTable: React.FC = () => { /> diff --git a/client/src/app/pages/controls/stakeholder-groups/stakeholder-groups.tsx b/client/src/app/pages/controls/stakeholder-groups/stakeholder-groups.tsx index ae388d4b7f..2d9bf3f1f6 100644 --- a/client/src/app/pages/controls/stakeholder-groups/stakeholder-groups.tsx +++ b/client/src/app/pages/controls/stakeholder-groups/stakeholder-groups.tsx @@ -225,9 +225,13 @@ export const StakeholderGroups: React.FC = () => { - - - + + + + @@ -252,71 +256,71 @@ export const StakeholderGroups: React.FC = () => { } numRenderedColumns={numRenderedColumns} > - {currentPageItems?.map((stakeholderGroup, rowIndex) => { - return ( - - - - - {stakeholderGroup.name} - - + {currentPageItems?.map((stakeholderGroup, rowIndex) => { + return ( + <> + + - {stakeholderGroup.description} - - - {stakeholderGroup.stakeholders?.length} - - + + {stakeholderGroup.name} + + + {stakeholderGroup.description} + + + {stakeholderGroup.stakeholders?.length} + setCreateUpdateModalState(stakeholderGroup) } onDelete={() => deleteRow(stakeholderGroup)} /> - - - - {isCellExpanded(stakeholderGroup) ? ( - - - - - - - - {t("terms.member(s)")} - - {!!stakeholderGroup.stakeholders?.length && ( - - {stakeholderGroup.stakeholders - ?.map((f) => f.name) - .join(", ")} - - )} - - - - + - ) : null} - - ); - })} + {isCellExpanded(stakeholderGroup) ? ( + + + + + + + + {t("terms.member(s)")} + + {!!stakeholderGroup.stakeholders?.length && ( + + {stakeholderGroup.stakeholders + ?.map((f) => f.name) + .join(", ")} + + )} + + + + + + ) : null} + + ); + })} + { - - - - + + + + + @@ -261,75 +265,77 @@ export const Stakeholders: React.FC = () => { } numRenderedColumns={numRenderedColumns} > - {currentPageItems?.map((stakeholder, rowIndex) => { - return ( - - - - - {stakeholder.email} - - - {stakeholder.name} - - - {stakeholder.jobFunction?.name} - - + {currentPageItems?.map((stakeholder, rowIndex) => { + return ( + <> + + - {stakeholder.stakeholderGroups?.length} - - + + {stakeholder.email} + + + {stakeholder.name} + + + {stakeholder.jobFunction?.name} + + + {stakeholder.stakeholderGroups?.length} + setCreateUpdateModalState(stakeholder) } onDelete={() => deleteRow(stakeholder)} /> - - - - {isCellExpanded(stakeholder) ? ( - - - - - - - - {t("terms.group(s)")} - - {!!stakeholder.stakeholderGroups?.length && ( - - {stakeholder.stakeholderGroups - ?.map((f) => f.name) - .join(", ")} - - )} - - - - + - ) : null} - - ); - })} + {isCellExpanded(stakeholder) ? ( + + + + + + + + {t("terms.group(s)")} + + {!!stakeholder.stakeholderGroups?.length && ( + + {stakeholder.stakeholderGroups + ?.map((f) => f.name) + .join(", ")} + + )} + + + + + + ) : null} + + ); + })} + { - - - - + + + + + @@ -379,20 +380,18 @@ export const Tags: React.FC = () => { > {tagCategory.tags?.length || 0} - - setTagCategoryModalState(tagCategory)} - onDelete={() => setTagCategoryToDelete(tagCategory)} - /> - + setTagCategoryModalState(tagCategory)} + onDelete={() => setTagCategoryToDelete(tagCategory)} + /> {isCellExpanded(tagCategory) && ( - + {hasTags ? (