Skip to content
Closed
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const OperatorCheckbox = ({
(sb) => !!bundles.find((b) => b.id === sb)?.operators?.includes(operatorId),
);

const isChecked = values.selectedOperators.includes(operatorId) || isInBundle;
const isChecked = values.selectedOperators.includes(operatorId);

const parentOperator = preflightRequirements?.operators?.find((op) =>
op.dependencies?.includes(operatorId),
Expand Down
19 changes: 18 additions & 1 deletion libs/ui-lib/lib/ocm/components/clusterWizard/OperatorsSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
handleApiError,
LoadingState,
OperatorsValues,
selectOlmOperators,
singleClusterOperators,
useAlerts,
useStateSafely,
Expand All @@ -36,7 +37,23 @@ const OperatorsSelect = ({
const [isExpanded, setIsExpanded] = React.useState(false);
const [supportedOperators, setSupportedOperators] = useStateSafely<string[]>([]);
const isSingleClusterFeatureEnabled = useFeature('ASSISTED_INSTALLER_SINGLE_CLUSTER_FEATURE');
const { values } = useFormikContext<OperatorsValues>();
const { values, setFieldValue } = useFormikContext<OperatorsValues>();

// Sync selected operators with monitored operators from the cluster
// If there's more than 1 monitored OLM operator, it means the user has previously selected operators
// and we should restore their selection. If there's 0 or 1, it's a fresh page visit.
React.useEffect(() => {
const olmOperators = selectOlmOperators(cluster);
if (olmOperators.length > 0) {
const monitoredOperatorNames = olmOperators
.map((op) => op.name)
.filter((name): name is string => !!name);
void setFieldValue('selectedOperators', monitoredOperatorNames);
}
// Only run on initial mount
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
Comment thread
ElayAharoni marked this conversation as resolved.

React.useEffect(() => {
const fetchSupportedOperators = async () => {
try {
Expand Down
Loading