Skip to content

Commit

Permalink
Fixes #38151 - Registration - Show info for Pull provider
Browse files Browse the repository at this point in the history
  • Loading branch information
stejskalleos authored and adamruzicka committed Jan 21, 2025
1 parent 6eaee77 commit ca0645a
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions webpack/react_app/components/RegistrationExtension/RexPull.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/* eslint-disable camelcase */
import React from 'react';
import PropTypes from 'prop-types';

import { translate as __ } from 'foremanReact/common/I18n';
import LabelIcon from 'foremanReact/components/common/LabelIcon';
import { Alert } from 'patternfly-react';

import {
FormGroup,
Expand All @@ -23,6 +25,25 @@ const options = (value = '') => {
);
};

const pullWarning = (
<Alert type="info" isInline style={{ marginTop: '10px' }}>
{__(
'Please make sure that the Smart Proxy is configured correctly for the Pull provider.'
)}
</Alert>
);

function showPullWarning(valueFromParam, value) {
if (value === 'true') {
return pullWarning;
}
if (valueFromParam && (value === undefined || value === '')) {
return pullWarning;
}

return null;
}

const RexPull = ({ isLoading, onChange, pluginValues, configParams }) => (
<FormGroup
label={__('REX pull mode')}
Expand All @@ -45,9 +66,13 @@ const RexPull = ({ isLoading, onChange, pluginValues, configParams }) => (
id="registration_setup_remote_execution_pull"
isDisabled={isLoading}
>
{/* eslint-disable-next-line camelcase */
options(configParams?.host_registration_remote_execution_pull)}
{options(configParams?.host_registration_remote_execution_pull)}
</FormSelect>

{showPullWarning(
configParams?.host_registration_remote_execution_pull,
pluginValues.setupRemoteExecutionPull
)}
</FormGroup>
);

Expand Down

0 comments on commit ca0645a

Please sign in to comment.