diff --git a/web/package.json b/web/package.json index d0aa9be77..7edaff9b3 100644 --- a/web/package.json +++ b/web/package.json @@ -81,7 +81,6 @@ "@mui/icons-material": "^5.15.10", "@mui/lab": "^5.0.0-alpha.165", "@mui/material": "^5.15.10", - "@mui/styles": "^5.15.10", "@mui/x-date-pickers": "^6.19.7", "@projectstorm/react-diagrams": "^6.6.1", "@simonwep/pickr": "^1.5.1", diff --git a/web/pgadmin/about/static/js/AboutComponent.jsx b/web/pgadmin/about/static/js/AboutComponent.jsx index 457c54412..7bb45c3b0 100644 --- a/web/pgadmin/about/static/js/AboutComponent.jsx +++ b/web/pgadmin/about/static/js/AboutComponent.jsx @@ -8,35 +8,27 @@ ////////////////////////////////////////////////////////////// import gettext from 'sources/gettext'; +import { styled } from '@mui/material/styles'; import url_for from 'sources/url_for'; import React, { useEffect, useState, useRef } from 'react'; import { Box, Grid, InputLabel } from '@mui/material'; import { DefaultButton } from '../../../static/js/components/Buttons'; -import { makeStyles } from '@mui/styles'; import { InputText } from '../../../static/js/components/FormComponents'; import getApiInstance from '../../../static/js/api_instance'; import { copyToClipboard } from '../../../static/js/clipboard'; import { useDelayedCaller } from '../../../static/js/custom_hooks'; import { usePgAdmin } from '../../../static/js/BrowserComponent'; - -const useStyles = makeStyles((theme)=>({ - container: { - padding: '16px', - height: '100%', - display: 'flex', - flexDirection: 'column', - }, - copyBtn: { +const StyledDefaultButton = styled(DefaultButton)(({theme}) => ({ + '&.AboutComponent-copyBtn': { marginRight: '1px', float: 'right', borderColor: theme.otherVars.borderColor, fontSize: '13px', - }, + } })); export default function AboutComponent() { - const classes = useStyles(); const containerRef = useRef(); const [aboutData, setAboutData] = useState([]); const [copyText, setCopyText] = useState(gettext('Copy')); @@ -57,7 +49,7 @@ export default function AboutComponent() { }, []); return ( - + {gettext('Version')} @@ -134,11 +126,11 @@ export default function AboutComponent() { {gettext('Server Configuration')} - { + { copyToClipboard(aboutData.settings); setCopyText(gettext('Copied!')); revertCopiedText(1500); - }}>{copyText} + }}>{copyText} ({ - emptyPanel: { +const Root = styled('div')(({theme}) => ({ + height: '100%', + width: '100%', + '& .Dashboard-dashboardPanel': { + height: '100%', + background: theme.palette.grey[400], + '& .Dashboard-panelContent': { + ...theme.mixins.panelBorder.all, + display: 'flex', + flexDirection: 'column', + overflow: 'hidden !important', + height: '100%', + width: '100%', + minHeight: '400px', + padding: '4px', + '& .Dashboard-mainTabs': { + ...theme.mixins.panelBorder.all, + height: '100%', + display: 'flex', + flexDirection: 'column', + '& .Dashboard-terminateButton': { + color: theme.palette.error.main + }, + }, + }, + }, + '& .Dashboard-emptyPanel': { width: '100%', background: theme.otherVars.emptySpaceBg, overflow: 'auto', padding: '8px', display: 'flex', }, - dashboardPanel: { - height: '100%', - background: theme.palette.grey[400], - }, - cardHeader: { - padding: '0.25rem 0.5rem', - fontWeight: 'bold !important', - backgroundColor: theme.otherVars.tableBg, - borderBottom: '1px solid', - borderBottomColor: theme.otherVars.borderColor, - }, - searchPadding: { - display: 'flex', - flex: 2.5, - }, - component: { - padding: '8px', - }, - searchInput: { - flex: 1, - }, - panelIcon: { - width: '80%', - margin: '0 auto', - marginTop: '25px !important', - position: 'relative', - textAlign: 'center', - }, - panelMessage: { - marginLeft: '0.5rem', - fontSize: '0.875rem', - }, - panelContent: { - ...theme.mixins.panelBorder.all, - display: 'flex', - flexDirection: 'column', - overflow: 'hidden !important', - height: '100%', - width: '100%', - minHeight: '400px', - padding: '4px' - }, - mainTabs: { - ...theme.mixins.panelBorder.all, - height: '100%', - display: 'flex', - flexDirection: 'column' - }, - terminateButton: { - color: theme.palette.error.main - }, - chartCard: { - border: '1px solid '+theme.otherVars.borderColor, - }, - chartCardContent: { - padding: '0.25rem 0.5rem', - height: '165px', - display: 'flex', - }, - chartLegend: { - marginLeft: 'auto', - '& > div': { - display: 'flex', - fontWeight: 'normal', - flexWrap: 'wrap', - - '& .legend-value': { - marginLeft: '4px', - '& .legend-label': { - marginLeft: '4px', - } - } - } - } })); let activeQSchemaObj = new ActiveQuery(); @@ -138,7 +89,7 @@ function Dashboard({ nodeItem, nodeData, node, treeNodeInfo, ...props }) { - const classes = useStyles(); + let tabs = [gettext('Sessions'), gettext('Locks'), gettext('Prepared Transactions')]; let mainTabs = [gettext('General'), gettext('System Statistics')]; if(treeNodeInfo?.server?.replication_type) { @@ -261,7 +212,7 @@ function Dashboard({ size="xs" noBorder icon={} - className={classes.terminateButton} + className='Dashboard-terminateButton' onClick={() => { if ( !canTakeAction(row, 'terminate') @@ -796,8 +747,8 @@ function Dashboard({ const showDefaultContents = () => { return ( sid && !serverConnected ? ( - -
+ +
@@ -823,7 +774,7 @@ function Dashboard({ { e.preventDefault(); setActiveOnly(e.target.checked); @@ -834,11 +785,11 @@ function Dashboard({ }; return ( - <> + ( {sid && serverConnected ? ( - - - + + + {/* General Statistics */} - + {!_.isUndefined(preferences) && preferences.show_graphs && ( - + - + - + - + {/* System Statistics */} - + {ssMsg === 'installed' && did === ldid ? @@ -928,7 +879,7 @@ function Dashboard({ })} - + - + - + - + : -
+
} {/* Replication */} - + @@ -985,7 +936,7 @@ function Dashboard({ ) : showDefaultContents() } - + ) ); } diff --git a/web/pgadmin/dashboard/static/js/SystemStats/CPU.jsx b/web/pgadmin/dashboard/static/js/SystemStats/CPU.jsx index 47fe421eb..7285a0d3a 100644 --- a/web/pgadmin/dashboard/static/js/SystemStats/CPU.jsx +++ b/web/pgadmin/dashboard/static/js/SystemStats/CPU.jsx @@ -11,7 +11,6 @@ import React, { useState, useEffect, useRef, useReducer, useMemo } from 'react'; import PgTable from 'sources/components/PgTable'; import gettext from 'sources/gettext'; import PropTypes from 'prop-types'; -import { makeStyles } from '@mui/styles'; import {getGCD, getEpoch} from 'sources/utils'; import ChartContainer from '../components/ChartContainer'; import { Box, Grid } from '@mui/material'; @@ -23,40 +22,6 @@ import { getStatsUrl, transformData, statsReducer, X_AXIS_LENGTH } from './utili import { toPrettySize } from '../../../../static/js/utils'; import SectionContainer from '../components/SectionContainer.jsx'; -const useStyles = makeStyles((theme) => ({ - autoResizer: { - height: '100% !important', - width: '100% !important', - background: theme.palette.grey[400], - padding: '8px', - overflowX: 'auto !important', - overflowY: 'hidden !important', - minHeight: '100%', - minWidth: '100%', - }, - container: { - height: 'auto', - padding: '0px !important', - marginBottom: '4px', - }, - fixedContainer: { - flexGrow: 1, - padding: '0px !important', - marginBottom: '4px', - }, - tableContainer: { - padding: '6px', - width: '100%', - }, - containerHeader: { - fontSize: '15px', - fontWeight: 'bold', - display: 'flex', - alignItems: 'center', - height: '100%', - }, -})); - const chartsDefault = { 'cpu_stats': {'User Normal': [], 'User Niced': [], 'Kernel': [], 'Idle': []}, 'la_stats': {'1 min': [], '5 mins': [], '10 mins': [], '15 mins': []}, @@ -246,15 +211,14 @@ CPU.propTypes = { }; export function CPUWrapper(props) { - const classes = useStyles(); const options = useMemo(()=>({ showDataPoints: props.showDataPoints, showTooltip: props.showTooltip, lineBorderWidth: props.lineBorderWidth, }), [props.showTooltip, props.showDataPoints, props.lineBorderWidth]); return ( - - + ( + @@ -269,7 +233,6 @@ export function CPUWrapper(props) { + ) ); } diff --git a/web/pgadmin/dashboard/static/js/SystemStats/Memory.jsx b/web/pgadmin/dashboard/static/js/SystemStats/Memory.jsx index 9e00b6029..70e856664 100644 --- a/web/pgadmin/dashboard/static/js/SystemStats/Memory.jsx +++ b/web/pgadmin/dashboard/static/js/SystemStats/Memory.jsx @@ -10,7 +10,6 @@ import React, { useState, useEffect, useRef, useReducer, useMemo } from 'react'; import PgTable from 'sources/components/PgTable'; import gettext from 'sources/gettext'; import PropTypes from 'prop-types'; -import { makeStyles } from '@mui/styles'; import {getGCD, getEpoch} from 'sources/utils'; import ChartContainer from '../components/ChartContainer'; import { Box, Grid } from '@mui/material'; @@ -22,39 +21,6 @@ import { getStatsUrl, transformData, statsReducer, X_AXIS_LENGTH } from './utili import { toPrettySize } from '../../../../static/js/utils'; import SectionContainer from '../components/SectionContainer.jsx'; -const useStyles = makeStyles((theme) => ({ - autoResizer: { - height: '100% !important', - width: '100% !important', - background: theme.palette.grey[400], - padding: '8px', - overflowX: 'auto !important', - overflowY: 'hidden !important', - minHeight: '100%', - minWidth: '100%', - }, - container: { - height: 'auto', - padding: '0px !important', - marginBottom: '4px', - }, - fixedContainer: { - flexGrow: 1, - padding: '0px !important', - marginBottom: '4px', - }, - tableContainer: { - padding: '6px', - width: '100%', - }, - containerHeader: { - fontSize: '15px', - fontWeight: 'bold', - display: 'flex', - alignItems: 'center', - height: '100%', - } -})); const chartsDefault = { 'm_stats': {'Total': [], 'Used': [], 'Free': []}, @@ -248,7 +214,7 @@ Memory.propTypes = { }; export function MemoryWrapper(props) { - const classes = useStyles(); + const options = useMemo(()=>({ showDataPoints: props.showDataPoints, showTooltip: props.showTooltip, @@ -256,35 +222,36 @@ export function MemoryWrapper(props) { }), [props.showTooltip, props.showDataPoints, props.lineBorderWidth]); return ( - - - - - - + ( + + + + + + + + + + + + - - - - - - - - - - + + + + + - + ) ); } diff --git a/web/pgadmin/dashboard/static/js/SystemStats/Storage.jsx b/web/pgadmin/dashboard/static/js/SystemStats/Storage.jsx index 4a720ea65..96234c81d 100644 --- a/web/pgadmin/dashboard/static/js/SystemStats/Storage.jsx +++ b/web/pgadmin/dashboard/static/js/SystemStats/Storage.jsx @@ -7,9 +7,9 @@ // ////////////////////////////////////////////////////////////// import React, { useState, useEffect, useRef, useReducer, useMemo } from 'react'; +import { styled } from '@mui/material/styles'; import gettext from 'sources/gettext'; import PropTypes from 'prop-types'; -import { makeStyles } from '@mui/styles'; import url_for from 'sources/url_for'; import {getGCD, getEpoch} from 'sources/utils'; import ChartContainer from '../components/ChartContainer'; @@ -21,52 +21,29 @@ import axios from 'axios'; import { BarChart, PieChart } from '../../../../static/js/chartjs'; import { getStatsUrl, transformData, X_AXIS_LENGTH } from './utility.js'; import { toPrettySize } from '../../../../static/js/utils'; -import clsx from 'clsx'; -import { commonTableStyles } from '../../../../static/js/Theme'; +import Table from '../../../../static/js/components/Table'; import SectionContainer from '../components/SectionContainer.jsx'; -const useStyles = makeStyles((theme) => ({ - container: { - height: 'auto', - padding: '8px', - marginBottom: '6px', - }, - driveContainer: { - width: '100%', - }, - diskInfoCharts: { - marginBottom: '4px', - }, - containerHeaderText: { - fontWeight: 'bold', - padding: '4px 8px', - }, - tableContainer: { + +const Root = styled('div')(({theme}) => ({ + '& .Storage-tableContainer': { background: theme.otherVars.tableBg, + padding: '0px', border: '1px solid '+theme.otherVars.borderColor, borderCollapse: 'collapse', borderRadius: '4px', overflow: 'auto', width: '100%', - marginBottom: '4px', - }, - tableWhiteSpace: { - '& td, & th': { - whiteSpace: 'break-spaces !important', + margin: '4px 4px 4px 4px', + '& .Storage-containerHeaderText': { + fontWeight: 'bold', + padding: '4px 8px', + }, + '& .Storage-tableWhiteSpace': { + '& td, & th': { + whiteSpace: 'break-spaces !important', + }, }, - }, - driveContainerHeader: { - height: 'auto', - padding: '5px 0px 0px 0px', - background: theme.otherVars.tableBg, - marginBottom: '5px', - borderRadius: '4px 4px 0px 0px', - }, - driveContainerBody: { - height: 'auto', - padding: '0px', - background: theme.otherVars.tableBg, - borderRadius: '0px 0px 4px 4px', }, })); @@ -122,12 +99,11 @@ const chartsDefault = { const DiskStatsTable = (props) => { - const tableClasses = commonTableStyles(); - const classes = useStyles(); + const tableHeader = props.tableHeader; const data = props.data; return ( - +
{tableHeader.map((item, index) => ( @@ -144,7 +120,7 @@ const DiskStatsTable = (props) => { ))} -
+ ); }; @@ -358,7 +334,7 @@ export default function Storage({preferences, sid, did, pageVisible, enablePoll= }, enablePoll ? pollDelay : -1); return ( - <> + (
{pollDelay}
{chartDrawnOnce && } - +
) ); } @@ -387,7 +363,7 @@ Storage.propTypes = { }; export function StorageWrapper(props) { - const classes = useStyles(); + const options = useMemo(()=>({ showDataPoints: props.showDataPoints, showTooltip: props.showTooltip, @@ -414,10 +390,10 @@ export function StorageWrapper(props) { }, }; - return ( - <> -
-
{gettext('Disk information')}
+ return ( + +
+
{gettext('Disk information')}
@@ -511,7 +487,7 @@ export function StorageWrapper(props) { ))} - +
); } diff --git a/web/pgadmin/dashboard/static/js/SystemStats/Summary.jsx b/web/pgadmin/dashboard/static/js/SystemStats/Summary.jsx index 625ae4ce8..27a984600 100644 --- a/web/pgadmin/dashboard/static/js/SystemStats/Summary.jsx +++ b/web/pgadmin/dashboard/static/js/SystemStats/Summary.jsx @@ -7,9 +7,9 @@ // ////////////////////////////////////////////////////////////// import React, { useState, useEffect, useRef, useReducer, useMemo } from 'react'; +import { styled } from '@mui/material/styles'; import gettext from 'sources/gettext'; import PropTypes from 'prop-types'; -import { makeStyles } from '@mui/styles'; import url_for from 'sources/url_for'; import getApiInstance from 'sources/api_instance'; import {getGCD, getEpoch} from 'sources/utils'; @@ -20,31 +20,22 @@ import StreamingChart from '../../../../static/js/components/PgChart/StreamingCh import {useInterval, usePrevious} from 'sources/custom_hooks'; import axios from 'axios'; import { getStatsUrl, transformData,statsReducer, X_AXIS_LENGTH } from './utility.js'; -import clsx from 'clsx'; -import { commonTableStyles } from '../../../../static/js/Theme'; +import Table from '../../../../static/js/components/Table'; -const useStyles = makeStyles((theme) => ({ - container: { - height: 'auto', - padding: '0px !important', - marginBottom: '4px', - }, - tableContainer: { +const Root = styled('div')(({theme}) => ({ + '& .Summary-tableContainer': { background: theme.otherVars.tableBg, padding: '0px', border: '1px solid '+theme.otherVars.borderColor, borderCollapse: 'collapse', borderRadius: '4px', overflow: 'hidden', - }, - chartContainer: { - padding: '4px', - }, - containerHeader: { - fontWeight: 'bold', - marginBottom: '0px', - borderBottom: '1px solid '+theme.otherVars.borderColor, - padding: '4px 8px', + '& .Summary-containerHeader': { + fontWeight: 'bold', + marginBottom: '0px', + borderBottom: '1px solid '+theme.otherVars.borderColor, + padding: '4px 8px', + } }, })); @@ -53,10 +44,9 @@ const chartsDefault = { }; const SummaryTable = (props) => { - const tableClasses = commonTableStyles(); const data = props.data; return ( - +
@@ -71,7 +61,7 @@ const SummaryTable = (props) => { ))} -
Property
+ ); }; @@ -224,7 +214,7 @@ export default function Summary({preferences, sid, did, pageVisible, enablePoll= }, enablePoll ? pollDelay : -1); return ( - <> + (
{pollDelay}
{chartDrawnOnce && } - +
) ); } @@ -251,7 +241,7 @@ Summary.propTypes = { }; function SummaryWrapper(props) { - const classes = useStyles(); + const options = useMemo(()=>({ showDataPoints: props.showDataPoints, showTooltip: props.showTooltip, @@ -259,23 +249,23 @@ function SummaryWrapper(props) { }), [props.showTooltip, props.showDataPoints, props.lineBorderWidth]); return ( <> - + -
-
{gettext('OS information')}
+
+
{gettext('OS information')}
- + - + -
-
{gettext('CPU information')}
+
+
{gettext('CPU information')}
diff --git a/web/pgadmin/dashboard/static/js/WelcomeDashboard.jsx b/web/pgadmin/dashboard/static/js/WelcomeDashboard.jsx index 86fa1e516..88a774702 100644 --- a/web/pgadmin/dashboard/static/js/WelcomeDashboard.jsx +++ b/web/pgadmin/dashboard/static/js/WelcomeDashboard.jsx @@ -8,96 +8,111 @@ ////////////////////////////////////////////////////////////// import React from 'react'; +import { styled } from '@mui/material/styles'; import gettext from 'sources/gettext'; import _ from 'lodash'; import PropTypes from 'prop-types'; -import { makeStyles } from '@mui/styles'; import pgAdmin from 'sources/pgadmin'; import PgAdminLogo from './PgAdminLogo'; import { Link } from '@mui/material'; -const useStyles = makeStyles((theme) => ({ - emptyPanel: { - background: theme.palette.grey[400], - overflow: 'hidden', - padding: '8px', - display: 'flex', - flexDirection: 'column', - flexGrow: 1, - height: '100%' - }, - dashboardContainer: { +const Root = styled('div')(({theme}) => ({ + background: theme.palette.grey[400], + overflow: 'hidden', + padding: '8px', + display: 'flex', + flexDirection: 'column', + flexGrow: 1, + height: '100%', + '& .WelcomeDashboard-dashboardContainer': { paddingBottom: '8px', - minHeight: '100%' - }, - card: { - position: 'relative', - minWidth: 0, - wordWrap: 'break-word', - backgroundColor: theme.otherVars.tableBg, - backgroundClip: 'border-box', - border: '1px solid' + theme.otherVars.borderColor, - borderRadius: theme.shape.borderRadius, - marginTop: 8 - }, - row: { - marginRight: '-8px', - marginLeft: '-8px' - }, - rowContent: { - display: 'flex', - flexWrap: 'wrap', - marginRight: '-7.5px', - marginLeft: '-7.5px' - }, - cardHeader: { - padding: '0.25rem 0.5rem', - fontWeight: 'bold', - backgroundColor: theme.otherVars.tableBg, - borderBottom: '1px solid', - borderBottomColor: theme.otherVars.borderColor, - }, - dashboardLink: { - color: theme.otherVars.colorFg + '!important', - flex: '0 0 50%', - maxWidth: '50%', - textAlign: 'center', - cursor: 'pointer' - }, - gettingStartedLink: { - flex: '0 0 25%', - maxWidth: '50%', - textAlign: 'center', - cursor: 'pointer' - }, - link: { - color: theme.palette.text.primary + '!important', - }, - cardColumn: { - flex: '0 0 100%', - maxWidth: '100%', - margin: '8px' - }, - cardBody: { - flex: '1 1 auto', - minHeight: '1px', - padding: '0.5rem !important', - }, - welcomeLogo: { - width: '400px', - '& .app-name': { - fill: theme.otherVars.colorBrand + minHeight: '100%', + + '& .WelcomeDashboard-row': { + marginRight: '-8px', + marginLeft: '-8px' }, - '& .app-name-underline': { - stroke: theme.palette.text.primary + '& .WelcomeDashboard-cardColumn': { + flex: '0 0 100%', + maxWidth: '100%', + margin: '8px', + + '& .WelcomeDashboard-card': { + position: 'relative', + minWidth: 0, + wordWrap: 'break-word', + backgroundColor: theme.otherVars.tableBg, + backgroundClip: 'border-box', + border: '1px solid' + theme.otherVars.borderColor, + borderRadius: theme.shape.borderRadius, + marginTop: 8, + + '& .WelcomeDashboard-cardHeader': { + padding: '0.25rem 0.5rem', + fontWeight: 'bold', + backgroundColor: theme.otherVars.tableBg, + borderBottom: '1px solid', + borderBottomColor: theme.otherVars.borderColor, + }, + '& .WelcomeDashboard-cardBody': { + flex: '1 1 auto', + minHeight: '1px', + padding: '0.5rem !important', + + '& .WelcomeDashboard-welcomeLogo': { + width: '400px', + '& .app-name': { + fill: theme.otherVars.colorBrand + }, + '& .app-name-underline': { + stroke: theme.palette.text.primary + }, + '& .app-tagline': { + fill: theme.palette.text.primary + } + }, + + '& .WelcomeDashboard-rowContent': { + display: 'flex', + flexWrap: 'wrap', + marginRight: '-7.5px', + marginLeft: '-7.5px', + + '& .WelcomeDashboard-dashboardLink': { + color: theme.palette.text.primary + ' !important', + flex: '0 0 50%', + maxWidth: '50%', + textAlign: 'center', + cursor: 'pointer', + + '& .WelcomeDashboard-link': { + color: theme.palette.text.primary + ' !important', + + '& .WelcomeDashboard-dashboardIcon': { + color: theme.otherVars.colorBrand + } + }, + }, + + '& .WelcomeDashboard-gettingStartedLink': { + flex: '0 0 25%', + maxWidth: '50%', + textAlign: 'center', + cursor: 'pointer', + + '& .WelcomeDashboard-link': { + color: theme.palette.text.primary + ' !important', + + '& .WelcomeDashboard-dashboardIcon': { + color: theme.otherVars.colorBrand + } + }, + }, + }, + }, + }, }, - '& .app-tagline': { - fill: theme.palette.text.primary - } - }, - dashboardIcon: { - color: theme.otherVars.colorBrand }, })); @@ -130,18 +145,15 @@ function AddNewServer(pgBrowser) { } export default function WelcomeDashboard({ pgBrowser }) { - - const classes = useStyles(); - return ( -
-
-
-
-
-
{gettext('Welcome')}
-
-
+ +
+
+
+
+
{gettext('Welcome')}
+
+

@@ -157,15 +169,15 @@ export default function WelcomeDashboard({ pgBrowser }) {

-
-
-
-
{gettext('Quick Links')}
-
-
-
- { AddNewServer(pgBrowser); }} className={classes.link}> -
+
+
+
+
{gettext('Quick Links')}
+
+
+
+ { AddNewServer(pgBrowser); }} className='WelcomeDashboard-link'> +
-
- pgAdmin.Preferences.show()} className={classes.link}> -
+
+ pgAdmin.Preferences.show()} className='WelcomeDashboard-link'> +
-
-
-
-
{gettext('Getting Started')}
-
-
-
+
+
+
+
{gettext('Getting Started')}
+
+
+
-
+
-
- -
+
+ +
-
+
-
+
-
+ + ); } diff --git a/web/pgadmin/dashboard/static/js/components/ChartContainer.jsx b/web/pgadmin/dashboard/static/js/components/ChartContainer.jsx index dcbfc77d5..d444fca3a 100644 --- a/web/pgadmin/dashboard/static/js/components/ChartContainer.jsx +++ b/web/pgadmin/dashboard/static/js/components/ChartContainer.jsx @@ -7,29 +7,20 @@ // ////////////////////////////////////////////////////////////// import React from 'react'; +import { styled } from '@mui/material/styles'; import PropTypes from 'prop-types'; import { Box, Card, CardContent, CardHeader } from '@mui/material'; -import { makeStyles } from '@mui/styles'; import EmptyPanelMessage from '../../../../static/js/components/EmptyPanelMessage'; - -const useStyles = makeStyles((theme) => ({ - chartCard: { - border: '1px solid '+theme.otherVars.borderColor, - height: '100%', - }, - chartCardContent: { - padding: '0.25rem 0.5rem', - height: '165px', - display: 'flex', - }, - chartLegend: { +const StyledCard = styled(Card)(({theme}) => ({ + border: '1px solid '+theme.otherVars.borderColor, + height: '100%', + '& .ChartContainer-chartLegend': { marginLeft: 'auto', '& > div': { display: 'flex', fontWeight: 'normal', - '& .legend-value': { marginLeft: '4px', '& .legend-label': { @@ -37,17 +28,22 @@ const useStyles = makeStyles((theme) => ({ } } } + }, + '& .ChartContainer-cardContent': { + padding: '0.25rem 0.5rem', + height: '165px', + display: 'flex', } })); export default function ChartContainer(props) { - const classes = useStyles(); + return ( - +
{props.title}
-
+
{props.datasets?.map((datum)=>(
@@ -58,11 +54,11 @@ export default function ChartContainer(props) {
} /> - + {!props.errorMsg && !props.isTest && props.children} {props.errorMsg && } - + ); } diff --git a/web/pgadmin/dashboard/static/js/components/RefreshButtons.jsx b/web/pgadmin/dashboard/static/js/components/RefreshButtons.jsx index 781abae1f..c329376de 100644 --- a/web/pgadmin/dashboard/static/js/components/RefreshButtons.jsx +++ b/web/pgadmin/dashboard/static/js/components/RefreshButtons.jsx @@ -8,36 +8,33 @@ ////////////////////////////////////////////////////////////// import React from 'react'; +import { styled } from '@mui/material/styles'; import gettext from 'sources/gettext'; import CachedOutlinedIcon from '@mui/icons-material/CachedOutlined'; import { PgIconButton } from '../../../../static/js/components/Buttons'; -import { makeStyles } from '@mui/styles'; import PropTypes from 'prop-types'; -const useStyles = makeStyles((theme) => ({ - refreshButton: { +const StyledPgIconButton = styled(PgIconButton)(({theme}) => ({ + '&.RefreshButtons': { marginLeft: 'auto', - height: '1.9rem', - width: '2.2rem', + height: '1.9rem !important', + width: '2.2rem !important', ...theme.mixins.panelBorder, - }, + } })); - export default function RefreshButton({onClick}) { - const classes = useStyles(); - - return( - } onClick={onClick} color="default" aria-label="Refresh" title={gettext('Refresh')} - > + > ); } diff --git a/web/pgadmin/dashboard/static/js/components/SectionContainer.jsx b/web/pgadmin/dashboard/static/js/components/SectionContainer.jsx index 11d678b87..4454b3e5d 100644 --- a/web/pgadmin/dashboard/static/js/components/SectionContainer.jsx +++ b/web/pgadmin/dashboard/static/js/components/SectionContainer.jsx @@ -7,42 +7,37 @@ // ////////////////////////////////////////////////////////////// import React from 'react'; +import { styled } from '@mui/material/styles'; import PropTypes from 'prop-types'; import { Box } from '@mui/material'; -import { makeStyles } from '@mui/styles'; - -const useStyles = makeStyles((theme) => ({ - root: { - ...theme.mixins.panelBorder.all, - display: 'flex', - flexDirection: 'column', - overflow: 'hidden !important', - height: '100%', - width: '100%', - minHeight: '400px', - borderRadius: theme.shape.borderRadius, - }, - cardHeader: { +const StyledBox = styled(Box)(({theme}) => ({ + ...theme.mixins.panelBorder.all, + display: 'flex', + flexDirection: 'column', + overflow: 'hidden !important', + height: '100%', + width: '100%', + minHeight: '400px', + borderRadius: theme.shape.borderRadius, + '& .SectionContainer-cardHeader': { backgroundColor: theme.otherVars.tableBg, borderBottom: '1px solid', borderBottomColor: theme.otherVars.borderColor, display: 'flex', alignItems: 'center', + '& .SectionContainer-cardTitle': { + padding: '0.25rem 0.5rem', + fontWeight: 'bold', + } }, - cardTitle: { - padding: '0.25rem 0.5rem', - fontWeight: 'bold', - } })); export default function SectionContainer({title, titleExtras, children, style}) { - const classes = useStyles(); - return ( - - -
{title}
+ + +
{title}
{titleExtras}
@@ -50,7 +45,7 @@ export default function SectionContainer({title, titleExtras, children, style}) {children} -
+
); } diff --git a/web/pgadmin/misc/bgprocess/static/js/BgProcessNotify.jsx b/web/pgadmin/misc/bgprocess/static/js/BgProcessNotify.jsx index 4671f55c6..f368a053f 100644 --- a/web/pgadmin/misc/bgprocess/static/js/BgProcessNotify.jsx +++ b/web/pgadmin/misc/bgprocess/static/js/BgProcessNotify.jsx @@ -1,24 +1,28 @@ import { Box } from '@mui/material'; -import { makeStyles } from '@mui/styles'; +import { styled } from '@mui/material/styles'; import React from 'react'; import CloseIcon from '@mui/icons-material/CloseRounded'; import { DefaultButton, PgIconButton } from '../../../../static/js/components/Buttons'; -import clsx from 'clsx'; import DescriptionOutlinedIcon from '@mui/icons-material/DescriptionOutlined'; import { BgProcessManagerProcessState } from './BgProcessConstants'; import PropTypes from 'prop-types'; import gettext from 'sources/gettext'; import pgAdmin from 'sources/pgadmin'; - -const useStyles = makeStyles((theme)=>({ - container: { - borderRadius: theme.shape.borderRadius, - padding: '0.25rem 1rem 1rem', - minWidth: '325px', - ...theme.mixins.panelBorder.all, +const StyledBox = styled(Box)(({theme}) => ({ + borderRadius: theme.shape.borderRadius, + padding: '0.25rem 1rem 1rem', + minWidth: '325px', + ...theme.mixins.panelBorder.all, + '&.BgProcessNotify-containerSuccess': { + borderColor: theme.palette.success.main, + backgroundColor: theme.palette.success.light, }, - containerHeader: { + '&.BgProcessNotify-containerError': { + borderColor: theme.palette.error.main, + backgroundColor: theme.palette.error.light, + }, + '& .BgProcessNotify-containerHeader': { height: '32px', display: 'flex', justifyContent: 'space-between', @@ -26,36 +30,27 @@ const useStyles = makeStyles((theme)=>({ alignItems: 'center', borderTopLeftRadius: 'inherit', borderTopRightRadius: 'inherit', + '& .BgProcessNotify-iconSuccess': { + color: theme.palette.success.main, + }, + '& .BgProcessNotify-iconError': { + color: theme.palette.error.main, + } }, - containerBody: { + '&.BgProcessNotify-containerBody': { marginTop: '1rem', overflowWrap: 'break-word', }, - containerSuccess: { - borderColor: theme.palette.success.main, - backgroundColor: theme.palette.success.light, - }, - iconSuccess: { - color: theme.palette.success.main, - }, - containerError: { - borderColor: theme.palette.error.main, - backgroundColor: theme.palette.error.light, - }, - iconError: { - color: theme.palette.error.main, - }, })); function ProcessNotifyMessage({title, desc, onClose, onViewProcess, success=true, dataTestSuffix=''}) { - const classes = useStyles(); return ( - - + + {title} - } onClick={onClose} title={'Close'} className={success ? classes.iconSuccess : classes.iconError} /> + } onClick={onClose} title={'Close'} className={success ? 'BgProcessNotify-iconSuccess' : 'BgProcessNotify-iconError'} /> - + {desc} } onClick={()=>{ @@ -64,7 +59,7 @@ function ProcessNotifyMessage({title, desc, onClose, onViewProcess, success=true }}>View Processes - + ); } ProcessNotifyMessage.propTypes = { diff --git a/web/pgadmin/misc/bgprocess/static/js/ProcessDetails.jsx b/web/pgadmin/misc/bgprocess/static/js/ProcessDetails.jsx index a18b0da9e..693b54b2e 100644 --- a/web/pgadmin/misc/bgprocess/static/js/ProcessDetails.jsx +++ b/web/pgadmin/misc/bgprocess/static/js/ProcessDetails.jsx @@ -8,10 +8,10 @@ ////////////////////////////////////////////////////////////// import React, { useState, useMemo } from 'react'; +import { styled } from '@mui/material/styles'; import gettext from 'sources/gettext'; import url_for from 'sources/url_for'; import { Box } from '@mui/material'; -import { makeStyles } from '@mui/styles'; import PropTypes from 'prop-types'; import { MESSAGE_TYPE, NotifierMessage } from '../../../../static/js/components/FormComponents'; import { BgProcessManagerProcessState } from './BgProcessConstants'; @@ -24,16 +24,14 @@ import pgAdmin from 'sources/pgadmin'; import FolderSharedRoundedIcon from '@mui/icons-material/FolderSharedRounded'; -const useStyles = makeStyles((theme)=>({ - container: { - backgroundColor: theme.palette.background.default, - height: '100%', - display: 'flex', - flexDirection: 'column', - padding: '8px', - userSelect: 'text', - }, - cmd: { +const StyledBox = styled(Box)(({theme}) => ({ + backgroundColor: theme.palette.background.default, + height: '100%', + display: 'flex', + flexDirection: 'column', + padding: '8px', + userSelect: 'text', + '& .ProcessDetails-cmd': { ...theme.mixins.panelBorder.all, borderRadius: theme.shape.borderRadius, backgroundColor: theme.otherVars.inputDisabledBg, @@ -41,19 +39,7 @@ const useStyles = makeStyles((theme)=>({ margin: '8px 0px', padding: '4px', }, - logs: { - flexGrow: 1, - borderRadius: theme.shape.borderRadius, - padding: '4px', - overflow: 'auto', - textOverflow: 'wrap-text', - margin: '8px 0px', - ...theme.mixins.panelBorder.all, - }, - logErr: { - color: theme.palette.error.main, - }, - terminateBtn: { + '& .ProcessDetails-terminateBtn': { backgroundColor: theme.palette.error.main, color: theme.palette.error.contrastText, border: 0, @@ -65,7 +51,20 @@ const useStyles = makeStyles((theme)=>({ color: theme.palette.error.contrastText + ' !important', border: 0, } - } + }, + '& .ProcessDetails-logs': { + flexGrow: 1, + borderRadius: theme.shape.borderRadius, + padding: '4px', + overflow: 'auto', + textOverflow: 'wrap-text', + margin: '8px 0px', + ...theme.mixins.panelBorder.all, + + '& .ProcessDetails-logErr': { + color: theme.palette.error.main, + }, + }, })); async function getDetailedStatus(api, jobId, out, err) { @@ -80,7 +79,6 @@ async function getDetailedStatus(api, jobId, out, err) { } export default function ProcessDetails({data}) { - const classes = useStyles(); const api = useMemo(()=>getApiInstance()); const [logs, setLogs] = useState(null); const [completed, setCompleted] = useState(false); @@ -149,15 +147,15 @@ export default function ProcessDetails({data}) { const errRe = new RegExp(': (' + gettext('error') + '|' + gettext('fatal') + '):', 'i'); return ( - + {data.details?.message} {data.details?.cmd && <> {gettext('Running command')}: - {data.details.cmd} + {data.details.cmd} } {data.details?.query && <> {gettext('Running query')}: - {data.details.query} + {data.details.query} } {gettext('Start time')}: {new Date(data.stime).toString()} @@ -167,12 +165,12 @@ export default function ProcessDetails({data}) { pgAdmin.Tools.FileManager.openStorageManager(data.current_storage_dir); }} style={{marginRight: '4px'}} />} } className={classes.terminateBtn} onClick={onStopProcess}> + startIcon={} className='ProcessDetails-terminateBtn' onClick={onStopProcess}> Stop Process - + {logs == null && {gettext('Loading process logs...')}} {logs?.length == 0 && gettext('No logs available.')} {logs?.map((log, i)=>{ @@ -181,14 +179,14 @@ export default function ProcessDetails({data}) { if(i==logs.length-1) { el?.scrollIntoView(); } - }} key={id} className={errRe.test(log) ? classes.logErr : ''}>{log}
; + }} key={id} className={errRe.test(log) ? 'ProcessDetails-logErr' : ''}>{log}
; })} {gettext('Execution time')}: {timeTaken} {gettext('seconds')} - + ); } diff --git a/web/pgadmin/misc/bgprocess/static/js/Processes.jsx b/web/pgadmin/misc/bgprocess/static/js/Processes.jsx index 893155f79..b82988e63 100644 --- a/web/pgadmin/misc/bgprocess/static/js/Processes.jsx +++ b/web/pgadmin/misc/bgprocess/static/js/Processes.jsx @@ -8,10 +8,10 @@ ////////////////////////////////////////////////////////////// import React, { useCallback, useEffect, useMemo } from 'react'; +import { styled } from '@mui/material/styles'; import PgTable from 'sources/components/PgTable'; import gettext from 'sources/gettext'; import PropTypes from 'prop-types'; -import { makeStyles } from '@mui/styles'; import { BgProcessManagerEvents, BgProcessManagerProcessState } from './BgProcessConstants'; import { PgButtonGroup, PgIconButton } from '../../../../static/js/components/Buttons'; import CancelIcon from '@mui/icons-material/Cancel'; @@ -26,67 +26,36 @@ import ErrorBoundary from '../../../../static/js/helpers/ErrorBoundary'; import ProcessDetails from './ProcessDetails'; -const useStyles = makeStyles((theme) => ({ - stopButton: { +const Root = styled('div')(({theme}) => ({ + height: '100%', + '& .Processes-stopButton': { color: theme.palette.error.main }, - buttonClick: { - backgroundColor: theme.palette.grey[400] - }, - emptyPanel: { - minHeight: '100%', - minWidth: '100%', - background: theme.otherVars.emptySpaceBg, - overflow: 'auto', - padding: '8px', - display: 'flex', - }, - panelIcon: { - width: '80%', - margin: '0 auto', - marginTop: '25px !important', - position: 'relative', - textAlign: 'center', - }, - panelMessage: { - marginLeft: '0.5rem', - fontSize: '0.875rem', - }, - autoResizer: { - height: '100% !important', - width: '100% !important', - background: theme.palette.grey[400], - padding: '7.5px', - overflow: 'auto !important', - minHeight: '100%', - minWidth: '100%', - }, - noPadding: { - padding: 0, - }, - bgSucess: { - backgroundColor: theme.palette.success.light, - height: '100%', - padding: '4px', - }, - bgFailed: { - backgroundColor: theme.palette.error.light, - height: '100%', - padding: '4px', - }, - bgTerm: { - backgroundColor: theme.palette.warning.light, - height: '100%', - padding: '4px', - }, - bgRunning: { - backgroundColor: theme.palette.primary.light, - height: '100%', - padding: '4px', + '& .Processes-noPadding': { + padding: '0 !important', + '& .Processes-bgSucess': { + backgroundColor: theme.palette.success.light, + height: '100%', + padding: '4px', + }, + '& .Processes-bgFailed': { + backgroundColor: theme.palette.error.light, + height: '100%', + padding: '4px', + }, + '& .Processes-bgTerm': { + backgroundColor: theme.palette.warning.light, + height: '100%', + padding: '4px', + }, + '& .Processes-bgRunning': { + backgroundColor: theme.palette.primary.light, + height: '100%', + padding: '4px', + } }, })); - const ProcessStateTextAndColor = { [BgProcessManagerProcessState.PROCESS_NOT_STARTED]: [gettext('Not started'), 'bgRunning'], [BgProcessManagerProcessState.PROCESS_STARTED]: [gettext('Running'), 'bgRunning'], @@ -96,7 +65,7 @@ const ProcessStateTextAndColor = { [BgProcessManagerProcessState.PROCESS_FAILED]: [gettext('Failed'), 'bgFailed'], }; export default function Processes() { - const classes = useStyles(); + const pgAdmin = usePgAdmin(); const [tableData, setTableData] = React.useState([]); const [selectedRows, setSelectedRows] = React.useState({}); @@ -130,7 +99,7 @@ export default function Processes() { size="xs" noBorder icon={} - className={classes.stopButton} + className='Processes-stopButton' disabled={row.original.process_state != BgProcessManagerProcessState.PROCESS_STARTED || row.original.server_id != null} onClick={(e) => { @@ -165,7 +134,7 @@ export default function Processes() { const StatusCell = ({row})=>{ const [text, bgcolor] = ProcessStateTextAndColor[row.original.process_state]; - return {text}; + return {text}; }; StatusCell.displayName = 'StatusCell'; StatusCell.propTypes = cellPropTypes; @@ -247,7 +216,7 @@ export default function Processes() { width: 120, minWidth: 120, accessorFn: (row)=>ProcessStateTextAndColor[row.process_state][0], - dataClassName: classes.noPadding, + dataClassName: 'Processes-noPadding', cell: StatusCell, }, { @@ -274,48 +243,48 @@ export default function Processes() { }, []); return ( - { - return row.id; - } - }} - CustomHeader={()=>{ - return ( - - - } - aria-label="Acknowledge and Remove" - title={gettext('Acknowledge and Remove')} - onClick={() => { - pgAdmin.Browser.notifier.confirm(gettext('Remove Processes'), gettext('Are you sure you want to remove the selected processes?'), ()=>{ - pgAdmin.Browser.BgProcessManager.acknowledge(selectedRowIDs); - setSelectedRows({}); - }); - }} - disabled={selectedRowIDs.length <= 0} - > - } - aria-label="Help" - title={gettext('Help')} - onClick={() => { - window.open(url_for('help.static', {'filename': 'processes.html'})); - }} - > - - - ); - }} - > + + { + return row.id; + } + }} + CustomHeader={()=>{ + return ( + + + } + aria-label="Acknowledge and Remove" + title={gettext('Acknowledge and Remove')} + onClick={() => { + pgAdmin.Browser.notifier.confirm(gettext('Remove Processes'), gettext('Are you sure you want to remove the selected processes?'), ()=>{ + pgAdmin.Browser.BgProcessManager.acknowledge(selectedRowIDs); + setSelectedRows({}); + }); + }} + disabled={selectedRowIDs.length <= 0} + > + } + aria-label="Help" + title={gettext('Help')} + onClick={() => { + window.open(url_for('help.static', {'filename': 'processes.html'})); + }} + > + + + ); + }} + > ); } diff --git a/web/pgadmin/misc/cloud/static/js/CloudWizard.jsx b/web/pgadmin/misc/cloud/static/js/CloudWizard.jsx index 5f7969207..567bccfb8 100644 --- a/web/pgadmin/misc/cloud/static/js/CloudWizard.jsx +++ b/web/pgadmin/misc/cloud/static/js/CloudWizard.jsx @@ -11,7 +11,6 @@ import gettext from 'sources/gettext'; import url_for from 'sources/url_for'; import React from 'react'; import { Box, Paper } from '@mui/material'; -import { makeStyles } from '@mui/styles'; import Wizard from '../../../../static/js/helpers/wizard/Wizard'; import WizardStep from '../../../../static/js/helpers/wizard/WizardStep'; import {FormFooterMessage, MESSAGE_TYPE } from '../../../../static/js/components/FormComponents'; @@ -30,42 +29,9 @@ import EventBus from '../../../../static/js/helpers/EventBus'; import { CLOUD_PROVIDERS, CLOUD_PROVIDERS_LABELS } from './cloud_constants'; import { LAYOUT_EVENTS } from '../../../../static/js/helpers/Layout'; - -const useStyles = makeStyles(() => - ({ - messageBox: { - marginBottom: '1em', - display: 'flex', - }, - messagePadding: { - paddingTop: '10px', - flex: 2.5, - }, - buttonMarginEDB: { - position: 'relative', - top: '20%', - }, - toggleButton: { - height: '100px', - }, - summaryContainer: { - flexGrow: 1, - minHeight: 0, - overflow: 'auto', - }, - boxText: { - paddingBottom: '5px' - }, - authButton: { - marginLeft: '12em' - } - }), -); - export const CloudWizardEventsContext = React.createContext(); export default function CloudWizard({ nodeInfo, nodeData, onClose, cloudPanelId}) { - const classes = useStyles(); const eventBus = React.useRef(new EventBus()); let steps = [gettext('Cloud Provider'), gettext('Credentials'), gettext('Cluster Type'), @@ -416,10 +382,10 @@ export default function CloudWizard({ nodeInfo, nodeData, onClose, cloudPanelId} }); let cloud_providers = [ - {label: gettext(CLOUD_PROVIDERS_LABELS.AWS), value: CLOUD_PROVIDERS.AWS, icon: }, - {label: gettext(CLOUD_PROVIDERS_LABELS.BIGANIMAL), value: CLOUD_PROVIDERS.BIGANIMAL, icon: }, - {label: gettext(CLOUD_PROVIDERS_LABELS.AZURE), value: CLOUD_PROVIDERS.AZURE, icon: }, - {label: gettext(CLOUD_PROVIDERS_LABELS.GOOGLE), value: CLOUD_PROVIDERS.GOOGLE, icon: }]; + {label: gettext(CLOUD_PROVIDERS_LABELS.AWS), value: CLOUD_PROVIDERS.AWS, icon: }, + {label: gettext(CLOUD_PROVIDERS_LABELS.BIGANIMAL), value: CLOUD_PROVIDERS.BIGANIMAL, icon: }, + {label: gettext(CLOUD_PROVIDERS_LABELS.AZURE), value: CLOUD_PROVIDERS.AZURE, icon: }, + {label: gettext(CLOUD_PROVIDERS_LABELS.GOOGLE), value: CLOUD_PROVIDERS.GOOGLE, icon: }]; return ( @@ -433,10 +399,10 @@ export default function CloudWizard({ nodeInfo, nodeData, onClose, cloudPanelId} beforeNext={onBeforeNext} beforeBack={onBeforeBack}> - - {gettext('Select a cloud provider for PostgreSQL database.')} + + {gettext('Select a cloud provider for PostgreSQL database.')} - + @@ -444,8 +410,8 @@ export default function CloudWizard({ nodeInfo, nodeData, onClose, cloudPanelId} - - {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && + + {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && {gettext('The verification code to authenticate the pgAdmin to EDB BigAnimal is: ')} {verificationCode}
{gettext('By clicking the below button, you will be redirected to the EDB BigAnimal authentication page in a new tab.')}
@@ -453,7 +419,7 @@ export default function CloudWizard({ nodeInfo, nodeData, onClose, cloudPanelId} {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && {gettext('Click here to authenticate yourself to EDB BigAnimal')} } - {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && + {cloudProvider == CLOUD_PROVIDERS.BIGANIMAL && } @@ -542,8 +508,8 @@ export default function CloudWizard({ nodeInfo, nodeData, onClose, cloudPanelId} }
- {gettext('Please review the details before creating the cloud instance.')} - + {gettext('Please review the details before creating the cloud instance.')} + {cloudProvider == CLOUD_PROVIDERS.AWS && callRDSAPI == 5 && +const StyledSchemaView= styled(SchemaView)(() => ({ - formClass: { + '& .aws-formClass': { overflow: 'auto', } - }), -); + })); // AWS credentials export function AwsCredentials(props) { @@ -66,7 +65,7 @@ AwsCredentials.propTypes = { // AWS Instance Details export function AwsInstanceDetails(props) { const [cloudInstanceDetailsInstance, setCloudInstanceDetailsInstance] = React.useState(); - const classes = useStyles(); + React.useMemo(() => { const cloudDBInstanceSchema = new CloudInstanceDetailsSchema({ @@ -114,7 +113,7 @@ export function AwsInstanceDetails(props) { }, [props.cloudProvider]); - return { /*This is intentional (SonarQube)*/ }} viewHelperProps={{ mode: 'create' }} @@ -124,7 +123,7 @@ export function AwsInstanceDetails(props) { onDataChange={(isChanged, changedData) => { props.setCloudInstanceDetails(changedData); }} - formClassName={classes.formClass} + formClassName='aws-formClass' />; } AwsInstanceDetails.propTypes = { diff --git a/web/pgadmin/misc/cloud/static/js/azure.js b/web/pgadmin/misc/cloud/static/js/azure.js index b79900320..101aefed1 100644 --- a/web/pgadmin/misc/cloud/static/js/azure.js +++ b/web/pgadmin/misc/cloud/static/js/azure.js @@ -18,15 +18,6 @@ import getApiInstance from '../../../../static/js/api_instance'; import { CloudWizardEventsContext } from './CloudWizard'; import {MESSAGE_TYPE } from '../../../../static/js/components/FormComponents'; import gettext from 'sources/gettext'; -import { makeStyles } from '@mui/styles'; - -const useStyles = makeStyles(() => - ({ - formClass: { - overflow: 'auto', - } - }), -); // Azure credentials export function AzureCredentials(props) { @@ -111,7 +102,6 @@ AzureCredentials.propTypes = { // Azure Instance export function AzureInstanceDetails(props) { const [azureInstanceSchema, setAzureInstanceSchema] = React.useState(); - const classes = useStyles(); React.useMemo(() => { const AzureSchema = new AzureClusterSchema({ @@ -195,7 +185,6 @@ export function AzureInstanceDetails(props) { onDataChange={(isChanged, changedData) => { props.setAzureInstanceData(changedData); }} - formClassName={classes.formClass} />; } AzureInstanceDetails.propTypes = { @@ -211,7 +200,6 @@ AzureInstanceDetails.propTypes = { // Azure Database Details export function AzureDatabaseDetails(props) { const [azureDBInstance, setAzureDBInstance] = React.useState(); - const classes = useStyles(); React.useMemo(() => { const azureDBSchema = new AzureDatabaseSchema({ @@ -235,7 +223,6 @@ export function AzureDatabaseDetails(props) { onDataChange={(isChanged, changedData) => { props.setAzureDatabaseData(changedData); }} - formClassName={classes.formClass} />; } AzureDatabaseDetails.propTypes = { diff --git a/web/pgadmin/misc/cloud/static/js/cloud_components.jsx b/web/pgadmin/misc/cloud/static/js/cloud_components.jsx index 95e2e7d6f..461386a2e 100644 --- a/web/pgadmin/misc/cloud/static/js/cloud_components.jsx +++ b/web/pgadmin/misc/cloud/static/js/cloud_components.jsx @@ -11,38 +11,18 @@ import React from 'react'; import { ToggleButton, ToggleButtonGroup } from '@mui/material'; import CheckRoundedIcon from '@mui/icons-material/CheckRounded'; import { DefaultButton, PrimaryButton } from '../../../../static/js/components/Buttons'; -import { makeStyles } from '@mui/styles'; import PropTypes from 'prop-types'; import { getAWSSummary } from './aws'; import {getAzureSummary} from './azure'; import { getBigAnimalSummary } from './biganimal'; -import { commonTableStyles } from '../../../../static/js/Theme'; -import { Table, TableBody, TableCell, TableHead, TableRow } from '@mui/material'; -import clsx from 'clsx'; +import { TableBody, TableCell, TableHead, TableRow } from '@mui/material'; import gettext from 'sources/gettext'; import { getGoogleSummary } from './google'; import { CLOUD_PROVIDERS_LABELS } from './cloud_constants'; - -const useStyles = makeStyles(() => - ({ - toggleButtonGroup: { - height: '100px', - flexGrow: '1' - }, - toggleButtonMargin:{ - marginTop: '0px !important', - padding: '12px' - }, - gcpiconpadding:{ - paddingLeft: '1.5rem' - } - - }), -); +import Table from '../../../../static/js/components/Table'; export function ToggleButtons(props) { - const classes = useStyles(); const handleCloudProvider = (event, provider) => { if (provider) props.setCloudProvider(provider); @@ -53,12 +33,12 @@ export function ToggleButtons(props) { color="primary" value={props.cloudProvider} onChange={handleCloudProvider} - className={classes.toggleButtonGroup} + sx={{ height: '100px', flexGrow: '1'}} orientation="vertical" exclusive> { (props.options||[]).map((option)=>{ - return ( + return (   {option.icon}    {option.label} ); @@ -75,7 +55,6 @@ ToggleButtons.propTypes = { export function FinalSummary(props) { - const tableClasses = commonTableStyles(); let summary = [], summaryHeader = ['Cloud Details', 'Version and Instance Details', 'Storage Details', 'Database Details']; @@ -104,7 +83,7 @@ export function FinalSummary(props) { return summary.map((item, index) => { return ( - +
{gettext(summaryHeader[index])} diff --git a/web/pgadmin/misc/cloud/static/js/google.js b/web/pgadmin/misc/cloud/static/js/google.js index 84e1990e7..831f345ad 100644 --- a/web/pgadmin/misc/cloud/static/js/google.js +++ b/web/pgadmin/misc/cloud/static/js/google.js @@ -18,15 +18,6 @@ import getApiInstance from '../../../../static/js/api_instance'; import { CloudWizardEventsContext } from './CloudWizard'; import {MESSAGE_TYPE } from '../../../../static/js/components/FormComponents'; import gettext from 'sources/gettext'; -import { makeStyles } from '@mui/styles'; - -const useStyles = makeStyles(() => - ({ - formClass: { - overflow: 'auto', - } - }), -); export function GoogleCredentials(props) { @@ -126,7 +117,6 @@ GoogleCredentials.propTypes = { // Google Instance export function GoogleInstanceDetails(props) { const [googleInstanceSchema, setGoogleInstanceSchema] = React.useState(); - const classes = useStyles(); React.useMemo(() => { const GoogleClusterSchemaObj = new GoogleClusterSchema({ @@ -186,7 +176,6 @@ export function GoogleInstanceDetails(props) { onDataChange={(isChanged, changedData) => { props.setGoogleInstanceData(changedData); }} - formClassName={classes.formClass} />; } GoogleInstanceDetails.propTypes = { @@ -202,7 +191,6 @@ GoogleInstanceDetails.propTypes = { // Google Database Details export function GoogleDatabaseDetails(props) { const [googleDBInstance, setGoogleDBInstance] = React.useState(); - const classes = useStyles(); React.useMemo(() => { const googleDBSchema = new GoogleDatabaseSchema({ @@ -226,7 +214,6 @@ export function GoogleDatabaseDetails(props) { onDataChange={(isChanged, changedData) => { props.setGoogleDatabaseData(changedData); }} - formClassName={classes.formClass} />; } GoogleDatabaseDetails.propTypes = { diff --git a/web/pgadmin/misc/dependencies/static/js/Dependencies.jsx b/web/pgadmin/misc/dependencies/static/js/Dependencies.jsx index 25e462bfd..8f8b67073 100644 --- a/web/pgadmin/misc/dependencies/static/js/Dependencies.jsx +++ b/web/pgadmin/misc/dependencies/static/js/Dependencies.jsx @@ -8,12 +8,12 @@ ////////////////////////////////////////////////////////////// import _ from 'lodash'; +import { styled } from '@mui/material/styles'; import React, { useEffect } from 'react'; import PgTable from 'sources/components/PgTable'; import gettext from 'sources/gettext'; import PropTypes from 'prop-types'; import getApiInstance from 'sources/api_instance'; -import { makeStyles } from '@mui/styles'; import { getURL } from '../../../static/utils/utils'; import Loader from 'sources/components/Loader'; import EmptyPanelMessage from '../../../../static/js/components/EmptyPanelMessage'; @@ -22,8 +22,9 @@ import withStandardTabInfo from '../../../../static/js/helpers/withStandardTabIn import { BROWSER_PANELS } from '../../../../browser/static/js/constants'; import { usePgAdmin } from '../../../../static/js/BrowserComponent'; -const useStyles = makeStyles((theme) => ({ - emptyPanel: { +const Root = styled('div')(({theme}) => ({ + height : '100%', + '& .Dependencies-emptyPanel': { minHeight: '100%', minWidth: '100%', background: theme.otherVars.emptySpaceBg, @@ -31,26 +32,6 @@ const useStyles = makeStyles((theme) => ({ padding: '8px', display: 'flex', }, - panelIcon: { - width: '80%', - margin: '0 auto', - marginTop: '25px !important', - position: 'relative', - textAlign: 'center', - }, - panelMessage: { - marginLeft: '0.5rem', - fontSize: '0.875rem', - }, - autoResizer: { - height: '100% !important', - width: '100% !important', - background: theme.palette.grey[400], - padding: '7.5px', - overflow: 'auto !important', - minHeight: '100%', - minWidth: '100%', - }, })); function parseData(data, node) { @@ -75,7 +56,7 @@ function parseData(data, node) { } function Dependencies({ nodeData, nodeItem, node, treeNodeInfo, isActive, isStale, setIsStale }) { - const classes = useStyles(); + const [tableData, setTableData] = React.useState([]); const [loaderText, setLoaderText] = React.useState(''); const [msg, setMsg] = React.useState(''); @@ -164,23 +145,22 @@ function Dependencies({ nodeData, nodeItem, node, treeNodeInfo, isActive, isStal }, [isActive, isStale]); return ( - <> + ( {tableData.length > 0 ? ( ) : ( -
+
{loaderText ? () : }
)} - + ) ); } diff --git a/web/pgadmin/misc/dependents/static/js/Dependents.jsx b/web/pgadmin/misc/dependents/static/js/Dependents.jsx index a0867aed8..17d9822d0 100644 --- a/web/pgadmin/misc/dependents/static/js/Dependents.jsx +++ b/web/pgadmin/misc/dependents/static/js/Dependents.jsx @@ -8,12 +8,12 @@ ////////////////////////////////////////////////////////////// import _ from 'lodash'; +import { styled } from '@mui/material/styles'; import React, { useEffect } from 'react'; import PgTable from 'sources/components/PgTable'; import gettext from 'sources/gettext'; import PropTypes from 'prop-types'; import getApiInstance from 'sources/api_instance'; -import { makeStyles } from '@mui/styles'; import { getURL } from '../../../static/utils/utils'; import Loader from 'sources/components/Loader'; import EmptyPanelMessage from '../../../../static/js/components/EmptyPanelMessage'; @@ -22,8 +22,9 @@ import withStandardTabInfo from '../../../../static/js/helpers/withStandardTabIn import { BROWSER_PANELS } from '../../../../browser/static/js/constants'; import { usePgAdmin } from '../../../../static/js/BrowserComponent'; -const useStyles = makeStyles((theme) => ({ - emptyPanel: { +const Root = styled('div')(({theme}) => ({ + height : '100%', + '& .Dependents-emptyPanel': { minHeight: '100%', minWidth: '100%', background: theme.otherVars.emptySpaceBg, @@ -31,26 +32,6 @@ const useStyles = makeStyles((theme) => ({ padding: '8px', display: 'flex', }, - panelIcon: { - width: '80%', - margin: '0 auto', - marginTop: '25px !important', - position: 'relative', - textAlign: 'center', - }, - panelMessage: { - marginLeft: '0.5rem', - fontSize: '0.875rem', - }, - autoResizer: { - height: '100% !important', - width: '100% !important', - background: theme.palette.grey[400], - padding: '7.5px', - overflow: 'auto !important', - minHeight: '100%', - minWidth: '100%', - }, })); function parseData(data, node) { @@ -75,7 +56,7 @@ function parseData(data, node) { } function Dependents({ nodeData, nodeItem, node, treeNodeInfo, isActive, isStale, setIsStale }) { - const classes = useStyles(); + const [tableData, setTableData] = React.useState([]); const [loaderText, setLoaderText] = React.useState(''); const [msg, setMsg] = React.useState(''); @@ -164,24 +145,23 @@ function Dependents({ nodeData, nodeItem, node, treeNodeInfo, isActive, isStale, }, [isActive, isStale]); return ( - <> + ( {tableData.length > 0 ? ( ) : ( -
+
{loaderText ? () : }
)} - + ) ); } diff --git a/web/pgadmin/misc/file_manager/static/js/components/FileManager.jsx b/web/pgadmin/misc/file_manager/static/js/components/FileManager.jsx index dbffcb0db..279fe9bf1 100644 --- a/web/pgadmin/misc/file_manager/static/js/components/FileManager.jsx +++ b/web/pgadmin/misc/file_manager/static/js/components/FileManager.jsx @@ -7,10 +7,9 @@ // ////////////////////////////////////////////////////////////// import { Box } from '@mui/material'; -import { makeStyles } from '@mui/styles'; +import { styled } from '@mui/material/styles'; import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'; import { DefaultButton, PgButtonGroup, PgIconButton, PrimaryButton } from '../../../../../static/js/components/Buttons'; -import { useModalStyles } from '../../../../../static/js/helpers/ModalProvider'; import CloseIcon from '@mui/icons-material/CloseRounded'; import FolderSharedIcon from '@mui/icons-material/FolderShared'; import FolderIcon from '@mui/icons-material/Folder'; @@ -23,7 +22,6 @@ import SyncRoundedIcon from '@mui/icons-material/SyncRounded'; import CreateNewFolderRoundedIcon from '@mui/icons-material/CreateNewFolderRounded'; import GetAppRoundedIcon from '@mui/icons-material/GetAppRounded'; import gettext from 'sources/gettext'; -import clsx from 'clsx'; import { FormFooterMessage, InputSelectNonSearch, InputText, MESSAGE_TYPE } from '../../../../../static/js/components/FormComponents'; import ListView from './ListView'; import { PgMenu, PgMenuDivider, PgMenuItem, usePgMenuGroup } from '../../../../../static/js/components/Menu'; @@ -39,40 +37,59 @@ import ErrorBoundary from '../../../../../static/js/helpers/ErrorBoundary'; import { MY_STORAGE } from './FileManagerConstants'; import _ from 'lodash'; -const useStyles = makeStyles((theme)=>({ - footerSaveAs: { +const StyledBox = styled(Box)(({theme}) => ({ + backgroundColor: theme.palette.background.default, + '& .FileManager-toolbar': { + padding: '4px', + display: 'flex', + ...theme.mixins.panelBorder?.bottom, + '& .FileManager-sharedStorage': { + width: '3rem !important', + }, + '& .FileManager-inputFilename': { + lineHeight: 1, + width: '100%', + }, + '& .FileManager-inputSearch': { + marginLeft: '4px', + lineHeight: 1, + width: '130px', + }, + '& .FileManager-storageName': { + paddingLeft: '0.2rem' + }, + '& .FileManager-sharedIcon': { + width: '1.3rem' + } + }, + '& .FileManager-footer': { + display: 'flex', + justifyContent: 'flex-end', + padding: '0.5rem', + ...theme.mixins.panelBorder?.top, + '& .FileManager-margin': { + marginLeft: '0.25rem', + }, + }, + '& .FileManager-footer1': { + justifyContent: 'space-between', + padding: '4px 8px', + display: 'flex', + alignItems: 'center', + '& .FileManager-formatSelect': { + '& .MuiSelect-select': { + paddingTop: '4px', + paddingBottom: '4px', + } + }, + }, + '& .FileManager-footerSaveAs': { justifyContent: 'initial', padding: '4px 8px', display: 'flex', alignItems: 'center', }, - footer1: { - justifyContent: 'space-between', - padding: '4px 8px', - display: 'flex', - alignItems: 'center', - }, - toolbar: { - padding: '4px', - display: 'flex', - ...theme.mixins.panelBorder?.bottom, - }, - inputFilename: { - lineHeight: 1, - width: '100%', - }, - inputSearch: { - marginLeft: '4px', - lineHeight: 1, - width: '130px', - }, - formatSelect: { - '& .MuiSelect-select': { - paddingTop: '4px', - paddingBottom: '4px', - } - }, - replaceOverlay: { + '& .FileManager-replaceOverlay': { position: 'absolute', top: 0, bottom: 0, @@ -82,7 +99,7 @@ const useStyles = makeStyles((theme)=>({ zIndex: 2, display: 'flex', }, - replaceDialog: { + '& .FileManager-replaceDialog': { margin: 'auto', marginLeft: '1rem', marginRight: '1rem', @@ -91,15 +108,6 @@ const useStyles = makeStyles((theme)=>({ width: '100%', ...theme.mixins.panelBorder.all, }, - sharedStorage: { - width: '3rem !important', - }, - storageName: { - paddingLeft: '0.2rem' - }, - sharedIcon: { - width: '1.3rem' - } })); export function getComparator(sortColumn) { @@ -383,15 +391,13 @@ export class FileManagerUtils { } function ConfirmFile({text, onYes, onNo}) { - const classes = useStyles(); - const modalClasses = useModalStyles(); return ( - - + + {text}{} - + } onClick={onNo} >{gettext('No')} - } + } onClick={onYes} autoFocus>{gettext('Yes')} @@ -405,8 +411,8 @@ ConfirmFile.propTypes = { }; export default function FileManager({params, closeModal, onOK, onCancel, sharedStorages=[], restrictedSharedStorage=[]}) { - const classes = useStyles(); - const modalClasses = useModalStyles(); + + const apiObj = useMemo(()=>getApiInstance(), []); const fmUtilsObj = useMemo(()=>new FileManagerUtils(apiObj, params), []); @@ -694,15 +700,15 @@ export default function FileManager({params, closeModal, onOK, onCancel, sharedS return ( - + {Boolean(confirmText) && setConfirmFile([null, null])} onYes={onConfirmYes}/>} - + { sharedStorages.length > 0 && : <>} splitButton - name="menu-shared-storage" ref={sharedSRef} onClick={toggleMenu} className={classes.sharedStorage}/> + name="menu-shared-storage" ref={sharedSRef} onClick={toggleMenu} className='FileManager-sharedStorage'/> } { await openDir(fmUtilsObj.config?.options?.homedir, selectedSS); @@ -710,7 +716,7 @@ export default function FileManager({params, closeModal, onOK, onCancel, sharedS { await openDir(fmUtilsObj.dirname(fmUtilsObj.currPath), selectedSS); }} icon={} disabled={!fmUtilsObj.dirname(fmUtilsObj.currPath) || showUploader} /> - { @@ -724,7 +730,7 @@ export default function FileManager({params, closeModal, onOK, onCancel, sharedS await openDir(path, selectedSS); }} icon={} disabled={showUploader} /> - + {params.dialog_type == 'storage_dialog' && } @@ -777,7 +783,7 @@ export default function FileManager({params, closeModal, onOK, onCancel, sharedS onClick={async (option)=> { option.keepOpen = false; await changeDir(option.value); - }}>{gettext('My Storage')} + }}>{gettext('My Storage')} { sharedStorages.map((ss)=> { @@ -786,7 +792,7 @@ export default function FileManager({params, closeModal, onOK, onCancel, sharedS onClick={async(option)=> { option.keepOpen = false; await changeDir(option.value); - }}>{gettext(ss)}); + }}>{gettext(ss)}); }) } @@ -810,16 +816,16 @@ export default function FileManager({params, closeModal, onOK, onCancel, sharedS onItemSelect={onItemSelect} />} setErrorMsg('')} /> {params.dialog_type == 'create_file' && - + Save As } {params.dialog_type != 'select_folder' && - + {itemsText} File Format - { let val = e.target.value; fmUtilsObj.setFileType(val); @@ -833,7 +839,7 @@ export default function FileManager({params, closeModal, onOK, onCancel, sharedS } - + } onClick={()=>{ @@ -841,10 +847,10 @@ export default function FileManager({params, closeModal, onOK, onCancel, sharedS closeModal(); }} >{gettext('Cancel')} {params.dialog_type != 'storage_dialog' && - } + } onClick={onOkClick} disabled={okBtnDisable || showUploader}>{okBtnText}} - + ); } diff --git a/web/pgadmin/misc/file_manager/static/js/components/GridView.jsx b/web/pgadmin/misc/file_manager/static/js/components/GridView.jsx index acef14e79..b9fcb2e1b 100644 --- a/web/pgadmin/misc/file_manager/static/js/components/GridView.jsx +++ b/web/pgadmin/misc/file_manager/static/js/components/GridView.jsx @@ -7,7 +7,7 @@ // ////////////////////////////////////////////////////////////// import { Box } from '@mui/material'; -import { makeStyles } from '@mui/styles'; +import { styled } from '@mui/material/styles'; import React, {useState, useEffect, useRef, useLayoutEffect} from 'react'; import FolderIcon from '@mui/icons-material/Folder'; import DescriptionIcon from '@mui/icons-material/Description'; @@ -16,49 +16,47 @@ import StorageRoundedIcon from '@mui/icons-material/StorageRounded'; import PropTypes from 'prop-types'; import gettext from 'sources/gettext'; - -const useStyles = makeStyles((theme)=>({ - grid: { +const StyledBox = styled(Box)(({theme}) => ({ + '& .GridView-grid': { display: 'flex', fontSize: '13px', flexWrap: 'wrap', overflow: 'hidden', - }, - gridItem: { - width: '100px', - margin: '4px', - textAlign: 'center', - position: 'relative', - border: '1px solid transparent', - cursor: 'pointer', - '&[aria-selected=true]': { - backgroundColor: theme.palette.primary.light, - color: theme.otherVars.qtDatagridSelectFg, - borderColor: theme.palette.primary.main, + '& .GridView-gridItem': { + width: '100px', + margin: '4px', + textAlign: 'center', + position: 'relative', + border: '1px solid transparent', + cursor: 'pointer', + '&[aria-selected=true]': { + backgroundColor: theme.palette.primary.light, + color: theme.otherVars.qtDatagridSelectFg, + borderColor: theme.palette.primary.main, + }, + '& .GridView-gridItemContent': { + padding: '4px', + '& .GridView-gridFilename': { + overflowWrap: 'break-word', + }, + '& .GridView-gridItemEdit': { + border: `1px solid ${theme.otherVars.inputBorderColor}`, + backgroundColor: theme.palette.background.default, + }, + '& .GridView-protected': { + height: '1.25rem', + width: '1.25rem', + position: 'absolute', + left: '52px', + color: theme.palette.error.main, + backgroundColor: 'inherit', + } + }, }, }, - gridItemContent: { - padding: '4px', - }, - gridFilename: { - overflowWrap: 'break-word', - }, - gridItemEdit: { - border: `1px solid ${theme.otherVars.inputBorderColor}`, - backgroundColor: theme.palette.background.default, - }, - protected: { - height: '1.25rem', - width: '1.25rem', - position: 'absolute', - left: '52px', - color: theme.palette.error.main, - backgroundColor: 'inherit', - } })); export function ItemView({idx, row, selected, onItemSelect, onItemEnter, onEditComplete}) { - const classes = useStyles(); const editMode = Boolean(onEditComplete); const fileNameRef = useRef(); @@ -98,14 +96,14 @@ export function ItemView({idx, row, selected, onItemSelect, onItemEnter, onEditC } return ( -
onItemSelect(idx)} onDoubleClick={()=>onItemEnter(row)} onKeyDown={handleItemKeyDown} role="gridcell"> -
+
onItemSelect(idx)} onDoubleClick={()=>onItemEnter(row)} onKeyDown={handleItemKeyDown} role="gridcell"> +
{icon} - {Boolean(row.Protected) && } + {Boolean(row.Protected) && }
onEditComplete?.(row)} - className={editMode ? classes.gridItemEdit : classes.gridFilename} suppressContentEditableWarning={true} + className={editMode ? 'GridView-gridItemEdit' : 'GridView-gridFilename'} suppressContentEditableWarning={true} contentEditable={editMode} data-test="filename-div" role={editMode ? 'textbox' : 'none'}>{row['Filename']}
@@ -121,7 +119,7 @@ ItemView.propTypes = { }; export default function GridView({items, operation, onItemSelect, onItemEnter}) { - const classes = useStyles(); + const [selectedIdx, setSelectedIdx] = useState(null); const gridRef = useRef(); @@ -138,15 +136,15 @@ export default function GridView({items, operation, onItemSelect, onItemEnter}) } return ( - -
+ +
{items.map((item, i)=>( ) )}
{items.length == 0 && {gettext('No files/folders found')}} - +
); } diff --git a/web/pgadmin/misc/file_manager/static/js/components/ListView.jsx b/web/pgadmin/misc/file_manager/static/js/components/ListView.jsx index 998c56a6c..5bcdfe1d2 100644 --- a/web/pgadmin/misc/file_manager/static/js/components/ListView.jsx +++ b/web/pgadmin/misc/file_manager/static/js/components/ListView.jsx @@ -1,12 +1,4 @@ -///////////////////////////////////////////////////////////// -// -// pgAdmin 4 - PostgreSQL Tools -// -// Copyright (C) 2013 - 2024, The pgAdmin Development Team -// This software is released under the PostgreSQL Licence -// -////////////////////////////////////////////////////////////// -import { makeStyles } from '@mui/styles'; +import { styled } from '@mui/material/styles'; import React, { useRef, useEffect } from 'react'; import PgReactDataGrid from '../../../../../static/js/components/PgReactDataGrid'; import FolderIcon from '@mui/icons-material/Folder'; @@ -16,8 +8,9 @@ import LockRoundedIcon from '@mui/icons-material/LockRounded'; import PropTypes from 'prop-types'; import gettext from 'sources/gettext'; -const useStyles = makeStyles((theme)=>({ - grid: { + +const StyledPgReactDataGrid = styled(PgReactDataGrid)(({theme}) => ({ + '&.Grid-grid': { fontSize: '13px', '& .rdg-header-row': { '& .rdg-cell': { @@ -31,39 +24,39 @@ const useStyles = makeStyles((theme)=>({ '&.rdg-editor-container': { padding: '0px', }, + }, + '& .Grid-input': { + appearance: 'none', + width: '100%', + height: '100%', + verticalAlign: 'top', + outline: 'none', + backgroundColor: theme.palette.background.default, + color: theme.palette.text.primary, + border: 0, + boxShadow: 'inset 0 0 0 1.5px '+theme.palette.primary.main, + padding: '0 2px', + '::selection': { + background: theme.palette.primary.light, + } + }, + '& .Grid-protected': { + height: '0.75rem', + width: '0.75rem', + position: 'absolute', + left: '14px', + top: '5px', + color: theme.palette.error.main, + backgroundColor: 'inherit', } } }, - input: { - appearance: 'none', - width: '100%', - height: '100%', - verticalAlign: 'top', - outline: 'none', - backgroundColor: theme.palette.background.default, - color: theme.palette.text.primary, - border: 0, - boxShadow: 'inset 0 0 0 1.5px '+theme.palette.primary.main, - padding: '0 2px', - '::selection': { - background: theme.palette.primary.light, - } - }, - protected: { - height: '0.75rem', - width: '0.75rem', - position: 'absolute', - left: '14px', - top: '5px', - color: theme.palette.error.main, - backgroundColor: 'inherit', - } })); export const GridContextUtils = React.createContext(); export function FileNameEditor({row, column, onRowChange, onClose}) { - const classes = useStyles(); + const value = row[column.key] ?? ''; const [localVal, setLocalVal] = React.useState(value); const localValRef = useRef(localVal); @@ -84,7 +77,7 @@ export function FileNameEditor({row, column, onRowChange, onClose}) { }; return ( { setLocalVal(e.target.value); @@ -102,7 +95,7 @@ FileNameEditor.propTypes = { onClose: PropTypes.func, }; function FileNameFormatter({row}) { - const classes = useStyles(); + let icon = ; if(row.file_type == 'dir') { icon = ; @@ -111,7 +104,7 @@ function FileNameFormatter({row}) { } return <> {icon} - {Boolean(row.Protected) && } + {Boolean(row.Protected) && } {row['Filename']} ; } @@ -142,7 +135,7 @@ const columns = [ export default function ListView({items, operation, ...props}) { - const classes = useStyles(); + const gridRef = useRef(); useEffect(()=>{ @@ -157,10 +150,10 @@ export default function ListView({items, operation, ...props}) { }, [gridRef.current?.element]); return ( - ({ - root: { - position: 'absolute', - top: 0, - bottom: 0, - left: 0, - right: 0, - zIndex: 1, - backgroundColor: theme.palette.background.default, - display: 'flex', - flexDirection: 'column', - padding: '4px', - }, - uploadArea: { + +const StyledBox = styled(Box)(({theme}) => ({ + position: 'absolute', + top: 0, + bottom: 0, + left: 0, + right: 0, + zIndex: 1, + backgroundColor: theme.palette.background.default, + display: 'flex', + flexDirection: 'column', + padding: '4px', + '& .Uploader-uploadArea': { border: `1px dashed ${theme.palette.grey[600]}`, display: 'flex', alignItems: 'center', @@ -42,19 +41,12 @@ const useStyles = makeStyles((theme)=>({ textAlign: 'center', padding: '4px', }, - uploadFilesRoot: { + '& .Uploader-uploadFilesRoot': { width: '350px', border: `1px dashed ${theme.palette.grey[600]}`, borderLeft: 'none', overflowX: 'hidden', overflowY: 'auto' - }, - uploadProgress: { - position: 'unset', - padding: 0, - }, - uploadPending: { - } })); @@ -131,7 +123,7 @@ UploadedFile.propTypes = { export default function Uploader({fmUtilsObj, onClose}) { - const classes = useStyles(); + const [files, dispatchFileAction] = useReducer(filesReducer, []); const onDrop = useCallback(acceptedFiles => { dispatchFileAction({ @@ -173,18 +165,18 @@ export default function Uploader({fmUtilsObj, onClose}) { }, [files.length]); return ( - + } size="xs" noBorder onClick={onClose} /> - + {gettext('Drop files here, or click to select files.')} {gettext('The file size limit (per file) is %s MB.', fmUtilsObj.config?.upload?.fileSizeLimit)} {files.length > 0 && - + {files.map((upfile)=>( { @@ -197,7 +189,7 @@ export default function Uploader({fmUtilsObj, onClose}) { } - + ); } Uploader.propTypes = { diff --git a/web/pgadmin/misc/properties/CollectionNodeProperties.jsx b/web/pgadmin/misc/properties/CollectionNodeProperties.jsx index 8eddec1bb..08603fa3b 100644 --- a/web/pgadmin/misc/properties/CollectionNodeProperties.jsx +++ b/web/pgadmin/misc/properties/CollectionNodeProperties.jsx @@ -7,13 +7,12 @@ // ////////////////////////////////////////////////////////////// import React from 'react'; +import { styled } from '@mui/material/styles'; import getApiInstance from 'sources/api_instance'; -import { makeStyles } from '@mui/styles'; import { Box } from '@mui/material'; import { generateCollectionURL } from '../../browser/static/js/node_ajax'; import gettext from 'sources/gettext'; import PgTable from 'sources/components/PgTable'; -import Theme from 'sources/Theme'; import PropTypes from 'prop-types'; import { PgButtonGroup, PgIconButton } from '../../static/js/components/Buttons'; import DeleteIcon from '@mui/icons-material/Delete'; @@ -25,46 +24,16 @@ import { evalFunc } from '../../static/js/utils'; import { usePgAdmin } from '../../static/js/BrowserComponent'; import { getSwitchCell } from '../../static/js/components/PgReactTableStyled'; -const useStyles = makeStyles((theme) => ({ - emptyPanel: { +const StyledBox = styled(Box)(({theme}) => ({ + height: '100%', + '&.CollectionNodeProperties-emptyPanel': { minHeight: '100%', minWidth: '100%', background: theme.otherVars.emptySpaceBg, overflow: 'auto', padding: '8px', display: 'flex', - }, - panelIcon: { - width: '80%', - margin: '0 auto', - marginTop: '25px !important', - position: 'relative', - textAlign: 'center', - }, - panelMessage: { - marginLeft: '0.5rem', - fontSize: '0.875rem', - }, - searchPadding: { - flex: 2.5 - }, - searchInput: { - flex: 1, - margin: '4 0 4 0', - borderLeft: 'none', - paddingLeft: 5 - }, - propertiesPanel: { - height: '100%' - }, - autoResizer: { - height: '100% !important', - width: '100% !important', - background: theme.palette.grey[400], - padding: '8px', - overflow: 'hidden !important', - overflowX: 'auto !important' - }, + } })); export default function CollectionNodeProperties({ @@ -76,9 +45,7 @@ export default function CollectionNodeProperties({ isStale, setIsStale }) { - const classes = useStyles(); const pgAdmin = usePgAdmin(); - const [data, setData] = React.useState([]); const [infoMsg, setInfoMsg] = React.useState('Please select an object in the tree view.'); const [selectedObject, setSelectedObject] = React.useState({}); @@ -193,7 +160,6 @@ export default function CollectionNodeProperties({ } setLoaderText(gettext('Loading...')); - if (!_.isUndefined(nodeObj.getSchema)) { schemaRef.current = nodeObj.getSchema?.(treeNodeInfo, nodeData); schemaRef.current?.fields.forEach((field) => { @@ -232,7 +198,6 @@ export default function CollectionNodeProperties({ }); } - api({ url: url, type: 'GET', @@ -307,15 +272,14 @@ export default function CollectionNodeProperties({ }; return ( - + <> - + {data.length > 0 ? ( +
) } -
-
+ + ); } diff --git a/web/pgadmin/misc/properties/Properties.jsx b/web/pgadmin/misc/properties/Properties.jsx index aa8fdc53c..25cf7a7be 100644 --- a/web/pgadmin/misc/properties/Properties.jsx +++ b/web/pgadmin/misc/properties/Properties.jsx @@ -8,6 +8,7 @@ ////////////////////////////////////////////////////////////// import React from 'react'; +import { styled } from '@mui/material/styles'; import CollectionNodeProperties from './CollectionNodeProperties'; import ErrorBoundary from '../../static/js/helpers/ErrorBoundary'; import withStandardTabInfo from '../../static/js/helpers/withStandardTabInfo'; @@ -16,23 +17,19 @@ import ObjectNodeProperties from './ObjectNodeProperties'; import EmptyPanelMessage from '../../static/js/components/EmptyPanelMessage'; import gettext from 'sources/gettext'; import { Box } from '@mui/material'; -import { makeStyles } from '@mui/styles'; import { usePgAdmin } from '../../static/js/BrowserComponent'; import PropTypes from 'prop-types'; import _ from 'lodash'; -const useStyles = makeStyles((theme) => ({ - root: { - height: '100%', - background: theme.otherVars.emptySpaceBg, - display: 'flex', - flexDirection: 'column' - }, +const StyledBox = styled(Box)(({theme}) => ({ + height: '100%', + background: theme.otherVars.emptySpaceBg, + display: 'flex', + flexDirection: 'column' })); function Properties(props) { const isCollection = props.nodeData?._type?.startsWith('coll-') || props.nodeData?._type == 'dbms_job_scheduler'; - const classes = useStyles(); const pgAdmin = usePgAdmin(); let noPropertyMsg = ''; @@ -44,27 +41,27 @@ function Properties(props) { if(noPropertyMsg) { return ( - + - + ); } if(isCollection) { return ( - + - + ); } else { return ( - + - + ); } } diff --git a/web/pgadmin/misc/sql/static/js/SQL.jsx b/web/pgadmin/misc/sql/static/js/SQL.jsx index e04bd5061..0448a41f4 100644 --- a/web/pgadmin/misc/sql/static/js/SQL.jsx +++ b/web/pgadmin/misc/sql/static/js/SQL.jsx @@ -8,29 +8,29 @@ ////////////////////////////////////////////////////////////// import React, { useEffect } from 'react'; +import { styled } from '@mui/material/styles'; import { generateNodeUrl } from '../../../../browser/static/js/node_ajax'; import gettext from 'sources/gettext'; import PropTypes from 'prop-types'; import getApiInstance from 'sources/api_instance'; -import { makeStyles } from '@mui/styles'; import CodeMirror from '../../../../static/js/components/ReactCodeMirror'; import Loader from 'sources/components/Loader'; import withStandardTabInfo from '../../../../static/js/helpers/withStandardTabInfo'; import { BROWSER_PANELS } from '../../../../browser/static/js/constants'; import { usePgAdmin } from '../../../../static/js/BrowserComponent'; -const useStyles = makeStyles((theme) => ({ - textArea: { + +const Root = styled('div')(({theme}) => ({ + '& .SQL-textArea': { height: '100% !important', width: '100% !important', background: theme.palette.grey[400], minHeight: '100%', minWidth: '100%', - }, + } })); function SQL({nodeData, node, treeNodeInfo, isActive, isStale, setIsStale}) { - const classes = useStyles(); const did = ((!_.isUndefined(treeNodeInfo)) && (!_.isUndefined(treeNodeInfo['database']))) ? treeNodeInfo['database']._id: 0; const dbConnected = !_.isUndefined(treeNodeInfo) && !_.isUndefined(treeNodeInfo['database']) ? treeNodeInfo.database.connected: false; const [nodeSQL, setNodeSQL] = React.useState(''); @@ -92,15 +92,15 @@ function SQL({nodeData, node, treeNodeInfo, isActive, isStale, setIsStale}) { }, [isStale, isActive, nodeData?.id]); return ( - <> + ( - + ) ); } diff --git a/web/pgadmin/misc/statistics/static/js/Statistics.jsx b/web/pgadmin/misc/statistics/static/js/Statistics.jsx index 4d0f4c391..998aea49b 100644 --- a/web/pgadmin/misc/statistics/static/js/Statistics.jsx +++ b/web/pgadmin/misc/statistics/static/js/Statistics.jsx @@ -8,12 +8,12 @@ ////////////////////////////////////////////////////////////// import _ from 'lodash'; +import { styled } from '@mui/material/styles'; import React, { useEffect } from 'react'; import PgTable from 'sources/components/PgTable'; import gettext from 'sources/gettext'; import PropTypes from 'prop-types'; import getApiInstance from 'sources/api_instance'; -import { makeStyles } from '@mui/styles'; import { getURL } from '../../../static/utils/utils'; import Loader from 'sources/components/Loader'; import EmptyPanelMessage from '../../../../static/js/components/EmptyPanelMessage'; @@ -22,36 +22,16 @@ import withStandardTabInfo from '../../../../static/js/helpers/withStandardTabIn import { BROWSER_PANELS } from '../../../../browser/static/js/constants'; import { usePgAdmin } from '../../../../static/js/BrowserComponent'; -const useStyles = makeStyles((theme) => ({ - emptyPanel: { +const Root = styled('div')(({theme}) => ({ + height : '100%', + '& .Statistics-emptyPanel': { minHeight: '100%', minWidth: '100%', background: theme.otherVars.emptySpaceBg, overflow: 'auto', padding: '8px', display: 'flex', - }, - panelIcon: { - width: '80%', - margin: '0 auto', - marginTop: '25px !important', - position: 'relative', - textAlign: 'center', - }, - panelMessage: { - marginLeft: '0.5rem', - fontSize: '0.875rem', - }, - autoResizer: { - height: '100% !important', - width: '100% !important', - background: theme.palette.grey[400], - padding: '7.5px', - overflowX: 'auto !important', - overflowY: 'hidden !important', - minHeight: '100%', - minWidth: '100%', - }, + } })); function getColumn(data, singleLineStatistics, prettifyFields=[]) { @@ -146,9 +126,7 @@ function createSingleLineStatistics(data, prettifyFields) { } function Statistics({ nodeData, nodeItem, node, treeNodeInfo, isActive, isStale, setIsStale }) { - const classes = useStyles(); const [tableData, setTableData] = React.useState([]); - const [msg, setMsg] = React.useState(''); const [loaderText, setLoaderText] = React.useState(''); const [columns, setColumns] = React.useState([ @@ -232,22 +210,21 @@ function Statistics({ nodeData, nodeItem, node, treeNodeInfo, isActive, isStale, }, [isStale, isActive, nodeData?.id]); return ( - <> + {tableData.length > 0 ? ( ) : ( -
+
)} - + ); } diff --git a/web/pgadmin/preferences/static/js/components/PreferencesComponent.jsx b/web/pgadmin/preferences/static/js/components/PreferencesComponent.jsx index 78fd15938..c58d96232 100644 --- a/web/pgadmin/preferences/static/js/components/PreferencesComponent.jsx +++ b/web/pgadmin/preferences/static/js/components/PreferencesComponent.jsx @@ -8,25 +8,81 @@ ////////////////////////////////////////////////////////////// import gettext from 'sources/gettext'; +import { styled } from '@mui/material/styles'; import _ from 'lodash'; import url_for from 'sources/url_for'; import React, { useEffect, useMemo } from 'react'; import { FileType } from 'react-aspen'; import { Box } from '@mui/material'; import PropTypes from 'prop-types'; -import { makeStyles } from '@mui/styles'; import SchemaView from '../../../../static/js/SchemaView'; import getApiInstance from '../../../../static/js/api_instance'; import CloseSharpIcon from '@mui/icons-material/CloseSharp'; import HelpIcon from '@mui/icons-material/HelpRounded'; import SaveSharpIcon from '@mui/icons-material/SaveSharp'; -import clsx from 'clsx'; import pgAdmin from 'sources/pgadmin'; import { DefaultButton, PgIconButton, PrimaryButton } from '../../../../static/js/components/Buttons'; import BaseUISchema from 'sources/SchemaView/base_schema.ui'; import { getBinaryPathSchema } from '../../../../browser/server_groups/servers/static/js/binary_path.ui'; import usePreferences from '../store'; + +const StyledBox = styled(Box)(({theme}) => ({ + '& .PreferencesComponent-root': { + display: 'flex', + flexDirection: 'column', + flexGrow: 1, + height: '100%', + backgroundColor: theme.palette.background.default, + overflow: 'hidden', + '&$disabled': { + color: '#ddd', + }, + '& .PreferencesComponent-body': { + borderColor: theme.otherVars.borderColor, + display: 'flex', + flexGrow: 1, + height: '100%', + minHeight: 0, + overflow: 'hidden', + '& .PreferencesComponent-treeContainer': { + flexBasis: '25%', + alignItems: 'flex-start', + paddingLeft: '5px', + minHeight: 0, + flexGrow: 1, + '& .PreferencesComponent-tree': { + height: '100%', + flexGrow: 1 + }, + }, + '& .PreferencesComponent-preferencesContainer': { + flexBasis: '75%', + padding: '5px', + borderColor: theme.otherVars.borderColor + '!important', + borderLeft: '1px solid', + position: 'relative', + height: '100%', + paddingTop: '5px', + overflow: 'auto', + }, + }, + '& .PreferencesComponent-footer': { + borderTop: `1px solid ${theme.otherVars.inputBorderColor} !important`, + padding: '0.5rem', + display: 'flex', + width: '100%', + background: theme.otherVars.headerBg, + '& .PreferencesComponent-actionBtn': { + alignItems: 'flex-start', + }, + '& .PreferencesComponent-buttonMargin': { + marginLeft: '0.5em' + }, + }, + }, +})); + class PreferencesSchema extends BaseUISchema { constructor(initValues = {}, schemaFields = []) { super({ @@ -49,81 +105,6 @@ class PreferencesSchema extends BaseUISchema { } } -const useStyles = makeStyles((theme) => - ({ - root: { - display: 'flex', - flexDirection: 'column', - flexGrow: 1, - height: '100%', - backgroundColor: theme.palette.background.default, - overflow: 'hidden', - '&$disabled': { - color: '#ddd', - } - }, - body: { - display: 'flex', - flexDirection: 'column', - height: '100%', - minHeight: 0, - }, - preferences: { - borderColor: theme.otherVars.borderColor, - display: 'flex', - flexGrow: 1, - height: '100%', - minHeight: 0, - overflow: 'hidden' - - }, - treeContainer: { - flexBasis: '25%', - alignItems: 'flex-start', - paddingLeft: '5px', - minHeight: 0, - flexGrow: 1 - }, - tree: { - height: '100%', - flexGrow: 1 - }, - preferencesContainer: { - flexBasis: '75%', - padding: '5px', - borderColor: theme.otherVars.borderColor + '!important', - borderLeft: '1px solid', - position: 'relative', - height: '100%', - paddingTop: '5px', - overflow: 'auto' - }, - actionBtn: { - alignItems: 'flex-start', - }, - buttonMargin: { - marginLeft: '0.5em' - }, - footer: { - borderTop: `1px solid ${theme.otherVars.inputBorderColor} !important`, - padding: '0.5rem', - display: 'flex', - width: '100%', - background: theme.otherVars.headerBg, - }, - customTreeClass: { - '& .react-checkbox-tree': { - height: '100% !important', - border: 'none !important', - }, - }, - preferencesTree: { - height: 'calc(100% - 50px)', - minHeight: 0 - } - }), -); - function RightPanel({ schema, ...props }) { let initData = () => new Promise((resolve, reject) => { @@ -157,7 +138,7 @@ RightPanel.propTypes = { export default function PreferencesComponent({ ...props }) { - const classes = useStyles(); + const [disableSave, setDisableSave] = React.useState(true); const prefSchema = React.useRef(new PreferencesSchema({}, [])); const prefChangedData = React.useRef({}); @@ -594,18 +575,17 @@ export default function PreferencesComponent({ ...props }) { }; return ( - - - - - - + + + + + { useMemo(() => (prefTreeData && props.renderTree(prefTreeData)), [prefTreeData]) } - + { prefSchema.current && loadTree > 0 && { @@ -615,21 +595,21 @@ export default function PreferencesComponent({ ...props }) { } - + } title={gettext('Help for this dialog.')} /> - - { props.closeModal();}} startIcon={ { props.closeModal();}} />}> + + { props.closeModal();}} startIcon={ { props.closeModal();}} />}> {gettext('Cancel')} - } disabled={disableSave} onClick={() => { savePreferences(prefChangedData, initValues); }}> + } disabled={disableSave} onClick={() => { savePreferences(prefChangedData, initValues); }}> {gettext('Save')} - + ); } diff --git a/web/pgadmin/static/js/AppMenuBar.jsx b/web/pgadmin/static/js/AppMenuBar.jsx index c010134ce..2f1745e4c 100644 --- a/web/pgadmin/static/js/AppMenuBar.jsx +++ b/web/pgadmin/static/js/AppMenuBar.jsx @@ -7,7 +7,7 @@ // ////////////////////////////////////////////////////////////// import { Box } from '@mui/material'; -import { makeStyles } from '@mui/styles'; +import { styled } from '@mui/material/styles'; import React, { useState, useEffect } from 'react'; import { PrimaryButton } from './components/Buttons'; import { PgMenu, PgMenuDivider, PgMenuItem, PgSubMenu } from './components/Menu'; @@ -15,51 +15,50 @@ import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown'; import AccountCircleRoundedIcon from '@mui/icons-material/AccountCircleRounded'; import { usePgAdmin } from '../../static/js/BrowserComponent'; -const useStyles = makeStyles((theme)=>({ - root: { - height: '30px', - backgroundColor: theme.palette.primary.main, - color: theme.palette.primary.contrastText, - padding: '0 0.5rem', - display: 'flex', - alignItems: 'center', - }, - logo: { + +const StyledBox = styled(Box)(({theme}) => ({ + height: '30px', + backgroundColor: theme.palette.primary.main, + color: theme.palette.primary.contrastText, + padding: '0 0.5rem', + display: 'flex', + alignItems: 'center', + '& .AppMenuBar-logo': { width: '96px', height: '100%', /* - * Using the SVG postgresql logo, modified to set the background color as #FFF - * https://wiki.postgresql.org/images/9/90/PostgreSQL_logo.1color_blue.svg - * background: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 42 42' style='enable-background:new 0 0 42 42;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bstroke:%23000000;stroke-width:3.3022;%7D .st1%7Bfill:%23336791;%7D .st2%7Bfill:none;stroke:%23FFFFFF;stroke-width:1.1007;stroke-linecap:round;stroke-linejoin:round;%7D .st3%7Bfill:none;stroke:%23FFFFFF;stroke-width:1.1007;stroke-linecap:round;stroke-linejoin:bevel;%7D .st4%7Bfill:%23FFFFFF;stroke:%23FFFFFF;stroke-width:0.3669;%7D .st5%7Bfill:%23FFFFFF;stroke:%23FFFFFF;stroke-width:0.1835;%7D .st6%7Bfill:none;stroke:%23FFFFFF;stroke-width:0.2649;stroke-linecap:round;stroke-linejoin:round;%7D%0A%3C/style%3E%3Cg id='orginal'%3E%3C/g%3E%3Cg id='Layer_x0020_3'%3E%3Cpath class='st0' d='M31.3,30c0.3-2.1,0.2-2.4,1.7-2.1l0.4,0c1.2,0.1,2.8-0.2,3.7-0.6c2-0.9,3.1-2.4,1.2-2 c-4.4,0.9-4.7-0.6-4.7-0.6c4.7-7,6.7-15.8,5-18c-4.6-5.9-12.6-3.1-12.7-3l0,0c-0.9-0.2-1.9-0.3-3-0.3c-2,0-3.5,0.5-4.7,1.4 c0,0-14.3-5.9-13.6,7.4c0.1,2.8,4,21.3,8.7,15.7c1.7-2,3.3-3.8,3.3-3.8c0.8,0.5,1.8,0.8,2.8,0.7l0.1-0.1c0,0.3,0,0.5,0,0.8 c-1.2,1.3-0.8,1.6-3.2,2.1c-2.4,0.5-1,1.4-0.1,1.6c1.1,0.3,3.7,0.7,5.5-1.8l-0.1,0.3c0.5,0.4,0.4,2.7,0.5,4.4 c0.1,1.7,0.2,3.2,0.5,4.1c0.3,0.9,0.7,3.3,3.9,2.6C29.1,38.3,31.1,37.5,31.3,30'/%3E%3Cpath class='st1' d='M38.3,25.3c-4.4,0.9-4.7-0.6-4.7-0.6c4.7-7,6.7-15.8,5-18c-4.6-5.9-12.6-3.1-12.7-3l0,0 c-0.9-0.2-1.9-0.3-3-0.3c-2,0-3.5,0.5-4.7,1.4c0,0-14.3-5.9-13.6,7.4c0.1,2.8,4,21.3,8.7,15.7c1.7-2,3.3-3.8,3.3-3.8 c0.8,0.5,1.8,0.8,2.8,0.7l0.1-0.1c0,0.3,0,0.5,0,0.8c-1.2,1.3-0.8,1.6-3.2,2.1c-2.4,0.5-1,1.4-0.1,1.6c1.1,0.3,3.7,0.7,5.5-1.8 l-0.1,0.3c0.5,0.4,0.8,2.4,0.7,4.3c-0.1,1.9-0.1,3.2,0.3,4.2c0.4,1,0.7,3.3,3.9,2.6c2.6-0.6,4-2,4.2-4.5c0.1-1.7,0.4-1.5,0.5-3 l0.2-0.7c0.3-2.3,0-3.1,1.7-2.8l0.4,0c1.2,0.1,2.8-0.2,3.7-0.6C39,26.4,40.2,24.9,38.3,25.3L38.3,25.3z'/%3E%3Cpath class='st2' d='M21.8,26.6c-0.1,4.4,0,8.8,0.5,9.8c0.4,1.1,1.3,3.2,4.5,2.5c2.6-0.6,3.6-1.7,4-4.1c0.3-1.8,0.9-6.7,1-7.7'/%3E%3Cpath class='st2' d='M18,4.7c0,0-14.3-5.8-13.6,7.4c0.1,2.8,4,21.3,8.7,15.7c1.7-2,3.2-3.7,3.2-3.7'/%3E%3Cpath class='st2' d='M25.7,3.6c-0.5,0.2,7.9-3.1,12.7,3c1.7,2.2-0.3,11-5,18'/%3E%3Cpath class='st3' d='M33.5,24.6c0,0,0.3,1.5,4.7,0.6c1.9-0.4,0.8,1.1-1.2,2c-1.6,0.8-5.3,0.9-5.3-0.1 C31.6,24.5,33.6,25.3,33.5,24.6c-0.1-0.6-1.1-1.2-1.7-2.7c-0.5-1.3-7.3-11.2,1.9-9.7c0.3-0.1-2.4-8.7-11-8.9 c-8.6-0.1-8.3,10.6-8.3,10.6'/%3E%3Cpath class='st2' d='M19.4,25.6c-1.2,1.3-0.8,1.6-3.2,2.1c-2.4,0.5-1,1.4-0.1,1.6c1.1,0.3,3.7,0.7,5.5-1.8c0.5-0.8,0-2-0.7-2.3 C20.5,25.1,20,24.9,19.4,25.6L19.4,25.6z'/%3E%3Cpath class='st2' d='M19.3,25.5c-0.1-0.8,0.3-1.7,0.7-2.8c0.6-1.6,2-3.3,0.9-8.5c-0.8-3.9-6.5-0.8-6.5-0.3c0,0.5,0.3,2.7-0.1,5.2 c-0.5,3.3,2.1,6,5,5.7'/%3E%3Cpath class='st4' d='M18,13.8c0,0.2,0.3,0.7,0.8,0.7c0.5,0.1,0.9-0.3,0.9-0.5c0-0.2-0.3-0.4-0.8-0.4C18.4,13.6,18,13.7,18,13.8 L18,13.8z'/%3E%3Cpath class='st5' d='M32,13.5c0,0.2-0.3,0.7-0.8,0.7c-0.5,0.1-0.9-0.3-0.9-0.5c0-0.2,0.3-0.4,0.8-0.4C31.6,13.2,32,13.3,32,13.5 L32,13.5z'/%3E%3Cpath class='st2' d='M33.7,12.2c0.1,1.4-0.3,2.4-0.4,3.9c-0.1,2.2,1,4.7-0.6,7.2'/%3E%3Cpath class='st6' d='M2.7,6.6'/%3E%3C/g%3E%3C/svg%3E%0A") 0 0 no-repeat; - */ + * Using the SVG postgresql logo, modified to set the background color as #FFF + * https://wiki.postgresql.org/images/9/90/PostgreSQL_logo.1color_blue.svg + * background: url("data:image/svg+xml,%3C%3Fxml version='1.0' encoding='utf-8'%3F%3E%3C!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --%3E%3Csvg version='1.1' id='Layer_1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' viewBox='0 0 42 42' style='enable-background:new 0 0 42 42;' xml:space='preserve'%3E%3Cstyle type='text/css'%3E .st0%7Bstroke:%23000000;stroke-width:3.3022;%7D .st1%7Bfill:%23336791;%7D .st2%7Bfill:none;stroke:%23FFFFFF;stroke-width:1.1007;stroke-linecap:round;stroke-linejoin:round;%7D .st3%7Bfill:none;stroke:%23FFFFFF;stroke-width:1.1007;stroke-linecap:round;stroke-linejoin:bevel;%7D .st4%7Bfill:%23FFFFFF;stroke:%23FFFFFF;stroke-width:0.3669;%7D .st5%7Bfill:%23FFFFFF;stroke:%23FFFFFF;stroke-width:0.1835;%7D .st6%7Bfill:none;stroke:%23FFFFFF;stroke-width:0.2649;stroke-linecap:round;stroke-linejoin:round;%7D%0A%3C/style%3E%3Cg id='orginal'%3E%3C/g%3E%3Cg id='Layer_x0020_3'%3E%3Cpath class='st0' d='M31.3,30c0.3-2.1,0.2-2.4,1.7-2.1l0.4,0c1.2,0.1,2.8-0.2,3.7-0.6c2-0.9,3.1-2.4,1.2-2 c-4.4,0.9-4.7-0.6-4.7-0.6c4.7-7,6.7-15.8,5-18c-4.6-5.9-12.6-3.1-12.7-3l0,0c-0.9-0.2-1.9-0.3-3-0.3c-2,0-3.5,0.5-4.7,1.4 c0,0-14.3-5.9-13.6,7.4c0.1,2.8,4,21.3,8.7,15.7c1.7-2,3.3-3.8,3.3-3.8c0.8,0.5,1.8,0.8,2.8,0.7l0.1-0.1c0,0.3,0,0.5,0,0.8 c-1.2,1.3-0.8,1.6-3.2,2.1c-2.4,0.5-1,1.4-0.1,1.6c1.1,0.3,3.7,0.7,5.5-1.8l-0.1,0.3c0.5,0.4,0.4,2.7,0.5,4.4 c0.1,1.7,0.2,3.2,0.5,4.1c0.3,0.9,0.7,3.3,3.9,2.6C29.1,38.3,31.1,37.5,31.3,30'/%3E%3Cpath class='st1' d='M38.3,25.3c-4.4,0.9-4.7-0.6-4.7-0.6c4.7-7,6.7-15.8,5-18c-4.6-5.9-12.6-3.1-12.7-3l0,0 c-0.9-0.2-1.9-0.3-3-0.3c-2,0-3.5,0.5-4.7,1.4c0,0-14.3-5.9-13.6,7.4c0.1,2.8,4,21.3,8.7,15.7c1.7-2,3.3-3.8,3.3-3.8 c0.8,0.5,1.8,0.8,2.8,0.7l0.1-0.1c0,0.3,0,0.5,0,0.8c-1.2,1.3-0.8,1.6-3.2,2.1c-2.4,0.5-1,1.4-0.1,1.6c1.1,0.3,3.7,0.7,5.5-1.8 l-0.1,0.3c0.5,0.4,0.8,2.4,0.7,4.3c-0.1,1.9-0.1,3.2,0.3,4.2c0.4,1,0.7,3.3,3.9,2.6c2.6-0.6,4-2,4.2-4.5c0.1-1.7,0.4-1.5,0.5-3 l0.2-0.7c0.3-2.3,0-3.1,1.7-2.8l0.4,0c1.2,0.1,2.8-0.2,3.7-0.6C39,26.4,40.2,24.9,38.3,25.3L38.3,25.3z'/%3E%3Cpath class='st2' d='M21.8,26.6c-0.1,4.4,0,8.8,0.5,9.8c0.4,1.1,1.3,3.2,4.5,2.5c2.6-0.6,3.6-1.7,4-4.1c0.3-1.8,0.9-6.7,1-7.7'/%3E%3Cpath class='st2' d='M18,4.7c0,0-14.3-5.8-13.6,7.4c0.1,2.8,4,21.3,8.7,15.7c1.7-2,3.2-3.7,3.2-3.7'/%3E%3Cpath class='st2' d='M25.7,3.6c-0.5,0.2,7.9-3.1,12.7,3c1.7,2.2-0.3,11-5,18'/%3E%3Cpath class='st3' d='M33.5,24.6c0,0,0.3,1.5,4.7,0.6c1.9-0.4,0.8,1.1-1.2,2c-1.6,0.8-5.3,0.9-5.3-0.1 C31.6,24.5,33.6,25.3,33.5,24.6c-0.1-0.6-1.1-1.2-1.7-2.7c-0.5-1.3-7.3-11.2,1.9-9.7c0.3-0.1-2.4-8.7-11-8.9 c-8.6-0.1-8.3,10.6-8.3,10.6'/%3E%3Cpath class='st2' d='M19.4,25.6c-1.2,1.3-0.8,1.6-3.2,2.1c-2.4,0.5-1,1.4-0.1,1.6c1.1,0.3,3.7,0.7,5.5-1.8c0.5-0.8,0-2-0.7-2.3 C20.5,25.1,20,24.9,19.4,25.6L19.4,25.6z'/%3E%3Cpath class='st2' d='M19.3,25.5c-0.1-0.8,0.3-1.7,0.7-2.8c0.6-1.6,2-3.3,0.9-8.5c-0.8-3.9-6.5-0.8-6.5-0.3c0,0.5,0.3,2.7-0.1,5.2 c-0.5,3.3,2.1,6,5,5.7'/%3E%3Cpath class='st4' d='M18,13.8c0,0.2,0.3,0.7,0.8,0.7c0.5,0.1,0.9-0.3,0.9-0.5c0-0.2-0.3-0.4-0.8-0.4C18.4,13.6,18,13.7,18,13.8 L18,13.8z'/%3E%3Cpath class='st5' d='M32,13.5c0,0.2-0.3,0.7-0.8,0.7c-0.5,0.1-0.9-0.3-0.9-0.5c0-0.2,0.3-0.4,0.8-0.4C31.6,13.2,32,13.3,32,13.5 L32,13.5z'/%3E%3Cpath class='st2' d='M33.7,12.2c0.1,1.4-0.3,2.4-0.4,3.9c-0.1,2.2,1,4.7-0.6,7.2'/%3E%3Cpath class='st6' d='M2.7,6.6'/%3E%3C/g%3E%3C/svg%3E%0A") 0 0 no-repeat; + */ background: 'url(data:image/svg+xml;base64,PHN2ZyBpZD0iTGF5ZXJfMSIgZGF0YS1uYW1lPSJMYXllciAxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyMDUgNTAiPjxkZWZzPjxzdHlsZT4uY2xzLTF7ZmlsbDojZmZmO30uY2xzLTJ7ZmlsbDojMzI2ODkzO308L3N0eWxlPjwvZGVmcz48dGl0bGU+cGdBZG1pbjwvdGl0bGU+PHBhdGggY2xhc3M9ImNscy0xIiBkPSJNNTguOTQsNDEuNGEyLjQ4LDIuNDgsMCwwLDEtMi4yNy0zLjQ5TDY0LDIxLjI5VjZhNiw2LDAsMCwwLTYtNkg2QTYsNiwwLDAsMCwwLDZWNDRhNiw2LDAsMCwwLDYsNkg1OGE2LDYsMCwwLDAsNi02VjQxLjRaIi8+PHBhdGggY2xhc3M9ImNscy0yIiBkPSJNMjkuMjUsMzAuMTdhMTMuMTMsMTMuMTMsMCwwLDEtMS44Mi02LjkzLDEzLDEzLDAsMCwxLDEuODItNi44OCwxMi41LDEyLjUsMCwwLDEsMS40OC0xLjk1LDEwLjQ0LDEwLjQ0LDAsMCwwLTMuMjUtMi44OSwxMS4xNiwxMS4xNiwwLDAsMC01LjY1LTEuNDVxLTQuNDgsMC02LjcyLDIuNjRWMTAuNDRINy41MVY0MC4zNmExLDEsMCwwLDAsMSwxaDZhMSwxLDAsMCwwLDEtMVYzMS4xOWE4LjQ3LDguNDcsMCwwLDAsNi4zNCwyLjQsMTEuMjYsMTEuMjYsMCwwLDAsNS42NS0xLjQ1LDEwLjUzLDEwLjUzLDAsMCwwLDIuMDYtMS41NkMyOS40NCwzMC40NCwyOS4zNCwzMC4zMSwyOS4yNSwzMC4xN1pNMjMuNiwyNS44YTQuNTIsNC41MiwwLDAsMS0zLjQ1LDEuNDQsNC40OCw0LjQ4LDAsMCwxLTMuNDQtMS40NCw1LjYsNS42LDAsMCwxLTEuMzUtNCw1LjU5LDUuNTksMCwwLDEsMS4zNS00LDQuNDYsNC40NiwwLDAsMSwzLjQ0LTEuNDUsNC40OSw0LjQ5LDAsMCwxLDMuNDUsMS40NSw1LjYzLDUuNjMsMCwwLDEsMS4zNCw0QTUuNjQsNS42NCwwLDAsMSwyMy42LDI1LjhaIi8+PHBhdGggY2xhc3M9ImNscy0yIiBkPSJNNTYuNDksMTIuNjNWMzEuMjRxMCw2LjM1LTMuNDQsOS41MXQtOS45MiwzLjE3YTI1LjQyLDI1LjQyLDAsMCwxLTYuMy0uNzUsMTUsMTUsMCwwLDEtNS0yLjIzbDIuODktNS41OWExMC4xNywxMC4xNywwLDAsMCwzLjUxLDEuNzksMTQuMzcsMTQuMzcsMCwwLDAsNC4xOC42NUE2LjUzLDYuNTMsMCwwLDAsNDcsMzYuNGE1LjM3LDUuMzcsMCwwLDAsMS40Ny00LjExdi0uNzZjLTEuNTQsMS44LTMuNzksMi42OS02Ljc2LDIuNjlhMTEuNywxMS43LDAsMCwxLTUuNTktMS4zNkExMC4zNywxMC4zNywwLDAsMSwzMi4wOSwyOWExMC44OSwxMC44OSwwLDAsMS0xLjUxLTUuNzcsMTAuODYsMTAuODYsMCwwLDEsMS41MS01Ljc0LDEwLjQyLDEwLjQyLDAsMCwxLDQuMDctMy44NiwxMS43MSwxMS43MSwwLDAsMSw1LjU5LTEuMzdjMy4yNSwwLDUuNjMsMS4wNiw3LjE0LDMuMTVWMTIuNjNabS05LjMsMTMuOTVhNC40LDQuNCwwLDAsMCwxLjQtMy4zNiw0LjM0LDQuMzQsMCwwLDAtMS4zOC0zLjM0LDUuNjUsNS42NSwwLDAsMC03LjE2LDAsNC4zLDQuMywwLDAsMC0xLjQxLDMuMzQsNC4zNSw0LjM1LDAsMCwwLDEuNDMsMy4zNiw1LjA4LDUuMDgsMCwwLDAsMy41NywxLjNBNSw1LDAsMCwwLDQ3LjE5LDI2LjU4WiIvPjxwYXRoIGNsYXNzPSJjbHMtMSIgZD0iTTgzLjQzLDMyLjg5SDcxbC0yLDUuMDlhMSwxLDAsMCwxLS45My42Mkg2MS43M2ExLDEsMCwwLDEtLjkxLTEuNEw3Mi45MSw5LjhhMSwxLDAsMCwxLC45Mi0uNmg2Ljg5YTEsMSwwLDAsMSwuOTEuNkw5My43NywzNy4yYTEsMSwwLDAsMS0uOTIsMS40SDg2LjQxYTEsMSwwLDAsMS0uOTMtLjYyWk04MSwyNi43NmwtMy43OC05LjQxLTMuNzgsOS40MVoiLz48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik0xMjAuNDQsOC40NFYzNy42YTEsMSwwLDAsMS0xLDFoLTUuNmExLDEsMCwwLDEtMS0xVjM2LjMzUTExMC42MiwzOSwxMDYuMTYsMzlhMTEuMjksMTEuMjksMCwwLDEtNS42Ny0xLjQ1LDEwLjU0LDEwLjU0LDAsMCwxLTQtNC4xNEExMi42MiwxMi42MiwwLDAsMSw5NSwyNy4xOCwxMi41MywxMi41MywwLDAsMSw5Ni40NCwyMWExMC4zNSwxMC4zNSwwLDAsMSw0LTQuMDksMTEuNDgsMTEuNDgsMCwwLDEsNS42Ny0xLjQzLDguMjQsOC4yNCwwLDAsMSw2LjMsMi4zNVY4LjQ0YTEsMSwwLDAsMSwxLTFoNkExLDEsMCwwLDEsMTIwLjQ0LDguNDRabS05LjE5LDIyLjc1YTUuNzEsNS43MSwwLDAsMCwxLjM0LTQsNS42LDUuNiwwLDAsMC0xLjMyLTMuOTUsNC40Nyw0LjQ3LDAsMCwwLTMuNDMtMS40Myw0LjUzLDQuNTMsMCwwLDAtMy40NCwxLjQzLDUuNTEsNS41MSwwLDAsMC0xLjM0LDMuOTUsNS42Nyw1LjY3LDAsMCwwLDEuMzQsNCw0Ljc3LDQuNzcsMCwwLDAsNi44NSwwWiIvPjxwYXRoIGNsYXNzPSJjbHMtMSIgZD0iTTE2MSwxOGMxLjY2LDEuNjgsMi41LDQuMjEsMi41LDcuNnYxMmExLDEsMCwwLDEtMSwxaC02YTEsMSwwLDAsMS0xLTFWMjYuODhhNS42Nyw1LjY3LDAsMCwwLS45LTMuNTMsMy4wOSwzLjA5LDAsMCwwLTIuNTUtMS4xMywzLjYyLDMuNjIsMCwwLDAtMi44OSwxLjI2LDUuNzEsNS43MSwwLDAsMC0xLjEsMy44MlYzNy42YTEsMSwwLDAsMS0xLDFoLTZhMSwxLDAsMCwxLTEtMVYyNi44OGMwLTMuMTEtMS4xNC00LjY2LTMuNDQtNC42NmEzLjcsMy43LDAsMCwwLTIuOTQsMS4yNiw1LjcxLDUuNzEsMCwwLDAtMS4wOSwzLjgyVjM3LjZhMSwxLDAsMCwxLTEsMWgtNmExLDEsMCwwLDEtMS0xVjE2Ljg0YTEsMSwwLDAsMSwxLTFoNS42YTEsMSwwLDAsMSwxLDF2MS4zOWE4LDgsMCwwLDEsMy0yLjA4LDEwLjIzLDEwLjIzLDAsMCwxLDMuOC0uNjksMTAsMTAsMCwwLDEsNC4yOS44OEE3LjI4LDcuMjgsMCwwLDEsMTQ2LjQyLDE5YTguODUsOC44NSwwLDAsMSwzLjQxLTIuNjUsMTAuOTMsMTAuOTMsMCwwLDEsNC40OS0uOTJBOSw5LDAsMCwxLDE2MSwxOFoiLz48cGF0aCBjbGFzcz0iY2xzLTEiIGQ9Ik0xNjguMTIsMTIuMWEzLjkxLDMuOTEsMCwwLDEtMS4zNC0yLjc5QTQuMTYsNC4xNiwwLDAsMSwxNjgsNi4xOWE1LDUsMCwwLDEsMy42Ny0xLjM2QTUuMjUsNS4yNSwwLDAsMSwxNzUuMTgsNmEzLjc1LDMuNzUsMCwwLDEsMS4zNCwzLDQuMSw0LjEsMCwwLDEtMS4zNCwzLjEzLDUuNjgsNS42OCwwLDAsMS03LjA2LDBabS41NCwzLjc0aDZhMSwxLDAsMCwxLDEsMVYzNy42YTEsMSwwLDAsMS0xLDFoLTZhMSwxLDAsMCwxLTEtMVYxNi44NEExLDEsMCwwLDEsMTY4LjY2LDE1Ljg0WiIvPjxwYXRoIGNsYXNzPSJjbHMtMSIgZD0iTTIwMS41NSwxOHEyLjU5LDIuNTIsMi41OSw3LjZ2MTJhMSwxLDAsMCwxLTEsMWgtNmExLDEsMCwwLDEtMS0xVjI2Ljg4cTAtNC42Ni0zLjc0LTQuNjZhNC4zLDQuMywwLDAsMC0zLjMsMS4zNCw1LjgzLDUuODMsMCwwLDAtMS4yNCw0djEwYTEsMSwwLDAsMS0xLDFoLTZhMSwxLDAsMCwxLTEtMVYxNi44NGExLDEsMCwwLDEsMS0xaDUuNjFhMSwxLDAsMCwxLDEsMXYxLjQ3YTkuMDUsOS4wNSwwLDAsMSwzLjE5LTIuMTIsMTAuNzgsMTAuNzgsMCwwLDEsNC0uNzNBOS4zNCw5LjM0LDAsMCwxLDIwMS41NSwxOFoiLz48L3N2Zz4=) 0 0 no-repeat', backgroundPositionY: 'center', }, - menus: { + '& .AppMenuBar-menus': { display: 'flex', alignItems: 'center', gap: '2px', marginLeft: '16px', - + '& .MuiButton-containedPrimary': { padding: '1px 8px', } }, - userMenu: { + '& .AppMenuBar-userMenu': { marginLeft: 'auto', '& .MuiButton-containedPrimary': { fontSize: '0.825rem', + }, + '& .AppMenuBar-gravatar': { + marginRight: '4px', } }, - gravatar: { - marginRight: '4px', - } })); export default function AppMenuBar() { - const classes = useStyles(); + const [,setRefresh] = useState(false); const pgAdmin = usePgAdmin(); @@ -97,10 +96,10 @@ export default function AppMenuBar() { const userMenuInfo = pgAdmin.Browser.utils.userMenuInfo; - return( - -
-
+ return ( + +
+
{pgAdmin.Browser.MainMenus?.map((menu)=>{ return ( {userMenuInfo && -
+
-
+
{userMenuInfo.gravatar && {`Gravatar} @@ -146,6 +145,6 @@ export default function AppMenuBar() { })}
} - + ); } diff --git a/web/pgadmin/static/js/Dialogs/ChangeOwnershipContent.jsx b/web/pgadmin/static/js/Dialogs/ChangeOwnershipContent.jsx index 889a2b578..91a2438c0 100644 --- a/web/pgadmin/static/js/Dialogs/ChangeOwnershipContent.jsx +++ b/web/pgadmin/static/js/Dialogs/ChangeOwnershipContent.jsx @@ -1,13 +1,4 @@ -///////////////////////////////////////////////////////////// -// -// pgAdmin 4 - PostgreSQL Tools -// -// Copyright (C) 2013 - 2024, The pgAdmin Development Team -// This software is released under the PostgreSQL Licence -// -////////////////////////////////////////////////////////////// - -import { makeStyles } from '@mui/styles'; +import { styled } from '@mui/material/styles'; import React from 'react'; import PropTypes from 'prop-types'; import gettext from 'sources/gettext'; @@ -15,6 +6,13 @@ import BaseUISchema from '../SchemaView/base_schema.ui'; import SchemaView from '../SchemaView'; import { isEmptyString } from 'sources/validators'; + +const StyledSchemaView = styled(SchemaView)(({theme}) => ({ + '& .ChangeOwnershipContent-root': { + ...theme.mixins.tabPanel, + } +})); + class ChangeOwnershipSchema extends BaseUISchema { constructor(deletedUser, adminUserList, noOfSharedServers) { super({ @@ -50,17 +48,11 @@ class ChangeOwnershipSchema extends BaseUISchema { } } -const useStyles = makeStyles((theme)=>({ - root: { - ...theme.mixins.tabPanel, - }, -})); - export default function ChangeOwnershipContent({onSave, onClose, deletedUser, userList, noOfSharedServers}) { - const classes = useStyles(); + const objChangeOwnership = new ChangeOwnershipSchema(deletedUser, userList, noOfSharedServers); - return { /*This is intentional (SonarQube)*/ }} schema={objChangeOwnership} @@ -74,7 +66,7 @@ export default function ChangeOwnershipContent({onSave, onClose, deletedUser, us disableSqlHelp={true} disableDialogHelp={true} isTabView={false} - formClassName={classes.root} + formClassName='ChangeOwnershipContent-root' />; } ChangeOwnershipContent.propTypes = { diff --git a/web/pgadmin/static/js/Dialogs/ChangePasswordContent.jsx b/web/pgadmin/static/js/Dialogs/ChangePasswordContent.jsx index f56e527b5..d7979449a 100644 --- a/web/pgadmin/static/js/Dialogs/ChangePasswordContent.jsx +++ b/web/pgadmin/static/js/Dialogs/ChangePasswordContent.jsx @@ -1,19 +1,16 @@ -///////////////////////////////////////////////////////////// -// -// pgAdmin 4 - PostgreSQL Tools -// -// Copyright (C) 2013 - 2024, The pgAdmin Development Team -// This software is released under the PostgreSQL Licence -// -////////////////////////////////////////////////////////////// - -import { makeStyles } from '@mui/styles'; +import { styled } from '@mui/material/styles'; import React from 'react'; import PropTypes from 'prop-types'; import gettext from 'sources/gettext'; import BaseUISchema from '../SchemaView/base_schema.ui'; import SchemaView from '../SchemaView'; +const StyledSchemaView = styled(SchemaView )(({theme}) => ({ + '& .ChangePasswordContent-root': { + ...theme.mixins.tabPanel, + } +})); + class ChangePasswordSchema extends BaseUISchema { constructor(user, isPgpassFileUsed, hasCsrfToken=false, showUser=true) { super({ @@ -73,17 +70,9 @@ class ChangePasswordSchema extends BaseUISchema { } } -const useStyles = makeStyles((theme)=>({ - root: { - ...theme.mixins.tabPanel, - }, -})); - export default function ChangePasswordContent({getInitData=() => { /*This is intentional (SonarQube)*/ }, onSave, onClose, hasCsrfToken=false, showUser=true}) { - const classes = useStyles(); - - return { /*This is int disableSqlHelp={true} disableDialogHelp={true} isTabView={false} - formClassName={classes.root} + formClassName='ChangePasswordContent-root' />; } ChangePasswordContent.propTypes = { diff --git a/web/pgadmin/static/js/Dialogs/ConfirmSaveContent.jsx b/web/pgadmin/static/js/Dialogs/ConfirmSaveContent.jsx index 2cd2a926d..9fa0d0d02 100644 --- a/web/pgadmin/static/js/Dialogs/ConfirmSaveContent.jsx +++ b/web/pgadmin/static/js/Dialogs/ConfirmSaveContent.jsx @@ -1,5 +1,5 @@ import React from 'react'; -import { useModalStyles } from '../helpers/ModalProvider'; +import { ModalContent, ModalFooter } from '../../../static/js/components/ModalContent'; import gettext from 'sources/gettext'; import { Box } from '@mui/material'; import { DefaultButton, PrimaryButton } from '../components/Buttons'; @@ -10,24 +10,23 @@ import HTMLReactParser from 'html-react-parser'; import PropTypes from 'prop-types'; export default function ConfirmSaveContent({closeModal, text, onDontSave, onSave}) { - const classes = useModalStyles(); return ( - + {typeof(text) == 'string' ? HTMLReactParser(text) : text} - + } onClick={()=>{ closeModal(); }} >{gettext('Cancel')} - } onClick={()=>{ + } onClick={()=>{ onDontSave?.(); closeModal(); }} >{gettext('Don\'t save')} - } onClick={()=>{ + } onClick={()=>{ onSave?.(); closeModal(); }} autoFocus={true} >{gettext('Save')} - - + + ); } diff --git a/web/pgadmin/static/js/Dialogs/ConnectServerContent.jsx b/web/pgadmin/static/js/Dialogs/ConnectServerContent.jsx index 18439c1e4..37de80c04 100644 --- a/web/pgadmin/static/js/Dialogs/ConnectServerContent.jsx +++ b/web/pgadmin/static/js/Dialogs/ConnectServerContent.jsx @@ -14,11 +14,11 @@ import { DefaultButton, PrimaryButton } from '../components/Buttons'; import CloseIcon from '@mui/icons-material/CloseRounded'; import CheckRoundedIcon from '@mui/icons-material/CheckRounded'; import PropTypes from 'prop-types'; -import { useModalStyles } from '../helpers/ModalProvider'; import { FormFooterMessage, InputCheckbox, InputText, MESSAGE_TYPE } from '../components/FormComponents'; +import { ModalContent, ModalFooter } from '../../../static/js/components/ModalContent'; export default function ConnectServerContent({closeModal, data, onOK, setHeight}) { - const classes = useModalStyles(); + const containerRef = useRef(); const firstEleRef = useRef(); const okBtnRef = useRef(); @@ -58,7 +58,7 @@ export default function ConnectServerContent({closeModal, data, onOK, setHeight} } return ( - + {data.prompt_tunnel_password && <> @@ -105,11 +105,11 @@ export default function ConnectServerContent({closeModal, data, onOK, setHeight} position: 'unset', padding: '12px 0px 0px' }}/> - + } onClick={()=>{ closeModal(); }} >{gettext('Cancel')} - } onClick={()=>{ + } onClick={()=>{ let postFormData = new FormData(); if(data.prompt_tunnel_password) { postFormData.append('tunnel_password', formData.tunnel_password); @@ -124,8 +124,8 @@ export default function ConnectServerContent({closeModal, data, onOK, setHeight} onOK?.(postFormData); closeModal(); }} >{gettext('OK')} - - + + ); } diff --git a/web/pgadmin/static/js/Dialogs/MasterPasswordContent.jsx b/web/pgadmin/static/js/Dialogs/MasterPasswordContent.jsx index d2e62f759..8c62d2dc1 100644 --- a/web/pgadmin/static/js/Dialogs/MasterPasswordContent.jsx +++ b/web/pgadmin/static/js/Dialogs/MasterPasswordContent.jsx @@ -11,19 +11,16 @@ import React, { useState, useRef, useEffect } from 'react'; import PropTypes from 'prop-types'; import gettext from 'sources/gettext'; import url_for from 'sources/url_for'; - import { Box } from '@mui/material'; import CloseIcon from '@mui/icons-material/CloseRounded'; import DeleteForeverIcon from '@mui/icons-material/DeleteForever'; import CheckRoundedIcon from '@mui/icons-material/CheckRounded'; import HelpIcon from '@mui/icons-material/Help'; - import { DefaultButton, PrimaryButton, PgIconButton } from '../components/Buttons'; -import { useModalStyles } from '../helpers/ModalProvider'; import { FormFooterMessage, FormNote, InputText, MESSAGE_TYPE } from '../components/FormComponents'; +import { ModalContent, ModalFooter } from '../../../static/js/components/ModalContent'; export default function MasterPasswordContent({ closeModal, onResetPassowrd, onOK, onCancel, setHeight, isPWDPresent, data, keyringName}) { - const classes = useModalStyles(); const containerRef = useRef(); const firstEleRef = useRef(); const okBtnRef = useRef(); @@ -57,9 +54,8 @@ export default function MasterPasswordContent({ closeModal, onResetPassowrd, onO setHeight?.(containerRef.current?.offsetHeight); }, [containerRef.current]); - return ( - + {isKeyring ? @@ -98,7 +94,7 @@ export default function MasterPasswordContent({ closeModal, onResetPassowrd, onO }} /> } - + } onClick={() => { let _url = url_for('help.static', { @@ -120,7 +116,7 @@ export default function MasterPasswordContent({ closeModal, onResetPassowrd, onO closeModal(); }} >{gettext('Cancel')} } - } + } disabled={formData.password.length == 0} onClick={() => { let postFormData = new FormData(); @@ -132,8 +128,8 @@ export default function MasterPasswordContent({ closeModal, onResetPassowrd, onO > {gettext('OK')} - - ); + + ); } MasterPasswordContent.propTypes = { diff --git a/web/pgadmin/static/js/Dialogs/NamedRestoreContent.jsx b/web/pgadmin/static/js/Dialogs/NamedRestoreContent.jsx index a101ab452..f3208fc43 100644 --- a/web/pgadmin/static/js/Dialogs/NamedRestoreContent.jsx +++ b/web/pgadmin/static/js/Dialogs/NamedRestoreContent.jsx @@ -14,12 +14,11 @@ import { DefaultButton, PrimaryButton } from '../components/Buttons'; import CloseIcon from '@mui/icons-material/CloseRounded'; import CheckRoundedIcon from '@mui/icons-material/CheckRounded'; import PropTypes from 'prop-types'; -import { useModalStyles } from '../helpers/ModalProvider'; +import { ModalContent, ModalFooter } from '../../../static/js/components/ModalContent'; import { InputText } from '../components/FormComponents'; import { isEmptyString } from '../../../static/js/validators'; export default function NamedRestoreContent({closeModal, onOK, setHeight}) { - const classes = useModalStyles(); const containerRef = useRef(); const firstEleRef = useRef(); const okBtnRef = useRef(); @@ -55,7 +54,7 @@ export default function NamedRestoreContent({closeModal, onOK, setHeight}) { const isOKDisabled = isEmptyString(formData.namedRestorePoint); return ( - + @@ -67,18 +66,18 @@ export default function NamedRestoreContent({closeModal, onOK, setHeight}) { onChange={(e)=>onTextChange(e, 'namedRestorePoint')} onKeyDown={(e)=>onKeyDown(e)}/> - + } onClick={()=>{ closeModal(); }} >{gettext('Cancel')} - } onClick={()=>{ + } onClick={()=>{ let postFormData = new FormData(); postFormData.append('value', formData.namedRestorePoint); onOK?.(postFormData); closeModal(); }} >{gettext('OK')} - - + + ); } diff --git a/web/pgadmin/static/js/Dialogs/RenameTabContent.jsx b/web/pgadmin/static/js/Dialogs/RenameTabContent.jsx index cbd2d91a4..617895f2e 100644 --- a/web/pgadmin/static/js/Dialogs/RenameTabContent.jsx +++ b/web/pgadmin/static/js/Dialogs/RenameTabContent.jsx @@ -18,11 +18,10 @@ import CheckRoundedIcon from '@mui/icons-material/CheckRounded'; import gettext from 'sources/gettext'; import { DefaultButton, PrimaryButton } from '../components/Buttons'; -import { useModalStyles } from '../helpers/ModalProvider'; +import { ModalContent, ModalFooter } from '../../../static/js/components/ModalContent'; import { FormFooterMessage, InputText, MESSAGE_TYPE } from '../components/FormComponents'; export default function RenameTabContent({ panelId, panelDocker, closeModal}) { - const classes = useModalStyles(); const containerRef = useRef(); const okBtnRef = useRef(); const panelData = useMemo(()=>panelDocker.find(panelId)); @@ -63,7 +62,7 @@ export default function RenameTabContent({ panelId, panelDocker, closeModal}) { const isValid = formData['title'].length != 0; return ( - + Current: {initialTitle} - + } onClick={() => { closeModal(); }} >{gettext('Cancel')} - } onClick={onOkClick} className={classes.margin} disabled={!isValid}> + } onClick={onOkClick} disabled={!isValid}> {gettext('OK')} - - + + ); } diff --git a/web/pgadmin/static/js/Dialogs/UrlDialogContent.jsx b/web/pgadmin/static/js/Dialogs/UrlDialogContent.jsx index 688470b3a..cded49ea6 100644 --- a/web/pgadmin/static/js/Dialogs/UrlDialogContent.jsx +++ b/web/pgadmin/static/js/Dialogs/UrlDialogContent.jsx @@ -17,19 +17,17 @@ import CloseIcon from '@mui/icons-material/CloseRounded'; import HelpIcon from '@mui/icons-material/Help'; import { DefaultButton, PgIconButton } from '../components/Buttons'; -import { useModalStyles } from '../helpers/ModalProvider'; +import { ModalContent, ModalFooter }from '../../../static/js/components/ModalContent'; export default function UrlDialogContent({ url, helpFile, onClose }) { - const classes = useModalStyles(); - return ( - +