webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVReassignActivationKeysForm.js in katello-4.8.4 vs webpack/scenes/ContentViews/Details/Versions/Delete/RemoveSteps/CVReassignActivationKeysForm.js in katello-4.9.0.rc1
- old
+ new
@@ -8,10 +8,11 @@
import getContentViews from '../../../../ContentViewsActions';
import { selectContentViewError, selectContentViews, selectContentViewStatus } from '../../../../ContentViewSelectors';
import AffectedActivationKeys from '../affectedActivationKeys';
import DeleteContext from '../DeleteContext';
import ContentViewSelect from '../../../../components/ContentViewSelect/ContentViewSelect';
+import { getCVPlaceholderText, shouldDisableCVSelect } from '../../../../components/ContentViewSelect/helpers';
const CVReassignActivationKeysForm = () => {
const dispatch = useDispatch();
const contentViewsInEnvResponse = useSelector(selectContentViews);
const contentViewsInEnvStatus = useSelector(selectContentViewStatus);
@@ -85,31 +86,43 @@
setSelectedCVForAK(selection);
setSelectedCVNameForAK(fetchSelectedCVName(selection));
setCVSelectOpen(false);
};
+ const placeholderText = getCVPlaceholderText({
+ contentSourceId: null,
+ environments: selectedEnvForAK,
+ contentViewsStatus: contentViewsInEnvStatus,
+ cvSelectOptions,
+ });
+
+ const disableCVSelect = shouldDisableCVSelect({
+ contentSourceId: null,
+ environments: selectedEnvForAK,
+ contentViewsStatus: contentViewsInEnvStatus,
+ cvSelectOptions,
+ });
+
return (
<>
<EnvironmentPaths
userCheckedItems={selectedEnvForAK}
setUserCheckedItems={setSelectedEnvForAK}
publishing={false}
headerText={__('Select lifecycle environment')}
multiSelect={false}
/>
- {!cvInEnvLoading && selectedEnvForAK.length > 0 &&
- <ContentViewSelect
- selections={selectedCVForAK}
- onSelect={onSelect}
- onClear={onClear}
- isOpen={cvSelectOpen}
- isDisabled={cvSelectOptions.length === 0}
- onToggle={isExpanded => setCVSelectOpen(isExpanded)}
- placeholderText={(cvSelectOptions.length === 0) ? __('No content views available') : __('Select a content view')}
- >
- {cvSelectOptions}
- </ContentViewSelect>
- }
+ <ContentViewSelect
+ selections={selectedCVForAK}
+ onSelect={onSelect}
+ onClear={onClear}
+ isOpen={cvSelectOpen}
+ isDisabled={disableCVSelect}
+ onToggle={isExpanded => setCVSelectOpen(isExpanded)}
+ placeholderText={placeholderText}
+ >
+ {cvSelectOptions}
+ </ContentViewSelect>
<ExpandableSection
toggleText={showActivationKeys ?
'Hide activation keys' :
'Show activation keys'}
onToggle={expanded => setShowActivationKeys(expanded)}