Skip to content

Commit

Permalink
Fix system stat dashboard UI issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sahil1479 authored Oct 11, 2023
1 parent 6997d01 commit cd84200
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 29 deletions.
1 change: 1 addition & 0 deletions web/pgadmin/dashboard/static/js/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const useStyles = makeStyles((theme) => ({
'& > div': {
display: 'flex',
fontWeight: 'normal',
flexWrap: 'wrap',

'& .legend-value': {
marginLeft: '4px',
Expand Down
11 changes: 8 additions & 3 deletions web/pgadmin/dashboard/static/js/SystemStats/CPU.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,11 @@ const useStyles = makeStyles((theme) => ({
width: '100%',
},
containerHeader: {
fontSize: '16px',
fontSize: '15px',
fontWeight: 'bold',
marginBottom: '5px',
display: 'flex',
alignItems: 'center',
height: '100%',
},
}));

Expand Down Expand Up @@ -91,7 +93,7 @@ export default function CPU({preferences, sid, did, pageVisible, enablePoll=true
disableGlobalFilter: false,
},
{
Header: gettext('CPU Usage'),
Header: gettext('CPU usage'),
accessor: 'cpu_usage',
sortable: true,
resizable: true,
Expand Down Expand Up @@ -278,6 +280,9 @@ export function CPUWrapper(props) {
<div className={classes.tableContainer}>
<PgTable
className={classes.autoResizer}
CustomHeader={() => {
return <div className={classes.containerHeader}>{gettext('Process CPU usage')}</div>;
}}
columns={props.tableHeader}
data={props.processCpuUsageStats}
msg={props.errorMsg}
Expand Down
13 changes: 9 additions & 4 deletions web/pgadmin/dashboard/static/js/SystemStats/Memory.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ const useStyles = makeStyles((theme) => ({
width: '100%',
},
containerHeader: {
fontSize: '16px',
fontSize: '15px',
fontWeight: 'bold',
marginBottom: '5px',
display: 'flex',
alignItems: 'center',
height: '100%',
}
}));

Expand Down Expand Up @@ -89,14 +91,14 @@ export default function Memory({preferences, sid, did, pageVisible, enablePoll=t
disableGlobalFilter: false,
},
{
Header: gettext('Memory Usage'),
Header: gettext('Memory usage'),
accessor: 'memory_usage',
sortable: true,
resizable: true,
disableGlobalFilter: false,
},
{
Header: gettext('Memory Bytes'),
Header: gettext('Memory bytes'),
accessor: 'memory_bytes',
sortable: true,
resizable: true,
Expand Down Expand Up @@ -281,6 +283,9 @@ export function MemoryWrapper(props) {
<div className={classes.tableContainer}>
<PgTable
className={classes.autoResizer}
CustomHeader={() => {
return <div className={classes.containerHeader}>{gettext('Process memory usage')}</div>;
}}
columns={props.tableHeader}
data={props.processMemoryUsageStats}
msg={props.errorMsg}
Expand Down
40 changes: 20 additions & 20 deletions web/pgadmin/dashboard/static/js/SystemStats/Storage.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/////////////////////////////////////////////////////////////
//
// pgAdmin 4 - PostgreSQL Tools
//
// Copyright (C) 2013 - 2023, The pgAdmin Development Team
// This software is released under the PostgreSQL Licence
//
//////////////////////////////////////////////////////////////
import React, { useState, useEffect, useRef, useReducer, useMemo } from 'react';
import gettext from 'sources/gettext';
import PropTypes from 'prop-types';
Expand All @@ -28,17 +20,25 @@ const useStyles = makeStyles((theme) => ({
container: {
height: 'auto',
padding: '8px',
marginBottom: '4px',
marginBottom: '6px',
},
driveContainer: {
width: '100%',
},
diskInfoContainer: {
height: 'auto',
padding: '8px',
marginBottom: '4px',
padding: '8px 8px 0px 8px',
marginBottom: '0px',
},
diskInfoSummary: {
height: 'auto',
padding: '0px',
marginBottom: '4px',
padding: '0px 0px 4px 0px',
marginBottom: '0px',
},
diskInfoCharts: {
height: 'auto',
padding: '0px 0px 2px 0px',
marginBottom: '0px',
},
containerHeaderText: {
fontWeight: 'bold',
Expand All @@ -50,7 +50,7 @@ const useStyles = makeStyles((theme) => ({
border: '1px solid '+theme.otherVars.borderColor,
borderCollapse: 'collapse',
borderRadius: '4px',
overflow: 'hidden',
overflow: 'auto',
width: '100%',
margin: '4px 4px 4px 4px',
},
Expand All @@ -63,7 +63,7 @@ const useStyles = makeStyles((theme) => ({
height: 'auto',
padding: '5px 0px 0px 0px',
background: theme.otherVars.tableBg,
marginBottom: '4px',
marginBottom: '5px',
borderRadius: '4px 4px 0px 0px',
},
driveContainerBody: {
Expand Down Expand Up @@ -418,19 +418,19 @@ export function StorageWrapper(props) {
<DiskStatsTable tableHeader={props.tableHeader} data={props.diskStats} />
</div>
</Grid>
<Grid container spacing={1} className={classes.diskInfoSummary}>
<Grid container spacing={1} className={classes.diskInfoCharts}>
<Grid item md={6} sm={12}>
<ChartContainer
id='t-space-graph'
title={gettext('')}
datasets={props.diskStats.map((item, index) => ({
borderColor: colors[(index + 2) % colors.length],
label: item.mount_point !== 'null' ? item.mount_point : item.drive_letter !== 'null' ? item.drive_letter : 'disk' + index,
label: item.mount_point !== '' ? item.mount_point : item.drive_letter !== '' ? item.drive_letter : 'disk' + index,
}))}
errorMsg={props.errorMsg}
isTest={props.isTest}>
<PieChart data={{
labels: props.diskStats.map((item, index) => item.mount_point!='null'?item.mount_point:item.drive_letter!='null'?item.drive_letter:'disk'+index),
labels: props.diskStats.map((item, index) => item.mount_point!=''?item.mount_point:item.drive_letter!=''?item.drive_letter:'disk'+index),
datasets: [
{
data: props.diskStats.map((item) => item.total_space_actual?item.total_space_actual:0),
Expand Down Expand Up @@ -464,7 +464,7 @@ export function StorageWrapper(props) {
<Grid item md={6} sm={12}>
<ChartContainer id='ua-space-graph' title={gettext('')} datasets={[{borderColor: '#FF6384', label: 'Used space'}, {borderColor: '#36a2eb', label: 'Available space'}]} errorMsg={props.errorMsg} isTest={props.isTest}>
<BarChart data={{
labels: props.diskStats.map((item, index) => item.mount_point!='null'?item.mount_point:item.drive_letter!='null'?item.drive_letter:'disk'+index),
labels: props.diskStats.map((item, index) => item.mount_point!=''?item.mount_point:item.drive_letter!=''?item.drive_letter:'disk'+index),
datasets: [
{
label: 'Used space',
Expand Down Expand Up @@ -556,4 +556,4 @@ StorageWrapper.propTypes = {
lineBorderWidth: PropTypes.number.isRequired,
isDatabase: PropTypes.bool.isRequired,
isTest: PropTypes.bool,
};
};
2 changes: 0 additions & 2 deletions web/pgadmin/dashboard/static/js/SystemStats/utility.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export function getStatsUrl(sid=-1, did=-1, chart_names=[]) {
base_url += '/' + sid;
base_url += (did > 0) ? ('/' + did) : '';
base_url += '?chart_names=' + chart_names.join(',');

return base_url;
}

Expand All @@ -36,7 +35,6 @@ export function transformData(labels, refreshRate) {
pointHitRadius: DATA_POINT_SIZE,
};
}) || [];

return {
datasets: datasets,
refreshRate: refreshRate,
Expand Down

0 comments on commit cd84200

Please sign in to comment.