Skip to content

Commit

Permalink
Removed CopyToClipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
thisaltennakoon committed Feb 1, 2024
1 parent 740a7b6 commit 9d30c63
Show file tree
Hide file tree
Showing 14 changed files with 283 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import fileDownload from 'js-file-download';
import openapiToPostman from 'openapi-to-postmanv2';
import swaggerToPostman from 'swagger2-postman2-converter';
import FileCopyIcon from '@mui/icons-material/FileCopy';
import CopyToClipboard from 'react-copy-to-clipboard';
// import CopyToClipboard from 'react-copy-to-clipboard';
import Tooltip from '@mui/material/Tooltip';
import CloudDownloadRounded from '@mui/icons-material/CloudDownloadRounded';
import queryString from 'query-string';
Expand Down Expand Up @@ -637,17 +637,20 @@ class ApiConsole extends React.Component {
)}
placement='top'
>
<CopyToClipboard
text={location.origin + '/api/am/devportal/v3/apis/' + api.id + '/swagger?accessToken='
+ accessTokenPart + '&X-WSO2-Tenant-Q=' + tenant + '&' + selectedAttribute + '='
+ selectedEnvironment}
onCopy={this.onCopy}
size='small'
>
<Button aria-label='Copy to clipboard' className={classes.button}>
<FileCopyIcon className={classes.buttonIcon} />
</Button>
</CopyToClipboard>
{/* <CopyToClipboard */}
{/* text={location.origin + '/api/am/devportal/v3/apis/' + api.id + '/swagger?accessToken=' */}
{/* + accessTokenPart + '&X-WSO2-Tenant-Q=' + tenant + '&' + selectedAttribute + '=' */}
{/* + selectedEnvironment} */}
{/* onCopy={this.onCopy} */}
{/* size='small' */}
{/* > */}
<Button aria-label='Copy to clipboard' className={classes.button}>
<FileCopyIcon className={classes.buttonIcon} />
</Button>
{location.origin + '/api/am/devportal/v3/apis/' + api.id + '/swagger?accessToken='
+ accessTokenPart + '&X-WSO2-Tenant-Q=' + tenant + '&' + selectedAttribute + '='
+ selectedEnvironment}
{/* </CopyToClipboard> */}
</Tooltip>
</Grid>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import Typography from '@mui/material/Typography';
import AccordionActions from '@mui/material/AccordionActions';
import Button from '@mui/material/Button';
import CopyToClipboard from 'react-copy-to-clipboard';
// import CopyToClipboard from 'react-copy-to-clipboard';
import TextField from '@mui/material/TextField';
import Alert from 'AppComponents/Shared/Alert';
import makeStyles from '@mui/styles/makeStyles';
Expand Down Expand Up @@ -143,16 +143,20 @@ export default function GenericSubscriptionUI(props) {
<Button size='small' onClick={handleClick}>
<FormattedMessage id='Apis.Details.AsyncApiConsole.Curl' defaultMessage='Generate Curl' />
</Button>
<CopyToClipboard
text={command}
{/* <CopyToClipboard */}
{/* text={command} */}
{/* */}
{/* > */}
<Button
size='small'
onCopy={() => Alert.info(
<FormattedMessage id='Apis.Details.AsyncApiConsole.Copied' defaultMessage='cURL copied' />,
)}
>
<Button size='small'>
<FormattedMessage id='Apis.Details.AsyncApiConsole.Copy' defaultMessage='Copy Curl' />
</Button>
</CopyToClipboard>
<FormattedMessage id='Apis.Details.AsyncApiConsole.Copy' defaultMessage='Copy Curl' />
{command}
</Button>
{/* </CopyToClipboard> */}
</AccordionActions>
</Accordion>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
import Typography from '@mui/material/Typography';
import AccordionActions from '@mui/material/AccordionActions';
import Button from '@mui/material/Button';
import CopyToClipboard from 'react-copy-to-clipboard';
// import CopyToClipboard from 'react-copy-to-clipboard';
import TextField from '@mui/material/TextField';
import Alert from 'AppComponents/Shared/Alert';
import makeStyles from '@mui/styles/makeStyles';
Expand Down Expand Up @@ -289,17 +289,21 @@ function WebhookSubscriptionUI(props) {
<Button size='small' onClick={handleClick}>
<FormattedMessage id='Apis.Details.AsyncApiConsole.Curl' defaultMessage='Generate Curl' />
</Button>
<CopyToClipboard
text={curl}
onCopy={() => Alert.info(intl.formatMessage({
{/* <CopyToClipboard */}
{/* text={curl} */}
{/* */}
{/* > */}
<Button
size='small'
onClick={() => Alert.info(intl.formatMessage({
defaultMessage: 'cURL copied',
id: 'Apis.Details.AsyncApiConsole.Webhooks.curl.copied',
}))}
>
<Button size='small'>
<FormattedMessage id='Apis.Details.AsyncApiConsole.Copy' defaultMessage='Copy Curl' />
</Button>
</CopyToClipboard>
<FormattedMessage id='Apis.Details.AsyncApiConsole.Copy' defaultMessage='Copy Curl' />
{curl}
</Button>
{/* </CopyToClipboard> */}
</AccordionActions>
</Accordion>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import VerticalDivider from 'AppComponents/Shared/VerticalDivider';
import Avatar from '@mui/material/Avatar';
import PropTypes from 'prop-types';
import Typography from '@mui/material/Typography';
import CopyToClipboard from 'react-copy-to-clipboard';
// import CopyToClipboard from 'react-copy-to-clipboard';
import Tooltip from '@mui/material/Tooltip';
import Box from '@mui/material/Box';
import Icon from '@mui/material/Icon';
Expand Down Expand Up @@ -142,18 +142,19 @@ function Environments(props) {
placement='right'
className={classes.iconStyle}
>
<CopyToClipboard
text={defaultVersionURLs.https
{/* <CopyToClipboard */}
{/* text= */}
{/* // text={endpoint.URLs.http} */}
{/* */}
{/* > */}
<IconButton aria-label='Copy the Default Version URL to clipboard' size='large' onCopy={() => onCopy('urlCopied')}>
<Icon color='secondary'>file_copy</Icon>
{defaultVersionURLs.https
|| defaultVersionURLs.http
|| defaultVersionURLs.ws
|| defaultVersionURLs.wss}
// text={endpoint.URLs.http}
onCopy={() => onCopy('urlCopied')}
>
<IconButton aria-label='Copy the Default Version URL to clipboard' size='large'>
<Icon color='secondary'>file_copy</Icon>
</IconButton>
</CopyToClipboard>
</IconButton>
{/* </CopyToClipboard> */}
</Tooltip>
</>
);
Expand Down Expand Up @@ -252,18 +253,26 @@ function Environments(props) {
placement='right'
className={classes.iconStyle}
>
<CopyToClipboard
text={selectedEndpoint.URLs.https
|| selectedEndpoint.URLs.http
|| selectedEndpoint.URLs.wss
|| selectedEndpoint.URLs.ws}
// text={endpoint.URLs.http}
{/* <CopyToClipboard */}
{/* text={selectedEndpoint.URLs.https */}
{/* || selectedEndpoint.URLs.http */}
{/* || selectedEndpoint.URLs.wss */}
{/* || selectedEndpoint.URLs.ws} */}
{/* // text={endpoint.URLs.http} */}
{/* onCopy={() => onCopy('urlCopied')} */}
{/* > */}
<IconButton
aria-label='Copy the API URL to clipboard'
size='large'
onCopy={() => onCopy('urlCopied')}
>
<IconButton aria-label='Copy the API URL to clipboard' size='large'>
<Icon color='secondary'>file_copy</Icon>
</IconButton>
</CopyToClipboard>
<Icon color='secondary'>file_copy</Icon>
{selectedEndpoint.URLs.https
|| selectedEndpoint.URLs.http
|| selectedEndpoint.URLs.wss
|| selectedEndpoint.URLs.ws}
</IconButton>
{/* </CopyToClipboard> */}
</Tooltip>
</Avatar>
</Box>
Expand Down Expand Up @@ -308,15 +317,21 @@ function Environments(props) {
placement='right'
className={classes.iconStyle}
>
<CopyToClipboard
text={selectedEndpoint.URLs.wss
|| selectedEndpoint.URLs.ws}
{/* <CopyToClipboard */}
{/* text={selectedEndpoint.URLs.wss */}
{/* || selectedEndpoint.URLs.ws} */}
{/* onCopy={() => onCopy('urlCopied')} */}
{/* > */}
<IconButton
aria-label='Copy the API URL to clipboard'
size='large'
onCopy={() => onCopy('urlCopied')}
>
<IconButton aria-label='Copy the API URL to clipboard' size='large'>
<Icon color='secondary'>file_copy</Icon>
</IconButton>
</CopyToClipboard>
<Icon color='secondary'>file_copy</Icon>
{selectedEndpoint.URLs.wss
|| selectedEndpoint.URLs.ws}
</IconButton>
{/* </CopyToClipboard> */}
</Tooltip>
</Avatar>
</>
Expand Down Expand Up @@ -382,15 +397,20 @@ function Environments(props) {
placement='right'
className={classes.iconStyle}
>
<CopyToClipboard
text={advertiseInfo.apiExternalProductionEndpoint}
// text={endpoint.URLs.http}
{/* <CopyToClipboard */}
{/* text={advertiseInfo.apiExternalProductionEndpoint} */}
{/* // text={endpoint.URLs.http} */}
{/* onCopy={() => onCopy('urlCopied')} */}
{/* > */}
<IconButton
aria-label='Copy the API URL to clipboard'
size='large'
onCopy={() => onCopy('urlCopied')}
>
<IconButton aria-label='Copy the API URL to clipboard' size='large'>
<Icon color='secondary'>file_copy</Icon>
</IconButton>
</CopyToClipboard>
<Icon color='secondary'>file_copy</Icon>
{advertiseInfo.apiExternalProductionEndpoint}
</IconButton>
{/* </CopyToClipboard> */}
</Tooltip>
</Avatar>
</Box>
Expand Down Expand Up @@ -432,14 +452,19 @@ function Environments(props) {
placement='right'
className={classes.iconStyle}
>
<CopyToClipboard
text={advertiseInfo.apiExternalSandboxEndpoint}
{/* <CopyToClipboard */}
{/* text={advertiseInfo.apiExternalSandboxEndpoint} */}
{/* onCopy={() => onCopy('urlCopied')} */}
{/* > */}
<IconButton
aria-label='Copy the API URL to clipboard'
size='large'
onCopy={() => onCopy('urlCopied')}
>
<IconButton aria-label='Copy the API URL to clipboard' size='large'>
<Icon color='secondary'>file_copy</Icon>
</IconButton>
</CopyToClipboard>
<Icon color='secondary'>file_copy</Icon>
{advertiseInfo.apiExternalSandboxEndpoint}
</IconButton>
{/* </CopyToClipboard> */}
</Tooltip>
</Avatar>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import makeStyles from '@mui/styles/makeStyles';
import Modal from '@mui/material/Modal';
import CodeIcon from '@mui/icons-material/Code';
import { FormattedMessage, injectIntl } from 'react-intl';
import CopyToClipboard from 'react-copy-to-clipboard';
// import CopyToClipboard from 'react-copy-to-clipboard';
import Tooltip from '@mui/material/Tooltip';
import Icon from '@mui/material/Icon';

Expand Down Expand Up @@ -112,12 +112,15 @@ function EmbedCode(props) {
placement='right'
className={classes.iconStyle}
>
<CopyToClipboard
text={embedCode}
onCopy={onCopy}
>
<Icon color='secondary'>file_copy</Icon>
</CopyToClipboard>
{/* <CopyToClipboard */}
{/* text={embedCode} */}
{/* onCopy={onCopy} */}
{/* > */}
<Icon color='secondary' onClick={onCopy}>
file_copy
{embedCode}
</Icon>
{/* </CopyToClipboard> */}
</Tooltip>
</div>
</Modal>
Expand Down
Loading

0 comments on commit 9d30c63

Please sign in to comment.