import * as React from 'react'; import { DescriptionList, DescriptionListDescription, DescriptionListGroup, DescriptionListTerm, Flex, FlexItem, } from '@patternfly/react-core'; import HelpPopover from '../../../../../src/components/HelpPopover'; import usePACState, { PACState } from '../../../../hooks/usePACState'; import { ComponentKind } from '../../../../types'; import ComponentPACStateLabel from '../../../CustomizedPipeline/ComponentPACStateLabel'; type ComponentBuildSettingsProps = { component: ComponentKind; }; export const getHelpPopoverText = (pacState) => { return pacState === PACState.disabled ? 'Trigger a new build manually from the component’s action menu. To enable an automatic trigger with every commit, upgrade to the Custom build pipeline plan.' : 'A new build pipeline run is automatically triggered with every commit to the source code.'; }; export const getBuildTriggerText = (pacState) => { return pacState === PACState.disabled ? 'Manual' : 'Automatic'; }; const ComponentBuildSettings: React.FC> = ({ component, }) => { const pacState = usePACState(component); const helpPopoverText = getHelpPopoverText(pacState); const buildTriggerText = getBuildTriggerText(pacState); return ( <> Build pipeline plan Build trigger {buildTriggerText} ); }; export default React.memo(ComponentBuildSettings);