From bb547ad2ebe50bf30cc741f0dd501c0b9cdcb6de Mon Sep 17 00:00:00 2001 From: Mason Herron <46727170+Supplementing@users.noreply.github.com> Date: Thu, 26 Jun 2025 12:53:15 -0600 Subject: [PATCH] [Fleet] Disable reinstall button on custom integrations (#225359) ## Summary Closes #220604 - Added additional prop check to disable reinstall button when an integration is a custom integration ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks N/A --------- Co-authored-by: Elastic Machine --- .../integrations/sections/epm/screens/detail/index.tsx | 9 +++++---- .../epm/screens/detail/settings/reinstall_button.tsx | 5 +++-- .../sections/epm/screens/detail/settings/settings.tsx | 4 +++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/x-pack/platform/plugins/shared/fleet/public/applications/integrations/sections/epm/screens/detail/index.tsx b/x-pack/platform/plugins/shared/fleet/public/applications/integrations/sections/epm/screens/detail/index.tsx index 9fdc40d1973c..f731d3cffbde 100644 --- a/x-pack/platform/plugins/shared/fleet/public/applications/integrations/sections/epm/screens/detail/index.tsx +++ b/x-pack/platform/plugins/shared/fleet/public/applications/integrations/sections/epm/screens/detail/index.tsx @@ -173,7 +173,7 @@ export function Detail() { // edit readme state const [isEditOpen, setIsEditOpen] = useState(false); - const [shouldAllowEdit, setShouldAllowEdit] = useState(false); + const [isCustomPackage, setIsCustomPackage] = useState(false); // Package info state const [packageInfo, setPackageInfo] = useState(null); @@ -301,7 +301,7 @@ export function Detail() { if (packageInfoIsFetchedAfterMount && packageInfoData?.item) { const packageInfoResponse = packageInfoData.item; setPackageInfo(packageInfoResponse); - setShouldAllowEdit( + setIsCustomPackage( (packageInfoResponse?.installationInfo?.install_source && CUSTOM_INTEGRATION_SOURCES.includes( packageInfoResponse.installationInfo?.install_source @@ -578,7 +578,7 @@ export function Detail() { tourOffset={10} > - {shouldAllowEdit && ( + {isCustomPackage && ( diff --git a/x-pack/platform/plugins/shared/fleet/public/applications/integrations/sections/epm/screens/detail/settings/reinstall_button.tsx b/x-pack/platform/plugins/shared/fleet/public/applications/integrations/sections/epm/screens/detail/settings/reinstall_button.tsx index 5a63208d55e9..cec875b60173 100644 --- a/x-pack/platform/plugins/shared/fleet/public/applications/integrations/sections/epm/screens/detail/settings/reinstall_button.tsx +++ b/x-pack/platform/plugins/shared/fleet/public/applications/integrations/sections/epm/screens/detail/settings/reinstall_button.tsx @@ -15,9 +15,10 @@ import { useAuthz, useGetPackageInstallStatus, useInstallPackage } from '../../. type ReinstallationButtonProps = Pick & { installSource: string; + isCustomPackage: boolean; }; export function ReinstallButton(props: ReinstallationButtonProps) { - const { name, title, version, installSource } = props; + const { name, title, version, installSource, isCustomPackage } = props; const canInstallPackages = useAuthz().integrations.installPackages; const installPackage = useInstallPackage(); const getPackageInstallStatus = useGetPackageInstallStatus(); @@ -35,7 +36,7 @@ export function ReinstallButton(props: ReinstallationButtonProps) { iconType="refresh" isLoading={isReinstalling} onClick={handleClickReinstall} - disabled={isUploadedPackage} + disabled={isUploadedPackage || isCustomPackage} > {isReinstalling ? ( ; + isCustomPackage: boolean; } export const SettingsPage: React.FC = memo( - ({ packageInfo, packageMetadata, startServices }: Props) => { + ({ packageInfo, packageMetadata, startServices, isCustomPackage }: Props) => { const authz = useAuthz(); const { name, title, latestVersion, version, keepPoliciesUpToDate } = packageInfo; const [isUpgradingPackagePolicies, setIsUpgradingPackagePolicies] = useState(false); @@ -441,6 +442,7 @@ export const SettingsPage: React.FC = memo( ? packageInfo.installationInfo.install_source : '' } + isCustomPackage={isCustomPackage} />