[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 <elasticmachine@users.noreply.github.com>
This commit is contained in:
Mason Herron 2025-06-26 12:53:15 -06:00 committed by GitHub
parent 5b4a65b98c
commit bb547ad2eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 11 additions and 7 deletions

View file

@ -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<PackageInfo | null>(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}
>
<EuiFlexGroup justifyContent="center" alignItems="center" gutterSize="s">
{shouldAllowEdit && (
{isCustomPackage && (
<EuiFlexItem grow={false}>
<EditIntegrationButton
handleEditIntegrationClick={handleEditIntegrationClick}
@ -641,7 +641,7 @@ export function Detail() {
versionLabel,
versionOptions,
handleEditIntegrationClick,
shouldAllowEdit,
isCustomPackage,
]
);
@ -859,6 +859,7 @@ export function Detail() {
packageInfo={packageInfo}
packageMetadata={packageInfoData?.metadata}
startServices={services}
isCustomPackage={isCustomPackage}
/>
</Route>
<Route path={INTEGRATIONS_ROUTING_PATHS.integration_details_assets}>

View file

@ -15,9 +15,10 @@ import { useAuthz, useGetPackageInstallStatus, useInstallPackage } from '../../.
type ReinstallationButtonProps = Pick<PackageInfo, 'name' | 'title' | 'version'> & {
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 ? (
<FormattedMessage

View file

@ -85,10 +85,11 @@ interface Props {
packageInfo: PackageInfo;
packageMetadata?: PackageMetadata;
startServices: Pick<FleetStartServices, 'analytics' | 'i18n' | 'theme'>;
isCustomPackage: boolean;
}
export const SettingsPage: React.FC<Props> = memo(
({ packageInfo, packageMetadata, startServices }: Props) => {
({ packageInfo, packageMetadata, startServices, isCustomPackage }: Props) => {
const authz = useAuthz();
const { name, title, latestVersion, version, keepPoliciesUpToDate } = packageInfo;
const [isUpgradingPackagePolicies, setIsUpgradingPackagePolicies] = useState<boolean>(false);
@ -441,6 +442,7 @@ export const SettingsPage: React.FC<Props> = memo(
? packageInfo.installationInfo.install_source
: ''
}
isCustomPackage={isCustomPackage}
/>
</div>
</EuiFlexItem>