From 27bd28ee97fac7b4d3e8f3298462bb79201e8d11 Mon Sep 17 00:00:00 2001 From: Aditya Toshniwal Date: Tue, 6 May 2025 19:39:33 +0530 Subject: [PATCH] Replace Grid with Grid2 as the former is deprecated by MUI --- .../about/static/js/AboutComponent.jsx | 42 +++++++------- web/pgadmin/dashboard/static/js/Graphs.jsx | 12 ++-- .../static/js/Replication/PGDReplication.jsx | 6 +- .../static/js/SystemStats/CpuDetails.jsx | 11 ++-- .../static/js/SystemStats/Memory.jsx | 56 +++++++++---------- .../static/js/SystemStats/Storage.jsx | 8 +-- .../static/js/SystemStats/Summary.jsx | 10 ++-- .../static/js/Explain/ExplainStatistics.jsx | 6 +- .../static/js/SchemaView/InlineView.jsx | 2 +- .../static/js/components/FormComponents.jsx | 12 ++-- .../static/js/components/QueryThresholds.jsx | 12 ++-- .../extensions/breakpointGutter.js | 4 +- .../static/js/components/SelectThemes.jsx | 6 +- .../static/js/helpers/Layout/index.jsx | 2 +- web/pgadmin/static/js/helpers/Menu.js | 2 +- .../static/js/components/InputComponent.jsx | 10 ++-- .../js/components/SchemaDiffCompare.jsx | 10 ++-- .../js/components/QueryToolDataGrid/index.jsx | 4 +- .../js/components/sections/QueryHistory.jsx | 14 ++--- 19 files changed, 113 insertions(+), 116 deletions(-) diff --git a/web/pgadmin/about/static/js/AboutComponent.jsx b/web/pgadmin/about/static/js/AboutComponent.jsx index cc69e1aca..5068ee214 100644 --- a/web/pgadmin/about/static/js/AboutComponent.jsx +++ b/web/pgadmin/about/static/js/AboutComponent.jsx @@ -10,7 +10,7 @@ import gettext from 'sources/gettext'; import url_for from 'sources/url_for'; import React, { useEffect, useState, useRef } from 'react'; -import { Box, Grid, InputLabel } from '@mui/material'; +import { Box, Grid2 as Grid, InputLabel } from '@mui/material'; import { InputSQL } from '../../../static/js/components/FormComponents'; import getApiInstance from '../../../static/js/api_instance'; import { usePgAdmin } from '../../../static/js/PgAdminProvider'; @@ -34,89 +34,89 @@ export default function AboutComponent() { return ( - + {gettext('Version')} - + {aboutData.version} - + {gettext('Application Mode')} - + {aboutData.app_mode} - + {gettext('Commit')} - + {aboutData.commit_hash} - + {gettext('Python Version')} - + {aboutData.python_version} - + {gettext('Current User')} - + {aboutData.current_user} { aboutData.electron && - + {gettext('Electron Version')} - + {aboutData.electron} } - + {gettext('Browser')} - + {aboutData.browser_details} { aboutData.os_details && - + {gettext('Operating System')} - + {aboutData.os_details} } { aboutData.config_db && - + {gettext('pgAdmin Database File')} - + {aboutData.config_db} } { aboutData.log_file && - + {gettext('Log File')} - + {aboutData.log_file} diff --git a/web/pgadmin/dashboard/static/js/Graphs.jsx b/web/pgadmin/dashboard/static/js/Graphs.jsx index 882f18680..858d1632e 100644 --- a/web/pgadmin/dashboard/static/js/Graphs.jsx +++ b/web/pgadmin/dashboard/static/js/Graphs.jsx @@ -16,7 +16,7 @@ import {getGCD, getEpoch} from 'sources/utils'; import {useInterval, usePrevious} from 'sources/custom_hooks'; import PropTypes from 'prop-types'; import StreamingChart from '../../../static/js/components/PgChart/StreamingChart'; -import { Grid, useTheme } from '@mui/material'; +import { Grid2 as Grid, useTheme } from '@mui/material'; import { getChartColor, toPrettySize } from '../../../static/js/utils'; export const X_AXIS_LENGTH = 75; @@ -253,30 +253,30 @@ export function GraphsWrapper(props) { return ( <> - + toPrettySize(v, '')}/> - + toPrettySize(v, '')}/> - + toPrettySize(v, '')}/> - + toPrettySize(v, '')}/> - + toPrettySize(v, '')}/> diff --git a/web/pgadmin/dashboard/static/js/Replication/PGDReplication.jsx b/web/pgadmin/dashboard/static/js/Replication/PGDReplication.jsx index c5f229cc3..bc613e146 100644 --- a/web/pgadmin/dashboard/static/js/Replication/PGDReplication.jsx +++ b/web/pgadmin/dashboard/static/js/Replication/PGDReplication.jsx @@ -7,7 +7,7 @@ // ////////////////////////////////////////////////////////////// -import { Box, Grid, useTheme } from '@mui/material'; +import { Box, Grid2 as Grid, useTheme } from '@mui/material'; import React, { useEffect, useMemo, useReducer, useRef, useState } from 'react'; import gettext from 'sources/gettext'; @@ -406,14 +406,14 @@ export default function PGDReplication({preferences, treeNodeInfo, pageVisible, return ( - + toPrettySize(v, 's')} /> - + diff --git a/web/pgadmin/dashboard/static/js/SystemStats/CpuDetails.jsx b/web/pgadmin/dashboard/static/js/SystemStats/CpuDetails.jsx index 04d05e4b4..078fb3c8c 100644 --- a/web/pgadmin/dashboard/static/js/SystemStats/CpuDetails.jsx +++ b/web/pgadmin/dashboard/static/js/SystemStats/CpuDetails.jsx @@ -6,14 +6,14 @@ // This software is released under the PostgreSQL Licence // ////////////////////////////////////////////////////////////// - + 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 {getGCD, getEpoch} from 'sources/utils'; import ChartContainer from '../components/ChartContainer.jsx'; -import { Box, Grid } from '@mui/material'; +import { Box, Grid2 as Grid } from '@mui/material'; import { DATA_POINT_SIZE } from 'sources/chartjs'; import StreamingChart from '../../../../static/js/components/PgChart/StreamingChart.jsx'; import {useInterval, usePrevious} from 'sources/custom_hooks'; @@ -217,14 +217,14 @@ export function CPUWrapper(props) { lineBorderWidth: props.lineBorderWidth, }), [props.showTooltip, props.showDataPoints, props.lineBorderWidth]); return ( - ( + - + - + @@ -243,7 +243,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 e501dbb67..3f9846519 100644 --- a/web/pgadmin/dashboard/static/js/SystemStats/Memory.jsx +++ b/web/pgadmin/dashboard/static/js/SystemStats/Memory.jsx @@ -12,7 +12,7 @@ import gettext from 'sources/gettext'; import PropTypes from 'prop-types'; import {getGCD, getEpoch} from 'sources/utils'; import ChartContainer from '../components/ChartContainer'; -import { Box, Grid } from '@mui/material'; +import { Box, Grid2 as Grid } from '@mui/material'; import { DATA_POINT_SIZE } from 'sources/chartjs'; import StreamingChart from '../../../../static/js/components/PgChart/StreamingChart'; import {useInterval, usePrevious} from 'sources/custom_hooks'; @@ -222,36 +222,34 @@ 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 f37693a82..d08fbafe3 100644 --- a/web/pgadmin/dashboard/static/js/SystemStats/Storage.jsx +++ b/web/pgadmin/dashboard/static/js/SystemStats/Storage.jsx @@ -13,7 +13,7 @@ import PropTypes from 'prop-types'; import url_for from 'sources/url_for'; import {getGCD, getEpoch} from 'sources/utils'; import ChartContainer from '../components/ChartContainer'; -import { Grid } from '@mui/material'; +import { Grid2 as Grid } from '@mui/material'; import { DATA_POINT_SIZE } from 'sources/chartjs'; import StreamingChart from '../../../../static/js/components/PgChart/StreamingChart'; import {useInterval, usePrevious} from 'sources/custom_hooks'; @@ -424,7 +424,7 @@ export function StorageWrapper(props) { - + - + getLabel(item, index)), @@ -502,7 +502,7 @@ export function StorageWrapper(props) { {Object.keys(props.ioInfo[drive]).map((type, innerKeyIndex) => ( - + { diff --git a/web/pgadmin/dashboard/static/js/SystemStats/Summary.jsx b/web/pgadmin/dashboard/static/js/SystemStats/Summary.jsx index 5036553bd..45fa142db 100644 --- a/web/pgadmin/dashboard/static/js/SystemStats/Summary.jsx +++ b/web/pgadmin/dashboard/static/js/SystemStats/Summary.jsx @@ -14,7 +14,7 @@ import url_for from 'sources/url_for'; import getApiInstance from 'sources/api_instance'; import {getGCD, getEpoch} from 'sources/utils'; import ChartContainer from '../components/ChartContainer'; -import { Grid } from '@mui/material'; +import { Grid2 as Grid } from '@mui/material'; import { DATA_POINT_SIZE } from 'sources/chartjs'; import StreamingChart from '../../../../static/js/components/PgChart/StreamingChart'; import {useInterval, usePrevious} from 'sources/custom_hooks'; @@ -250,26 +250,26 @@ function SummaryWrapper(props) { return ( <> - +
{gettext('OS information')}
- + - +
{gettext('CPU information')}
- + diff --git a/web/pgadmin/static/js/Explain/ExplainStatistics.jsx b/web/pgadmin/static/js/Explain/ExplainStatistics.jsx index 735b7a839..4b236cacc 100644 --- a/web/pgadmin/static/js/Explain/ExplainStatistics.jsx +++ b/web/pgadmin/static/js/Explain/ExplainStatistics.jsx @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////// import React from 'react'; import { styled } from '@mui/material/styles'; -import { Box, Grid } from '@mui/material'; +import { Box, Grid2 as Grid } from '@mui/material'; import gettext from 'sources/gettext'; import _ from 'lodash'; import PropTypes from 'prop-types'; @@ -40,7 +40,7 @@ export default function ExplainStatistics({explainTable}) { return ( - +
{gettext('Statistics per Node Type')}
@@ -68,7 +68,7 @@ export default function ExplainStatistics({explainTable}) {
- +
{gettext('Statistics per Relation')}
diff --git a/web/pgadmin/static/js/SchemaView/InlineView.jsx b/web/pgadmin/static/js/SchemaView/InlineView.jsx index 5d3a53206..5f6b65110 100644 --- a/web/pgadmin/static/js/SchemaView/InlineView.jsx +++ b/web/pgadmin/static/js/SchemaView/InlineView.jsx @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////// import React, { useContext } from 'react'; -import { Grid } from '@mui/material'; +import { Grid2 as Grid } from '@mui/material'; import _ from 'lodash'; import PropTypes from 'prop-types'; diff --git a/web/pgadmin/static/js/components/FormComponents.jsx b/web/pgadmin/static/js/components/FormComponents.jsx index 8cafba53d..0bd337e71 100644 --- a/web/pgadmin/static/js/components/FormComponents.jsx +++ b/web/pgadmin/static/js/components/FormComponents.jsx @@ -12,7 +12,7 @@ import React, { forwardRef, useCallback, useEffect, useMemo, useRef, useState } import { styled } from '@mui/material/styles'; import { Box, FormControl, OutlinedInput, FormHelperText, ToggleButton, ToggleButtonGroup, - Grid, IconButton, FormControlLabel, Switch, Checkbox, useTheme, InputLabel, Paper, Select as MuiSelect, Radio, Tooltip, + Grid2 as Grid, IconButton, FormControlLabel, Switch, Checkbox, useTheme, InputLabel, Paper, Select as MuiSelect, Radio, Tooltip, } from '@mui/material'; import ErrorRoundedIcon from '@mui/icons-material/ErrorOutlineRounded'; import InfoRoundedIcon from '@mui/icons-material/InfoRounded'; @@ -128,13 +128,13 @@ export function FormInput({ children, error, className, label, helpMessage, requ if(!withContainer) { return ( (<> - + {label} - + {React.cloneElement(children, { cid, helpid })} @@ -150,7 +150,7 @@ export function FormInput({ children, error, className, label, helpMessage, requ ; return ( - + { labelTooltip ? @@ -158,7 +158,7 @@ export function FormInput({ children, error, className, label, helpMessage, requ : labelComponent } - + {React.cloneElement(children, { cid, helpid })} @@ -392,7 +392,7 @@ export const InputText = forwardRef(({ const filteredProps = _.pickBy(props, (_v, key)=>( /* When used in ButtonGroup, following props should be skipped */ - !['color', 'disableElevation', 'disableFocusRipple', 'disableRipple'].includes(key) + (!['color', 'disableElevation', 'disableFocusRipple', 'disableRipple'].includes(key)) )); return ( diff --git a/web/pgadmin/static/js/components/QueryThresholds.jsx b/web/pgadmin/static/js/components/QueryThresholds.jsx index f6fd85b13..341fc15cb 100644 --- a/web/pgadmin/static/js/components/QueryThresholds.jsx +++ b/web/pgadmin/static/js/components/QueryThresholds.jsx @@ -9,7 +9,7 @@ import gettext from 'sources/gettext'; import _ from 'lodash'; -import { FormGroup, Grid, Typography } from '@mui/material'; +import { FormGroup, Grid2 as Grid, Typography } from '@mui/material'; import React from 'react'; import { InputText } from './FormComponents'; import PropTypes from 'prop-types'; @@ -40,19 +40,19 @@ export default function QueryThresholds({ value, onChange }) { direction="row" alignItems="center" > - + {gettext('Warning')} - + - + {gettext('Alert')} - + - + {gettext('(in minutes)')} diff --git a/web/pgadmin/static/js/components/ReactCodeMirror/extensions/breakpointGutter.js b/web/pgadmin/static/js/components/ReactCodeMirror/extensions/breakpointGutter.js index 030cc06e4..62cab0020 100644 --- a/web/pgadmin/static/js/components/ReactCodeMirror/extensions/breakpointGutter.js +++ b/web/pgadmin/static/js/components/ReactCodeMirror/extensions/breakpointGutter.js @@ -45,9 +45,9 @@ export function clearBreakpoints(view) { }); } -const breakpointMarker = new class extends GutterMarker { +const breakpointMarker = new (class extends GutterMarker { toDOM() { return document.createTextNode('●'); } -}; +}); const breakpointGutter = [ breakpointField, diff --git a/web/pgadmin/static/js/components/SelectThemes.jsx b/web/pgadmin/static/js/components/SelectThemes.jsx index d73430d29..53574cb66 100644 --- a/web/pgadmin/static/js/components/SelectThemes.jsx +++ b/web/pgadmin/static/js/components/SelectThemes.jsx @@ -8,7 +8,7 @@ ////////////////////////////////////////////////////////////// import gettext from 'sources/gettext'; -import { Grid, FormHelperText } from '@mui/material'; +import { Grid2 as Grid, FormHelperText } from '@mui/material'; import React, { useMemo } from 'react'; import {InputSelect } from './FormComponents'; import PropTypes from 'prop-types'; @@ -23,10 +23,10 @@ export default function SelectThemes({onChange, helpMessage, ...props}) { const helpid = `h${cid}`; return ( - + - + { previewSrc && <> {HTMLReactParse(helpMessage || '')} {gettext('Preview diff --git a/web/pgadmin/static/js/helpers/Layout/index.jsx b/web/pgadmin/static/js/helpers/Layout/index.jsx index c91d76a90..eec050b2b 100644 --- a/web/pgadmin/static/js/helpers/Layout/index.jsx +++ b/web/pgadmin/static/js/helpers/Layout/index.jsx @@ -247,7 +247,7 @@ export class LayoutDocker { if(child.children) { flattenLayout(child, arr); } else { - arr.push(...child.tabs??[]); + arr.push(...(child.tabs ?? [])); } }); }; diff --git a/web/pgadmin/static/js/helpers/Menu.js b/web/pgadmin/static/js/helpers/Menu.js index 6f5a57a29..6c7cd2566 100644 --- a/web/pgadmin/static/js/helpers/Menu.js +++ b/web/pgadmin/static/js/helpers/Menu.js @@ -176,7 +176,7 @@ export class MenuItem { name: label, disabled: is_disabled, callback: self.callback.bind(self), - ...(sub_ctx_item && Object.keys(sub_ctx_item).length > 0) && { items: sub_ctx_item } + ...((sub_ctx_item && Object.keys(sub_ctx_item).length > 0) && { items: sub_ctx_item }) }; } diff --git a/web/pgadmin/tools/schema_diff/static/js/components/InputComponent.jsx b/web/pgadmin/tools/schema_diff/static/js/components/InputComponent.jsx index a98e175c8..c23857b42 100644 --- a/web/pgadmin/tools/schema_diff/static/js/components/InputComponent.jsx +++ b/web/pgadmin/tools/schema_diff/static/js/components/InputComponent.jsx @@ -10,7 +10,7 @@ import PropTypes from 'prop-types'; import React, { useContext, useState, useEffect } from 'react'; -import { Box, Grid, Typography } from '@mui/material'; +import { Box, Grid2 as Grid, Typography } from '@mui/material'; import { InputSelect } from '../../../../../static/js/components/FormComponents'; import { SchemaDiffEventsContext } from './SchemaDiffComponent'; @@ -68,10 +68,10 @@ export function InputComponent({ label, serverList, databaseList, schemaList, di direction="row" alignItems="center" > - + {label} - + - + c.value), ',') : null} @@ -102,7 +102,7 @@ export function InputComponent({ label, serverList, databaseList, schemaList, di > - + c.value), ',') : null} diff --git a/web/pgadmin/tools/schema_diff/static/js/components/SchemaDiffCompare.jsx b/web/pgadmin/tools/schema_diff/static/js/components/SchemaDiffCompare.jsx index 00f9fc0f1..777d33186 100644 --- a/web/pgadmin/tools/schema_diff/static/js/components/SchemaDiffCompare.jsx +++ b/web/pgadmin/tools/schema_diff/static/js/components/SchemaDiffCompare.jsx @@ -11,7 +11,7 @@ import PropTypes from 'prop-types'; import React, { useContext, useEffect, useState } from 'react'; -import { Box, Grid } from '@mui/material'; +import { Box, Grid2 as Grid } from '@mui/material'; import InfoRoundedIcon from '@mui/icons-material/InfoRounded'; import HelpIcon from '@mui/icons-material/HelpRounded'; @@ -693,7 +693,7 @@ export function SchemaDiffCompare({ params }) { direction="row" alignItems="center" > - + - + } onClick={onHelpClick} /> @@ -717,7 +717,7 @@ export function SchemaDiffCompare({ params }) { direction="row" alignItems="center" > - + - + ({ backgroundColor: theme.palette.primary.light + '!important', } }, - ... stripedRows && {'& .rdg-row.rdg-row-even': { + ... (stripedRows && {'& .rdg-row.rdg-row-even': { backgroundColor: theme.palette.grey[400], - }}, + }}), '& .rdg-row': { '& .rdg-cell:nth-of-type(1)': { backgroundColor: theme.palette.grey[600] + '!important', diff --git a/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx b/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx index 6a51f09ed..6be6e6a4a 100644 --- a/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx +++ b/web/pgadmin/tools/sqleditor/static/js/components/sections/QueryHistory.jsx @@ -4,7 +4,7 @@ import { PANELS, QUERY_TOOL_EVENTS, MAX_QUERY_LENGTH } from '../QueryToolConstan import gettext from 'sources/gettext'; import pgAdmin from 'sources/pgadmin'; import _ from 'lodash'; -import { Box, Grid, List, ListItem, ListItemButton, ListSubheader } from '@mui/material'; +import { Box, Grid2 as Grid, List, ListItem, ListItemButton, ListSubheader } from '@mui/material'; import url_for from 'sources/url_for'; import { QueryToolConnectionContext, QueryToolContext, QueryToolEventsContext } from '../QueryToolComponent'; import moment from 'moment'; @@ -328,14 +328,14 @@ function QueryHistoryDetails({entry}) { {entry.info && {entry.info}} - {getDateFormatted(entry.start_time) + ' ' + getTimeFormatted(entry.start_time)} - {entry?.row_affected > 0 && entry.row_affected} - {entry.total_time} + {getDateFormatted(entry.start_time) + ' ' + getTimeFormatted(entry.start_time)} + {entry?.row_affected > 0 && entry.row_affected} + {entry.total_time} - {gettext('Date')} - {gettext('Rows affected')} - {gettext('Duration')} + {gettext('Date')} + {gettext('Rows affected')} + {gettext('Duration')} {copyText}