Skip to content

Commit

Permalink
[#7024] Platform: Fixed edit number of nodes in Availability Zones se…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
gaurav061 committed Jan 29, 2021
1 parent cb7d598 commit 9b4f091
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,26 @@ export default class AZSelectorTable extends Component {

handleAZNodeCountChange(zoneId, value) {
const {
universe: { currentPlacementStatus, universeConfigTemplate }
universe: { currentPlacementStatus, universeConfigTemplate },
clusterType
} = this.props;
console.log("This props currentPlacementStatus", currentPlacementStatus)
const universeTemplate = _.clone(universeConfigTemplate.data);
const currentAZState = [...this.state.azItemState];
const replicationFactor = currentPlacementStatus.replicationFactor;
const replicationFactor = currentPlacementStatus?.replicationFactor;
// if (!replicationFactor) {
// const configTemplateCurrentCluster = isNonEmptyObject(universeTemplate)
// ? getClusterByType(universeTemplate.clusters, clusterType)
// : null;
// const placementInfo = this.getGroupWithCounts(universeTemplate);
// const placementStatusObject = {
// numUniqueRegions: placementInfo.uniqueRegions,
// numUniqueAzs: placementInfo.uniqueAzs,
// replicationFactor: configTemplateCurrentCluster.userIntent.replicationFactor
// };
// this.props.setPlacementStatus(placementStatusObject);
// console.log("CurrentPlacementStatus -- ", currentPlacementStatus);
// }
const item = currentAZState.find(item => item.value === zoneId);
const originalValue = item.count;
let totalNumNodes = 0;
Expand Down Expand Up @@ -397,10 +412,23 @@ export default class AZSelectorTable extends Component {

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

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 @@ -428,7 +456,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 @@ -1534,7 +1534,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 9b4f091

Please sign in to comment.