From ef551da7c2353e7d8fdce3e15e05d3247edc640b Mon Sep 17 00:00:00 2001 From: Ugo Palatucci Date: Wed, 22 Mar 2023 12:50:55 +0100 Subject: [PATCH] Bug 2177091: hide edit buttons on catalog drawer --- .../HardwareDevices/HardwareDeviceTitle.tsx | 12 +++++++++-- .../HardwareDevices/HardwareDevices.tsx | 21 +++++++++++++++---- .../TemplatesCatalogDrawerPanel.tsx | 2 +- 3 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/utils/components/HardwareDevices/HardwareDeviceTitle.tsx b/src/utils/components/HardwareDevices/HardwareDeviceTitle.tsx index a73f0ec1c..1126e4263 100644 --- a/src/utils/components/HardwareDevices/HardwareDeviceTitle.tsx +++ b/src/utils/components/HardwareDevices/HardwareDeviceTitle.tsx @@ -1,4 +1,4 @@ -import * as React from 'react'; +import React, { FC } from 'react'; import { useKubevirtTranslation } from '@kubevirt-utils/hooks/useKubevirtTranslation'; import { Button, DescriptionListTerm } from '@patternfly/react-core'; @@ -7,12 +7,20 @@ import { PencilAltIcon } from '@patternfly/react-icons'; type HardwareDeviceTitleProps = { title: string; canEdit: boolean; + hideEdit?: boolean; onClick?: () => void; }; -const HardwareDeviceTitle: React.FC = ({ title, canEdit, onClick }) => { +const HardwareDeviceTitle: FC = ({ + title, + canEdit, + hideEdit = false, + onClick, +}) => { const { t } = useKubevirtTranslation(); + if (hideEdit) return {title}; + return (