Ensure that unwanted APIs should not be getting called for BigAnimal. Fixes #7368

Updated the BigAnimal icon.
This commit is contained in:
Khushboo Vashi 2022-05-24 11:34:23 +05:30 committed by Akshay Joshi
parent c956f730e9
commit 345cfd7c60
6 changed files with 47 additions and 30 deletions

View File

@ -21,6 +21,7 @@ Bug fixes
*********
| `Issue #7002 <https://redmine.postgresql.org/issues/7002>`_ - Added the ability to detect and warn users about bidirectional Unicode characters.
| `Issue #7368 <https://redmine.postgresql.org/issues/7368>`_ - Ensure that unwanted APIs should not be getting called for BigAnimal.
| `Issue #7372 <https://redmine.postgresql.org/issues/7372>`_ - Tell Docker to always pull the latest base images when building containers.
| `Issue #7373 <https://redmine.postgresql.org/issues/7373>`_ - Fixed an issue with geometry window zoom mouse scroll not working.
| `Issue #7376 <https://redmine.postgresql.org/issues/7376>`_ - Fixed an issue where a popup for unsaved changes appears when clicking on the open file button for a blank query editor.

View File

@ -25,6 +25,8 @@ import {AwsCredentials, AwsInstanceDetails, AwsDatabaseDetails, validateCloudSte
validateCloudStep2, validateCloudStep3} from './aws';
import {BigAnimalInstance, BigAnimalDatabase, validateBigAnimal,
validateBigAnimalStep2, validateBigAnimalStep3} from './biganimal';
import { isEmptyString } from 'sources/validators';
import { AWSIcon, BigAnimalIcon } from '../../../../static/js/components/ExternalIcon';
const useStyles = makeStyles(() =>
({
@ -72,6 +74,8 @@ export default function CloudWizard({ nodeInfo, nodeData }) {
const [bigAnimalInstanceData, setBigAnimalInstanceData] = React.useState({});
const [bigAnimalDatabaseData, setBigAnimalDatabaseData] = React.useState({});
const axiosApi = getApiInstance();
const [verificationURI, setVerificationURI] = React.useState('');
@ -194,6 +198,7 @@ export default function CloudWizard({ nodeInfo, nodeData }) {
reject();
});
} else if(activeStep == 0 && cloudProvider == 'biganimal') {
if (!isEmptyString(verificationURI)) { resolve(); return; }
setErrMsg([MESSAGE_TYPE.INFO, 'Getting EDB BigAnimal verification URL...']);
validateBigAnimal()
.then((res) => {
@ -272,7 +277,7 @@ export default function CloudWizard({ nodeInfo, nodeData }) {
</Box>
<Box className={classes.messageBox}>
<ToggleButtons cloudProvider={cloudProvider} setCloudProvider={setCloudProvider}
options={[{'label': 'Amazon RDS', value: 'rds'}, {'label': 'EDB BigAnimal', value: 'biganimal'}]}
options={[{label: 'Amazon RDS', value: 'rds', icon: <AWSIcon className={classes.icon} />}, {label: 'EDB BigAnimal', value: 'biganimal', icon: <BigAnimalIcon className={classes.icon} />}]}
></ToggleButtons>
</Box>
<Box className={classes.messageBox}>
@ -287,7 +292,7 @@ export default function CloudWizard({ nodeInfo, nodeData }) {
<br/>{gettext('By clicking the below button, you will be redirected to the EDB BigAnimal authentication page in a new tab.')}
</Box>
</Box>}
{cloudProvider == 'biganimal' && <PrimaryButton onClick={authenticateBigAnimal}>
{cloudProvider == 'biganimal' && <PrimaryButton onClick={authenticateBigAnimal} disabled={verificationIntiated ? true: false}>
{gettext('Click here to authenticate yourself to EDB BigAnimal')}
</PrimaryButton>}
{cloudProvider == 'biganimal' && <Box className={classes.messageBox}>

View File

@ -17,7 +17,6 @@ import getApiInstance from '../../../../static/js/api_instance';
import { isEmptyString } from 'sources/validators';
import PropTypes from 'prop-types';
const axiosApi = getApiInstance();
// BigAnimal Instance
@ -33,30 +32,39 @@ export function BigAnimalInstance(props) {
return url_for('biganimal.regions');
}
}),
instance_types: (region_id)=>getNodeAjaxOptions('biganimal_instance_types', pgAdmin.Browser.Nodes['server'],
props.nodeInfo, props.nodeData, {
useCache:false,
cacheNode: 'server',
customGenerateUrl: ()=>{
return url_for('biganimal.instance_types', {'region_id': region_id || 0});
}
}),
volume_types: (region_id)=>getNodeAjaxOptions('biganimal_volume_types', pgAdmin.Browser.Nodes['server'],
props.nodeInfo, props.nodeData, {
useCache:false,
cacheNode: 'server',
customGenerateUrl: ()=>{
return url_for('biganimal.volume_types', {'region_id': region_id || 0});
}
}),
volume_properties: (region_id, volume_type)=>getNodeAjaxOptions('biganimal_volume_properties', pgAdmin.Browser.Nodes['server'],
props.nodeInfo, props.nodeData, {
useCache:false,
cacheNode: 'server',
customGenerateUrl: ()=>{
return url_for('biganimal.volume_properties', {'region_id': region_id || 0, 'volume_type': volume_type || ''});
}
}),
instance_types: (region_id)=>{
if (isEmptyString(region_id)) return [];
return getNodeAjaxOptions('biganimal_instance_types', pgAdmin.Browser.Nodes['server'],
props.nodeInfo, props.nodeData, {
useCache:false,
cacheNode: 'server',
customGenerateUrl: ()=>{
return url_for('biganimal.instance_types', {'region_id': region_id || 0});
}
});
},
volume_types: (region_id)=>{
if (isEmptyString(region_id)) return [];
return getNodeAjaxOptions('biganimal_volume_types', pgAdmin.Browser.Nodes['server'],
props.nodeInfo, props.nodeData, {
useCache:false,
cacheNode: 'server',
customGenerateUrl: ()=>{
return url_for('biganimal.volume_types', {'region_id': region_id || 0});
}
});
},
volume_properties: (region_id, volume_type)=>{
if (isEmptyString(region_id) || isEmptyString(volume_type)) return [];
return getNodeAjaxOptions('biganimal_volume_properties', pgAdmin.Browser.Nodes['server'],
props.nodeInfo, props.nodeData, {
useCache:false,
cacheNode: 'server',
customGenerateUrl: ()=>{
return url_for('biganimal.volume_properties', {'region_id': region_id || 0, 'volume_type': volume_type || ''});
}
});
},
}, {
nodeInfo: props.nodeInfo,
nodeData: props.nodeData,
@ -146,7 +154,6 @@ export function validateBigAnimal() {
});
}
function createData(name, value) {
return { name, value };
}

View File

@ -12,7 +12,6 @@ import { ToggleButton, ToggleButtonGroup } from '@material-ui/lab';
import CheckRoundedIcon from '@material-ui/icons/CheckRounded';
import { DefaultButton, PrimaryButton } from '../../../../static/js/components/Buttons';
import { makeStyles } from '@material-ui/core/styles';
import { AWSIcon } from '../../../../static/js/components/ExternalIcon';
import PropTypes from 'prop-types';
import { getAWSSummary } from './aws';
import { getBigAnimalSummary } from './biganimal';
@ -49,7 +48,7 @@ export function ToggleButtons(props) {
(props.options||[]).map((option)=>{
return (<ToggleButton value={option.value} key={option.label} aria-label={option.label} component={props.cloudProvider == option.value ? PrimaryButton : DefaultButton}>
<CheckRoundedIcon style={{visibility: props.cloudProvider == option.value ? 'visible': 'hidden'}}/>&nbsp;
{option.value == 'rds' ? <AWSIcon className={classes.icon} /> : ''}&nbsp;&nbsp;{option.label}
{option.icon}&nbsp;&nbsp;{option.label}
</ToggleButton>);
})
}

View File

@ -0,0 +1 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 211.57 125.21"><defs><style>.cls-1{fill:#121646;}</style></defs><path class="cls-1" d="M141.73,43.38a6,6,0,1,0,6,6A6,6,0,0,0,141.73,43.38Z"/><path class="cls-1" d="M97.09,106.6a18.56,18.56,0,0,0-18.56,18.57v0h37.13v0A18.56,18.56,0,0,0,97.09,106.6Z"/><path class="cls-1" d="M177.75,52.41V52.3A52.29,52.29,0,0,0,85.5,18.56,36.45,36.45,0,0,0,35.26,52.3v0a36.45,36.45,0,0,0,1.19,72.88H56.67V74.73c0-5.86,0-30.38,30.34-30.42V54.67c0,9.63,6.55,20,15.23,24.2l31.29,15a7.18,7.18,0,0,1,4,6.27v25h37.6a36.45,36.45,0,0,0,2.63-72.8ZM166.06,95.6a21.28,21.28,0,0,1-6.33,2.22v18.46h-12.3v-16c0-5.87-4.33-12.75-9.62-15.29L106.52,70c-5.28-2.54-9.61-9.42-9.61-15.28V33.31a10.7,10.7,0,0,1,10.67-10.67h21.73c30.42,0,30.42,24.55,30.42,30.42V89.94c.64.11,1.27.21,1.93.27A26.57,26.57,0,0,0,176,87.45,27,27,0,0,1,166.06,95.6Z"/></svg>

After

Width:  |  Height:  |  Size: 897 B

View File

@ -15,6 +15,7 @@ import PropTypes from 'prop-types';
import Expand from '../../img/fonticon/open_in_full.svg?svgr';
import Collapse from '../../img/fonticon/close_fullscreen.svg?svgr';
import AWS from '../../img/aws.svg?svgr';
import BigAnimal from '../../img/biganimal.svg?svgr';
export default function ExternalIcon({Icon, ...props}) {
return <Icon className={'MuiSvgIcon-root'} {...props} />;
@ -68,3 +69,6 @@ MinimizeDialogIcon.propTypes = {style: PropTypes.object};
export const AWSIcon = ({style})=><ExternalIcon Icon={AWS} style={{height: '1.4rem', ...style}} data-label="AWSIcon" />;
AWSIcon.propTypes = {style: PropTypes.object};
export const BigAnimalIcon = ({style})=><ExternalIcon Icon={BigAnimal} style={{height: '1.4rem', ...style}} data-label="BigAnimalIcon" />;
BigAnimalIcon.propTypes = {style: PropTypes.object};