Skip to content

Commit

Permalink
[#7024] Platform: Fixed edit number of nodes in AZ section (#7029)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
gaurav061 authored Feb 19, 2021
1 parent f1f0218 commit bccf91f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default class AZSelectorTable extends Component {
} = this.props;
const universeTemplate = _.clone(universeConfigTemplate.data);
const currentAZState = [...this.state.azItemState];
const replicationFactor = currentPlacementStatus.replicationFactor;
const replicationFactor = currentPlacementStatus?.replicationFactor;
const item = currentAZState.find(item => item.value === zoneId);
const originalValue = item.count;
let totalNumNodes = 0;
Expand Down Expand Up @@ -403,10 +403,24 @@ export default class AZSelectorTable extends Component {

UNSAFE_componentWillMount() {
const {
universe: { currentUniverse, universeConfigTemplate },
universe: { currentUniverse, universeConfigTemplate, currentPlacementStatus},
type,
clusterType
} = this.props;

// If currentPlacementStatus is null the fetch it.
if(!currentPlacementStatus) {
const configTemplateCurrentCluster = isNonEmptyObject(universeConfigTemplate.data)
? getClusterByType(universeConfigTemplate.data.clusters, clusterType)
: null;
const placementInfo = this.getGroupWithCounts(universeConfigTemplate.data);
const placementStatusObject = {
numUniqueRegions: placementInfo.uniqueRegions,
numUniqueAzs: placementInfo.uniqueAzs,
replicationFactor: configTemplateCurrentCluster.userIntent.replicationFactor
};
this.props.setPlacementStatus(placementStatusObject);
}
const currentCluster = getPromiseState(universeConfigTemplate).isSuccess()
? getClusterByType(universeConfigTemplate.data.clusters, clusterType)
: {};
Expand Down Expand Up @@ -434,7 +448,7 @@ export default class AZSelectorTable extends Component {
const placementInfo = this.getGroupWithCounts(universeConfigTemplate.data);
const azGroups = placementInfo.groups;
if (
!areUniverseConfigsEqual(
!areUniverseConfigsEqual(
this.props.universe.universeConfigTemplate.data,
universeConfigTemplate.data
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1591,7 +1591,7 @@ export default class ClusterFields extends Component {
<AZPlacementInfo
placementInfo={self.props.universe.currentPlacementStatus}
placementCloud={placementCloud}
providerCode={currentProvider.code}
providerCode={currentProvider?.code}
/>
);
} else if (currentProvider?.code === 'onprem'
Expand Down

0 comments on commit bccf91f

Please sign in to comment.