|
|
|
|
@@ -8,7 +8,10 @@ import { getIn, useFormikContext } from 'formik';
|
|
|
|
|
import NotConfigured from '../NotConfiguredPanel';
|
|
|
|
|
import { Table, TableFooter, TableRow } from '@material-ui/core';
|
|
|
|
|
import { Cluster } from '../../constants/Cluster';
|
|
|
|
|
import { ExternalCommonApiGatewayUrl } from '../../constants/CommonApiGatewayUrl';
|
|
|
|
|
import {
|
|
|
|
|
ExternalAuthEnabledMap,
|
|
|
|
|
ExternalCommonApiGatewayUrl,
|
|
|
|
|
} from '../../constants/CommonApiGatewayUrl';
|
|
|
|
|
import { InternalCommonApiGatewayUrl } from '../../constants/CommonApiGatewayUrl';
|
|
|
|
|
import { string } from 'yup';
|
|
|
|
|
import { FormikCheckbox } from '../../components/common/FormikCheckbox';
|
|
|
|
|
@@ -54,19 +57,7 @@ const ExternalCommonApiGatewayUrlMap = {
|
|
|
|
|
[Cluster.IAPL_PROD]: ExternalCommonApiGatewayUrl.IAPL_PROD,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const InternalCommonApiGatewayUrlMap = {
|
|
|
|
|
[Cluster.LENDING_NP]: InternalCommonApiGatewayUrl.LENDING_NP,
|
|
|
|
|
[Cluster.LENDING_PROD]: InternalCommonApiGatewayUrl.LENDING_PROD,
|
|
|
|
|
[Cluster.PAY_NP]: InternalCommonApiGatewayUrl.PAY_NP,
|
|
|
|
|
[Cluster.PAY_PROD]: InternalCommonApiGatewayUrl.PAY_PROD,
|
|
|
|
|
[Cluster.GI_NP]: InternalCommonApiGatewayUrl.GI_NP,
|
|
|
|
|
[Cluster.GI_PROD]: InternalCommonApiGatewayUrl.GI_PROD,
|
|
|
|
|
[Cluster.SA_NP]: InternalCommonApiGatewayUrl.SA_NP,
|
|
|
|
|
[Cluster.SA_PROD]: InternalCommonApiGatewayUrl.SA_PROD,
|
|
|
|
|
[Cluster.PPL_NONPROD]: InternalCommonApiGatewayUrl.PPL_NP,
|
|
|
|
|
[Cluster.PPL_PROD]: InternalCommonApiGatewayUrl.PPL_PROD,
|
|
|
|
|
[Cluster.IAPL_PROD]: InternalCommonApiGatewayUrl.IAPL_PROD,
|
|
|
|
|
};
|
|
|
|
|
const InternalCommonApiGatewayUrlMap = {};
|
|
|
|
|
|
|
|
|
|
const rateLimitOptions = ['header', 'path'];
|
|
|
|
|
|
|
|
|
|
@@ -74,11 +65,14 @@ const GatewayAttributes = (props: any = { sourceGatewayPath: string }) => {
|
|
|
|
|
const { sourceGatewayPath } = props;
|
|
|
|
|
const classes = useStyles();
|
|
|
|
|
const { values }: { values: any } = useFormikContext();
|
|
|
|
|
const cluster = values?.cluster;
|
|
|
|
|
const attributeStateValue =
|
|
|
|
|
typeof getIn(values, sourceGatewayPath) !== 'undefined' ? getIn(values, sourceGatewayPath) : [];
|
|
|
|
|
const deployedState = attributeStateValue.map(
|
|
|
|
|
(gatewayAttributes: any) => gatewayAttributes.isDeployed,
|
|
|
|
|
);
|
|
|
|
|
const externalAuthAllowed =
|
|
|
|
|
cluster in ExternalAuthEnabledMap ? ExternalAuthEnabledMap[cluster] : false;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<FormikCardList
|
|
|
|
|
@@ -99,6 +93,14 @@ const GatewayAttributes = (props: any = { sourceGatewayPath: string }) => {
|
|
|
|
|
/>{' '}
|
|
|
|
|
</TableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
<TableRow>
|
|
|
|
|
<TableCell>
|
|
|
|
|
<FormControlLabel
|
|
|
|
|
control={<FormikCheckbox name={`${sourceGatewayPath}.${i}.strictMatching`} />}
|
|
|
|
|
label="Ensure strict matching of routes"
|
|
|
|
|
/>
|
|
|
|
|
</TableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
<TableRow>
|
|
|
|
|
<TableCell>
|
|
|
|
|
<FormikTextField
|
|
|
|
|
@@ -126,14 +128,18 @@ const GatewayAttributes = (props: any = { sourceGatewayPath: string }) => {
|
|
|
|
|
/>{' '}
|
|
|
|
|
</TableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
<TableRow>
|
|
|
|
|
<TableCell>
|
|
|
|
|
<FormControlLabel
|
|
|
|
|
control={<FormikCheckbox name={`${sourceGatewayPath}.${i}.externalAuth`} />}
|
|
|
|
|
label="Use External Auth Service"
|
|
|
|
|
/>
|
|
|
|
|
</TableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
{externalAuthAllowed ? (
|
|
|
|
|
<TableRow>
|
|
|
|
|
<TableCell>
|
|
|
|
|
<FormControlLabel
|
|
|
|
|
control={<FormikCheckbox name={`${sourceGatewayPath}.${i}.externalAuth`} />}
|
|
|
|
|
label="Use External Auth Service"
|
|
|
|
|
/>
|
|
|
|
|
</TableCell>
|
|
|
|
|
</TableRow>
|
|
|
|
|
) : (
|
|
|
|
|
<></>
|
|
|
|
|
)}
|
|
|
|
|
<TableFooter>
|
|
|
|
|
<RateLimitRules sourceRateLimitPath={`${sourceGatewayPath}.${i}.rateLimitRules`} />
|
|
|
|
|
</TableFooter>
|
|
|
|
|
@@ -218,6 +224,8 @@ const ApiGatewayForm = () => {
|
|
|
|
|
const gatewayStateValue =
|
|
|
|
|
typeof getIn(values, gatewayPath) !== 'undefined' ? getIn(values, gatewayPath) : [];
|
|
|
|
|
const deployedState = gatewayStateValue.map((gateway: any) => gateway.isDeployed);
|
|
|
|
|
const internalGatewayUrl =
|
|
|
|
|
cluster in InternalCommonApiGatewayUrlMap ? InternalCommonApiGatewayUrlMap[cluster] : undefined;
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<NotConfigured
|
|
|
|
|
@@ -254,15 +262,19 @@ const ApiGatewayForm = () => {
|
|
|
|
|
>
|
|
|
|
|
{toMenuItems(ExternalCommonApiGatewayUrlMap[cluster])}
|
|
|
|
|
</FormikTextField>
|
|
|
|
|
<FormikTextField
|
|
|
|
|
select
|
|
|
|
|
className={classes.field}
|
|
|
|
|
label="Corresponding INTERNAL Common API Gateway URL"
|
|
|
|
|
name={`deployment.commonApiGateways.${i}.internalCommonApiGatewayUrl`}
|
|
|
|
|
disabled={gatewayStateValue[i].isDeployed}
|
|
|
|
|
>
|
|
|
|
|
{toMenuItems(InternalCommonApiGatewayUrlMap[cluster])}
|
|
|
|
|
</FormikTextField>
|
|
|
|
|
{internalGatewayUrl !== undefined ? (
|
|
|
|
|
<FormikTextField
|
|
|
|
|
select
|
|
|
|
|
className={classes.field}
|
|
|
|
|
label="Corresponding INTERNAL Common API Gateway URL"
|
|
|
|
|
name={`deployment.commonApiGateways.${i}.internalCommonApiGatewayUrl`}
|
|
|
|
|
disabled={gatewayStateValue[i].isDeployed}
|
|
|
|
|
>
|
|
|
|
|
{toMenuItems(InternalCommonApiGatewayUrlMap[cluster])}
|
|
|
|
|
</FormikTextField>
|
|
|
|
|
) : (
|
|
|
|
|
<></>
|
|
|
|
|
)}
|
|
|
|
|
<GatewayAttributes
|
|
|
|
|
sourceGatewayPath={`deployment.commonApiGateways.${i}.gatewayAttributes`}
|
|
|
|
|
/>
|
|
|
|
|
|