Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #SAT-30369 - Registration - Show info for Pull provider #936

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixes #38151 - Registration - Show info for Pull provider
  • Loading branch information
stejskalleos committed Jan 20, 2025
commit 72cea1873cc5e0240b8d2de31701c9d80bb4b8f3
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,
@@ -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) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: The if branching might look weird at first glance, but it's because of:

valueFromParam can be true, false or undefined
value can be 'true', 'false', '' or undefined.

It was fun.

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')}
@@ -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>
);

Loading