codekingpro/portable-devtools
114k
1/////////////////////////////////////////////////////////////2//3// pgAdmin 4 - PostgreSQL Tools4//5// Copyright (C) 2013 - 2024, The pgAdmin Development Team6// This software is released under the PostgreSQL Licence7//8//////////////////////////////////////////////////////////////9 10import React from 'react';11import PropTypes from 'prop-types';12import gettext from 'sources/gettext';13import url_for from 'sources/url_for';14 15import { Box } from '@mui/material';16import CloseIcon from '@mui/icons-material/CloseRounded';17import HelpIcon from '@mui/icons-material/Help';18 19import { DefaultButton, PgIconButton } from '../components/Buttons';20import { useModalStyles } from '../helpers/ModalProvider';21 22export default function UrlDialogContent({ url, helpFile, onClose }) {23 const classes = useModalStyles();24 25 return (26 <Box display="flex" flexDirection="column" height="100%" className={classes.container}>27 <Box flexGrow="1">28 <iframe src={url} width="100%" height="100%" onLoad={(e)=>{29 e.target?.contentWindow?.focus();30 }}/>31 </Box>32 <Box className={classes.footer}>33 <Box style={{ marginRight: 'auto' }}>34 <PgIconButton data-test={'help-'+helpFile} title={gettext('Help')} icon={<HelpIcon />} onClick={() => {35 let _url = url_for('help.static', {36 'filename': helpFile,37 });38 window.open(_url, 'pgadmin_help');39 }} >40 </PgIconButton>41 </Box>42 <DefaultButton data-test="close" startIcon={<CloseIcon />} onClick={() => {43 onClose();44 }} >{gettext('Close')}</DefaultButton>45 </Box>46 </Box>47 );48}49 50UrlDialogContent.propTypes = {51 url: PropTypes.string,52 helpFile: PropTypes.string,53 onClose: PropTypes.func,54};55 