Skip to content

Commit

Permalink
Merge branch 'wso2:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Kirishikesan committed Mar 22, 2024
2 parents 5a81750 + 2d8c1b3 commit 7e02086
Show file tree
Hide file tree
Showing 46 changed files with 1,719 additions and 1,477 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>org.wso2.carbon.apimgt.ui</groupId>
<artifactId>apim.ui.apps</artifactId>
<packaging>pom</packaging>
<version>9.1.13-SNAPSHOT</version>
<version>9.1.22-SNAPSHOT</version>
<name>WSO2 API Manager UI - Parent</name>
<url>https://wso2.org</url>

Expand Down
2 changes: 1 addition & 1 deletion portals/admin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt.ui</groupId>
<artifactId>apim.ui.apps</artifactId>
<version>9.1.13-SNAPSHOT</version>
<version>9.1.22-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion portals/devportal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<parent>
<groupId>org.wso2.carbon.apimgt.ui</groupId>
<artifactId>apim.ui.apps</artifactId>
<version>9.1.13-SNAPSHOT</version>
<version>9.1.22-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,16 @@ class Credentials extends React.Component {
const { api, applicationsAvailable } = this.context;
const { subscriptionRequest } = this.state;
const newSubscriptionRequest = { ...subscriptionRequest, apiId: api.id };
const throttlingPolicyList = api.tiers;
const throttlingPolicyList = api.tiers.sort((a, b) => {
// Sort by 'COMMERCIAL' tier plan first
if (a.tierPlan === 'COMMERCIAL' && b.tierPlan !== 'COMMERCIAL') {
return -1;
} else if (a.tierPlan !== 'COMMERCIAL' && b.tierPlan === 'COMMERCIAL') {
return 1;
}
// For options within the same tier plan, sort alphabetically
return a.tierName.localeCompare(b.tierName);
});
if (throttlingPolicyList && throttlingPolicyList[0]) {
newSubscriptionRequest.throttlingPolicy = throttlingPolicyList[0].tierName;
}
Expand Down Expand Up @@ -512,9 +521,7 @@ class Credentials extends React.Component {
applicationsAvailable={applicationsAvailable}
subscriptionRequest={subscriptionRequest}
throttlingPolicyList={throttlingPolicyList}
updateSubscriptionRequest={
this.updateSubscriptionRequest
}
updateSubscriptionRequest={this.updateSubscriptionRequest}
renderSmall
/>
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,22 +168,9 @@ const subscribeToApi = (props) => {
renderSmall,
} = props;

let sortedThrottlingPolicyList = throttlingPolicyList;

useEffect(() => {
sortedThrottlingPolicyList = throttlingPolicyList.sort((a, b) => {
// Sort by 'COMMERCIAL' tier plan first
if (a.tierPlan === 'COMMERCIAL' && b.tierPlan !== 'COMMERCIAL') {
return -1;
} else if (a.tierPlan !== 'COMMERCIAL' && b.tierPlan === 'COMMERCIAL') {
return 1;
}

// For options within the same tier plan, sort alphabetically
return a.tierName.localeCompare(b.tierName);
});
if (throttlingPolicyList && throttlingPolicyList[0]) {
setPolicySelected(sortedThrottlingPolicyList[0]);
setPolicySelected(throttlingPolicyList[0]);
}
}, [throttlingPolicyList]);

Expand Down Expand Up @@ -253,7 +240,7 @@ const subscribeToApi = (props) => {
</FormHelperText>
</FormControl>
)}
{sortedThrottlingPolicyList && (
{throttlingPolicyList && (
<FormControl
variant="standard"
className={classNames(classes.FormControl, classes.smallDisplayFix, {
Expand All @@ -270,7 +257,7 @@ const subscribeToApi = (props) => {
<Autocomplete
id='application-policy'
aria-describedby='policies-helper-text'
options={sortedThrottlingPolicyList}
options={throttlingPolicyList}
disableClearable
value={policySelected}
getOptionLabel={(option) => option.tierName}
Expand Down Expand Up @@ -315,10 +302,10 @@ const subscribeToApi = (props) => {
id='Shared.AppsAndKeys.SubscribeToApi.available.policies'
defaultMessage='Available Policies -'
/>{' '}
{sortedThrottlingPolicyList.map((policy, index) => (
{throttlingPolicyList.map((policy, index) => (
<span key={policy.tierName}>
{policy.tierName}
{index !== sortedThrottlingPolicyList.length - 1 && <span>,</span>}
{index !== throttlingPolicyList.length - 1 && <span>,</span>}
</span>
))}
</FormHelperText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,24 +56,7 @@ const classes = {
iconButton: `${PREFIX}-iconButton`
};

const Root = styled('div')((
{
theme
}
) => ({
[`& .${classes.button}`]: {
margin: theme.spacing(3),
color: theme.palette.getContrastText(theme.palette.background.default),
display: 'flex',
alignItems: 'center',
fontSize: '11px',
cursor: 'pointer',
'& span': {
paddingLeft: 6,
display: 'inline-block',
},
},

const Root = styled('div')(({ theme }) => ({
[`& .${classes.inputWrapper}`]: {
display: 'flex',
flexDirection: 'row',
Expand Down Expand Up @@ -451,7 +434,7 @@ class ViewKeys extends React.Component {
<Button
variant='contained'
color='primary'
className={classes.button}
sx={{ mt: 1 }}
onClick={() => this.handleSecretRegenerate(consumerKey, keyType, keyMappingId, selectedTab)}
disabled={!isUserOwner}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import React from 'react';
import { styled } from '@mui/material/styles';
import PropTypes from 'prop-types';
import IconButton from '@mui/material/IconButton';
import Tooltip from '@mui/material/Tooltip';
import FileCopy from '@mui/icons-material/FileCopy';
import Typography from '@mui/material/Typography';
Expand Down
Loading

0 comments on commit 7e02086

Please sign in to comment.