Skip to content

Commit

Permalink
[PLAT-3455] - feat : Display releases according to region architecture
Browse files Browse the repository at this point in the history
Summary: Fetching  supporting releases as per region architecture

Test Plan:
Tested Manually

1. Tested in Create Universe/Create Read Replica.
2. Tested in Edit Universe/Edit read replica

Reviewers: asathyan, cpadinjareveettil, ssutar, kkannan

Reviewed By: kkannan

Subscribers: jenkins-bot, ui

Differential Revision: https://phabricator.dev.yugabyte.com/D17224
  • Loading branch information
Lingeshwar committed May 31, 2022
1 parent eeb799c commit 703a2fc
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
10 changes: 10 additions & 0 deletions managed/ui/src/actions/universe.js
Original file line number Diff line number Diff line change
Expand Up @@ -805,3 +805,13 @@ export async function validateGFlags(dbVersion, payload) {
throw e.response.data;
}
}

//Fetch releases by provider
export async function fetchSupportedReleases(pUUID) {
const cUUID = localStorage.getItem('customerId');
try {
return await axios.get(`${ROOT_URL}/customers/${cUUID}/providers/${pUUID}/releases`);
} catch (e) {
throw e.response.data;
}
}
17 changes: 14 additions & 3 deletions managed/ui/src/components/universes/UniverseForm/ClusterFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import {
import pluralize from 'pluralize';
import { AZURE_INSTANCE_TYPE_GROUPS } from '../../../redesign/universe/wizard/fields/InstanceTypeField/InstanceTypeField';
import { isEphemeralAwsStorageInstance } from '../UniverseDetail/UniverseDetail';
import { fetchSupportedReleases } from '../../../actions/universe';

// Default instance types for each cloud provider
const DEFAULT_INSTANCE_TYPE_MAP = {
Expand Down Expand Up @@ -142,7 +143,8 @@ const initialState = {
useSystemd: false,
customizePorts: false,
// Geo-partitioning settings.
defaultRegion: ''
defaultRegion: '',
supportedReleases: []
};

const portValidation = (value) => (value && value < 65536 ? undefined : 'Invalid Port');
Expand Down Expand Up @@ -1420,16 +1422,22 @@ export default class ClusterFields extends Component {
this.storageTypeChanged(DEFAULT_STORAGE_TYPES[providerData.code.toUpperCase()]);
};

providerChanged = (value) => {
providerChanged = async (value) => {
const {
updateFormField,
clusterType,
type,
universe: {
currentUniverse: { data }
}
} = this.props;
const providerUUID = value;
const currentProviderData = this.getCurrentProvider(value) || {};
if (type?.toUpperCase() === 'CREATE' && clusterType === 'primary') {
const releaseArr = (await fetchSupportedReleases(value))?.data;
this.setState({ supportedReleases: releaseArr, ybSoftwareVersion: releaseArr[0] });
updateFormField(`${clusterType}.ybSoftwareVersion`, releaseArr[0]);
}

const targetCluster =
clusterType !== 'primary'
Expand Down Expand Up @@ -2428,7 +2436,10 @@ export default class ClusterFields extends Component {
}
}

const softwareVersionOptions = softwareVersions.map((item, idx) => (
const softwareVersionOptions = (type?.toUpperCase() === 'CREATE' && clusterType === 'primary'
? this.state.supportedReleases
: softwareVersions
)?.map((item, idx) => (
<option key={idx} value={item}>
{item}
</option>
Expand Down

0 comments on commit 703a2fc

Please sign in to comment.