Skip to content

Commit bccf91f

Browse files
authored
[yugabyte#7024] Platform: Fixed edit number of nodes in AZ section (yugabyte#7029)
Description: The user was not able to edit the numbers of nodes from the AZ section while editing the universe. The issue was due to an undefined variable on the initial rendering. Added the API call to set the context for the number of nodes in the AZ section. Test scenario: Able to modify the number of nodes from the AZ section while editing the universe.
1 parent f1f0218 commit bccf91f

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

managed/ui/src/components/universes/UniverseForm/AZSelectorTable.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export default class AZSelectorTable extends Component {
113113
} = this.props;
114114
const universeTemplate = _.clone(universeConfigTemplate.data);
115115
const currentAZState = [...this.state.azItemState];
116-
const replicationFactor = currentPlacementStatus.replicationFactor;
116+
const replicationFactor = currentPlacementStatus?.replicationFactor;
117117
const item = currentAZState.find(item => item.value === zoneId);
118118
const originalValue = item.count;
119119
let totalNumNodes = 0;
@@ -403,10 +403,24 @@ export default class AZSelectorTable extends Component {
403403

404404
UNSAFE_componentWillMount() {
405405
const {
406-
universe: { currentUniverse, universeConfigTemplate },
406+
universe: { currentUniverse, universeConfigTemplate, currentPlacementStatus},
407407
type,
408408
clusterType
409409
} = this.props;
410+
411+
// If currentPlacementStatus is null the fetch it.
412+
if(!currentPlacementStatus) {
413+
const configTemplateCurrentCluster = isNonEmptyObject(universeConfigTemplate.data)
414+
? getClusterByType(universeConfigTemplate.data.clusters, clusterType)
415+
: null;
416+
const placementInfo = this.getGroupWithCounts(universeConfigTemplate.data);
417+
const placementStatusObject = {
418+
numUniqueRegions: placementInfo.uniqueRegions,
419+
numUniqueAzs: placementInfo.uniqueAzs,
420+
replicationFactor: configTemplateCurrentCluster.userIntent.replicationFactor
421+
};
422+
this.props.setPlacementStatus(placementStatusObject);
423+
}
410424
const currentCluster = getPromiseState(universeConfigTemplate).isSuccess()
411425
? getClusterByType(universeConfigTemplate.data.clusters, clusterType)
412426
: {};
@@ -434,7 +448,7 @@ export default class AZSelectorTable extends Component {
434448
const placementInfo = this.getGroupWithCounts(universeConfigTemplate.data);
435449
const azGroups = placementInfo.groups;
436450
if (
437-
!areUniverseConfigsEqual(
451+
!areUniverseConfigsEqual(
438452
this.props.universe.universeConfigTemplate.data,
439453
universeConfigTemplate.data
440454
)

managed/ui/src/components/universes/UniverseForm/ClusterFields.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,7 @@ export default class ClusterFields extends Component {
15911591
<AZPlacementInfo
15921592
placementInfo={self.props.universe.currentPlacementStatus}
15931593
placementCloud={placementCloud}
1594-
providerCode={currentProvider.code}
1594+
providerCode={currentProvider?.code}
15951595
/>
15961596
);
15971597
} else if (currentProvider?.code === 'onprem'

0 commit comments

Comments
 (0)