public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin4][RM7299]: Statistics.jsx has sort issue
2+ messages / 2 participants
[nested] [flat]
* [pgAdmin4][RM7299]: Statistics.jsx has sort issue
@ 2022-04-19 01:47 Pradip Parkale <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Pradip Parkale @ 2022-04-19 01:47 UTC (permalink / raw)
To: pgadmin-hackers
Hi Hackers,
Please find the attached patch for #7299. I have fixed the sorting issue
for the size column where we are displaying units like 'MB', 'bytes'.
--
Thanks & Regards,
Pradip Parkale
Software Engineer | EnterpriseDB Corporation
Attachments:
[application/octet-stream] RM7299.patch (2.2K, 3-RM7299.patch)
download | inline diff:
diff --git a/web/pgadmin/misc/statistics/static/js/Statistics.jsx b/web/pgadmin/misc/statistics/static/js/Statistics.jsx
index 7ed0dc198..0ec07f838 100644
--- a/web/pgadmin/misc/statistics/static/js/Statistics.jsx
+++ b/web/pgadmin/misc/statistics/static/js/Statistics.jsx
@@ -57,17 +57,52 @@ const useStyles = makeStyles((theme) => ({
}));
function getColumn(data, singleLineStatistics) {
- let columns = [];
+ let columns = [], column;
if (!singleLineStatistics) {
if (!_.isUndefined(data)) {
data.forEach((row) => {
- var column = {
- Header: row.name,
- accessor: row.name,
- sortble: true,
- resizable: false,
- disableGlobalFilter: false,
- };
+ if (row.name == 'Size') {
+ column = {
+ Header: row.name,
+ accessor: row.name,
+ sortble: true,
+ resizable: false,
+ disableGlobalFilter: false,
+ sortType: ((rowA, rowB, id) => {
+ let val1 = rowA.values[id];
+ let val2 = rowB.values[id];
+ const sizes = ['bytes', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
+ sizes.some((t, i) => {
+ if (!_.isNull(rowA.values[id]) && typeof (rowA.values[id]) == 'string' && rowA.values[id].indexOf(t) > -1) {
+ val1 = (parseInt(rowA.values[id]) * Math.pow(1024, i));
+ }
+
+ if (!_.isNull(rowB.values[id]) && typeof (rowB.values[id]) == 'string' && rowB.values[id].indexOf(t) > -1) {
+ val2 = parseInt(rowB.values[id]) * Math.pow(1024, i);
+ }
+
+ });
+
+ if ((val1) > (val2) || _.isNull(val2)) {
+ return 1;
+ }
+ if ((val2) > (val1) || _.isNull(val1)) {
+ return -1;
+ }
+ return 0;
+
+ })
+ };
+ }else{
+ column = {
+ Header: row.name,
+ accessor: row.name,
+ sortble: true,
+ resizable: false,
+ disableGlobalFilter: false,
+ };
+
+ }
columns.push(column);
});
}
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [pgAdmin4][RM7299]: Statistics.jsx has sort issue
@ 2022-04-20 05:03 Akshay Joshi <[email protected]>
parent: Pradip Parkale <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Akshay Joshi @ 2022-04-20 05:03 UTC (permalink / raw)
To: Pradip Parkale <[email protected]>; +Cc: pgadmin-hackers
Thanks, the patch applied.
On Tue, Apr 19, 2022 at 7:17 AM Pradip Parkale <
[email protected]> wrote:
> Hi Hackers,
>
> Please find the attached patch for #7299. I have fixed the sorting issue
> for the size column where we are displaying units like 'MB', 'bytes'.
>
> --
> Thanks & Regards,
> Pradip Parkale
> Software Engineer | EnterpriseDB Corporation
>
--
*Thanks & Regards*
*Akshay Joshi*
*pgAdmin Hacker | Principal Software Architect*
*EDB Postgres <http://edbpostgres.com>*
*Mobile: +91 976-788-8246*
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2022-04-20 05:03 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-04-19 01:47 [pgAdmin4][RM7299]: Statistics.jsx has sort issue Pradip Parkale <[email protected]>
2022-04-20 05:03 ` Akshay Joshi <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox