Skip to content

Commit beaed06

Browse files
committed
Implement federated gateway publisher UI changes and Devportal Restrictions
1 parent 50e56fa commit beaed06

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+2073
-1729
lines changed

portals/devportal/src/main/webapp/source/src/app/components/Apis/Details/ApiConsole/ApiConsole.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ class ApiConsole extends React.Component {
446446
securitySchemeType, username, password, productionAccessToken, sandboxAccessToken, selectedKeyType,
447447
productionApiKey, sandboxApiKey, api, advAuthHeaderValue,
448448
} = this.state;
449-
if (api.advertiseInfo && api.advertiseInfo.advertised) {
449+
if ((api.advertiseInfo && api.advertiseInfo.advertised) || api.gatewayVendor !== 'wso2') {
450450
return advAuthHeaderValue;
451451
}
452452
if (securitySchemeType === 'BASIC') {
@@ -556,7 +556,8 @@ class ApiConsole extends React.Component {
556556
<Root>
557557
<Paper className={classes.paper}>
558558
<Grid container className={classes.grid}>
559-
{!user && (!api.advertiseInfo || !api.advertiseInfo.advertised) && (
559+
{!user && (!api.advertiseInfo || !api.advertiseInfo.advertised)
560+
&& api.gatewayVendor !== 'wso2' && (
560561
<Grid item md={6}>
561562
<Paper className={classes.userNotificationPaper}>
562563
<Typography variant='h5' component='h3'>

portals/devportal/src/main/webapp/source/src/app/components/Apis/Details/GoToTryOut.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ export default function GoToTryOut() {
250250
if (!defaultApplication
251251
|| subscribedApplications.length > 0
252252
|| api.advertiseInfo.advertised
253+
|| api.gatewayVendor !== 'wso2'
253254
|| !user
254255
|| isAsyncAPI
255256
|| isPrototypedAPI) {

portals/devportal/src/main/webapp/source/src/app/components/Apis/Details/index.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ class DetailsLegacy extends React.Component {
587587
open={open}
588588
id='left-menu-overview'
589589
/>
590-
{user && showCredentials && !isSubValidationDisabled && (
590+
{user && showCredentials && !isSubValidationDisabled && api.gatewayVendor === 'wso2' && (
591591
<>
592592

593593
<LeftMenuItem
@@ -606,7 +606,7 @@ class DetailsLegacy extends React.Component {
606606

607607
</>
608608
)}
609-
{showTryout && (api.gatewayVendor === 'wso2'
609+
{showTryout && (api.gatewayType !== 'wso2/apk'
610610
|| (api.type === 'APIPRODUCT' && !api.gatewayVendor)) && (
611611
<>
612612
<Accordion
@@ -665,7 +665,8 @@ class DetailsLegacy extends React.Component {
665665
open={open}
666666
id='left-menu-test'
667667
/>
668-
{api.type !== CONSTANTS.API_TYPES.GRAPHQL && !isAsyncApi && apiChatEnabled && (
668+
{api.type !== CONSTANTS.API_TYPES.GRAPHQL && !isAsyncApi
669+
&& apiChatEnabled && api.gatewayVendor === 'wso2' && (
669670
<LeftMenuItem
670671
text={(
671672
<FormattedMessage

portals/devportal/src/main/webapp/source/src/app/components/Shared/ApiTryOut/AdvertiseDetailsPanel.jsx

Lines changed: 54 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ const AdvertiseDetailsPanel = (props) => {
3838
transport,
3939
securityScheme,
4040
authorizationHeader,
41+
gatewayVendor,
4142
},
4243
} = props;
4344

@@ -112,59 +113,61 @@ const AdvertiseDetailsPanel = (props) => {
112113
/>
113114
</Grid>
114115
</Grid>
115-
<Grid x={12} md={6} className={classes.centerItems}>
116-
<Typography
117-
variant='h6'
118-
component='label'
119-
id='key-type'
120-
color='textSecondary'
121-
className={classes.tryoutHeading}
122-
>
123-
<FormattedMessage
124-
id='Apis.Details.ApiConsole.AdvertiseDetailsPanel.endpoint.heading'
125-
defaultMessage='API Endpoint'
126-
/>
127-
</Typography>
128-
<TextField
129-
fullWidth
130-
select
131-
id='selectedEndpoint'
132-
label={(
133-
<FormattedMessage
134-
defaultMessage='Endpoint type'
135-
id='Apis.Details.ApiConsole.AdvertiseDetailsPanel.endpoint'
136-
/>
137-
)}
138-
value={selectedEndpoint}
139-
name='selectedEndpoint'
140-
onChange={handleChanges}
141-
helperText={(
116+
{gatewayVendor === 'wso2' &&
117+
<Grid x={12} md={6} className={classes.centerItems}>
118+
<Typography
119+
variant='h6'
120+
component='label'
121+
id='key-type'
122+
color='textSecondary'
123+
className={classes.tryoutHeading}
124+
>
142125
<FormattedMessage
143-
defaultMessage='Please select an endpoint type'
144-
id='Apis.Details.ApiConsole.AdvertiseDetailsPanel.endpoint.help'
126+
id='Apis.Details.ApiConsole.AdvertiseDetailsPanel.endpoint.heading'
127+
defaultMessage='API Endpoint'
145128
/>
146-
)}
147-
margin='normal'
148-
variant='outlined'
149-
>
150-
{advertiseInfo.apiExternalProductionEndpoint && (
151-
<MenuItem
152-
value='PRODUCTION'
153-
className={classes.menuItem}
154-
>
155-
Production
156-
</MenuItem>
157-
)}
158-
{advertiseInfo.apiExternalSandboxEndpoint && (
159-
<MenuItem
160-
value='SANDBOX'
161-
className={classes.menuItem}
162-
>
163-
Sandbox
164-
</MenuItem>
165-
)}
166-
</TextField>
167-
</Grid>
129+
</Typography>
130+
<TextField
131+
fullWidth
132+
select
133+
id='selectedEndpoint'
134+
label={(
135+
<FormattedMessage
136+
defaultMessage='Endpoint type'
137+
id='Apis.Details.ApiConsole.AdvertiseDetailsPanel.endpoint'
138+
/>
139+
)}
140+
value={selectedEndpoint}
141+
name='selectedEndpoint'
142+
onChange={handleChanges}
143+
helperText={(
144+
<FormattedMessage
145+
defaultMessage='Please select an endpoint type'
146+
id='Apis.Details.ApiConsole.AdvertiseDetailsPanel.endpoint.help'
147+
/>
148+
)}
149+
margin='normal'
150+
variant='outlined'
151+
>
152+
{advertiseInfo.apiExternalProductionEndpoint && (
153+
<MenuItem
154+
value='PRODUCTION'
155+
className={classes.menuItem}
156+
>
157+
Production
158+
</MenuItem>
159+
)}
160+
{advertiseInfo.apiExternalSandboxEndpoint && (
161+
<MenuItem
162+
value='SANDBOX'
163+
className={classes.menuItem}
164+
>
165+
Sandbox
166+
</MenuItem>
167+
)}
168+
</TextField>
169+
</Grid>
170+
}
168171
{(availableTransports || securitySchemes || authorizationHeader) && (
169172
<Grid x={12} md={6} className={classes.centerItems} style={{ marginTop: '10px' }}>
170173
<MuiAlert severity='info' variant='filled' sx={{ bgcolor: 'background.paper' }}>

portals/devportal/src/main/webapp/source/src/app/components/Shared/ApiTryOut/TryOutController.jsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,8 @@ function TryOutController(props) {
602602
<Root>
603603
<Grid x={12} md={6} className={classes.centerItems}>
604604
<Box>
605-
{securitySchemeType !== 'TEST' && (!api.advertiseInfo || !api.advertiseInfo.advertised) && (
605+
{securitySchemeType !== 'TEST' && (!api.advertiseInfo || !api.advertiseInfo.advertised)
606+
&& api.gatewayVendor === 'wso2' && (
606607
<>
607608
<Box mb={1}>
608609
<Typography variant='body1'>
@@ -638,7 +639,7 @@ function TryOutController(props) {
638639
</>
639640
)}
640641
{((isApiKeyEnabled || isBasicAuthEnabled || isOAuthEnabled) && showSecurityType)
641-
&& (!api.advertiseInfo || !api.advertiseInfo.advertised) && (
642+
&& (!api.advertiseInfo || !api.advertiseInfo.advertised) && api.gatewayVendor === 'wso2' && (
642643
<>
643644
<Typography variant='h5' component='h2' color='textPrimary' className={classes.categoryHeading}>
644645
<FormattedMessage
@@ -714,6 +715,7 @@ function TryOutController(props) {
714715
|| (subscriptions.length > 0 && !isSubValidationDisabled))
715716
&& securitySchemeType !== 'BASIC' && securitySchemeType !== 'TEST'
716717
&& (!api.advertiseInfo || !api.advertiseInfo.advertised)
718+
&& api.gatewayVendor === 'wso2'
717719
&& (
718720
<SelectAppPanel
719721
subscriptions={subscriptions}
@@ -726,7 +728,7 @@ function TryOutController(props) {
726728
/>
727729
)}
728730
{subscriptions && subscriptions.length === 0 && securitySchemeType !== 'TEST'
729-
&& securitySchemeType !== 'BASIC'
731+
&& securitySchemeType !== 'BASIC' && api.gatewayVendor === 'wso2'
730732
&& (!api.advertiseInfo || !api.advertiseInfo.advertised) && !isSubValidationDisabled ? (
731733
<Grid x={8} md={6} className={classes.tokenType} item>
732734
<Box mb={1} alignItems='center'>
@@ -745,7 +747,7 @@ function TryOutController(props) {
745747
</Grid>
746748
) : (
747749
(!ksGenerated && securitySchemeType === 'OAUTH') && (!api.advertiseInfo
748-
|| !api.advertiseInfo.advertised) && (
750+
|| !api.advertiseInfo.advertised) && api.gatewayVendor === 'wso2' && (
749751
<Grid x={8} md={6} className={classes.tokenType} item>
750752
<Box mb={1} alignItems='center'>
751753
<Typography variant='body1'>
@@ -765,7 +767,7 @@ function TryOutController(props) {
765767
</Grid>
766768
)
767769
)}
768-
{(!api.advertiseInfo || !api.advertiseInfo.advertised) ? (
770+
{((!api.advertiseInfo || !api.advertiseInfo.advertised) && api.gatewayVendor === 'wso2') ? (
769771
<Box display='block' justifyContent='center'>
770772
<Grid x={8} md={6} className={classes.tokenType} item>
771773
{securitySchemeType === 'BASIC' && (
@@ -929,7 +931,7 @@ function TryOutController(props) {
929931
api={api}
930932
/>
931933
)}
932-
{(!api.advertiseInfo || !api.advertiseInfo.advertised) && (
934+
{(!api.advertiseInfo || !api.advertiseInfo.advertised) && api.gatewayVendor === 'wso2' && (
933935
<Box display='flex' justifyContent='center' className={classes.gatewayEnvironment}>
934936
<Grid xs={12} md={6} item>
935937
{(environments && environments.length > 0) && (

portals/publisher/src/main/webapp/source/src/app/components/Apis/Apis.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* under the License.
1717
*/
1818

19-
import React, { Suspense, lazy } from 'react';
19+
import React, { Suspense, lazy} from 'react';
2020
import { Route, Switch, Redirect } from 'react-router-dom';
2121
import Progress from 'AppComponents/Shared/Progress';
2222
import AuthManager from 'AppData/AuthManager';
@@ -73,7 +73,7 @@ const Apis = () => {
7373
}
7474
}}
7575
/>
76-
<Route path='/apis/:apiUUID/' render={(props) => <DeferredDetails {...props} isAPIProduct={false} />} />
76+
<Route path='/apis/:apiUUID/' render={(props) =><DeferredDetails {...props} isAPIProduct={false} />} />
7777
<Route
7878
path='/api-products/:apiProdUUID/'
7979
render={(props) => {

portals/publisher/src/main/webapp/source/src/app/components/Apis/Create/AIAPI/APICreateAIAPI.jsx

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import Typography from '@mui/material/Typography';
2121
import Box from '@mui/material/Box';
2222
import Grid from '@mui/material/Grid';
2323
import { FormattedMessage, useIntl } from 'react-intl';
24-
import { usePublisherSettings } from 'AppComponents/Shared/AppContext';
2524
import Stepper from '@mui/material/Stepper';
2625
import Step from '@mui/material/Step';
2726
import StepLabel from '@mui/material/StepLabel';
@@ -80,7 +79,6 @@ function apiInputsReducer(currentState, inputAction) {
8079
export default function ApiCreateAIAPI(props) {
8180
const [wizardStep, setWizardStep] = useState(0);
8281
const { history, multiGateway } = props;
83-
const { data: settings } = usePublisherSettings();
8482

8583
const [apiInputs, inputsDispatcher] = useReducer(apiInputsReducer, {
8684
type: 'ApiCreateAIAPI',
@@ -124,20 +122,12 @@ export default function ApiCreateAIAPI(props) {
124122
const {
125123
name, version, context, endpoint, gatewayType, policies = ["Unlimited"], inputValue, llmProviderId,
126124
} = apiInputs;
127-
let defaultGatewayType;
128-
if (settings && settings.gatewayTypes.length === 1 && settings.gatewayTypes.includes('Regular')) {
129-
defaultGatewayType = 'wso2/synapse';
130-
} else if (settings && settings.gatewayTypes.length === 1 && settings.gatewayTypes.includes('APK')) {
131-
defaultGatewayType = 'wso2/apk';
132-
} else {
133-
defaultGatewayType = 'default';
134-
}
135125

136126
const additionalProperties = {
137127
name,
138128
version,
139129
context,
140-
gatewayType: defaultGatewayType === 'default' ? gatewayType : defaultGatewayType,
130+
gatewayType,
141131
policies,
142132
subtypeConfiguration: {
143133
subtype: 'AIAPI',

0 commit comments

Comments
 (0)