MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / getColumn

Function getColumn

web/pgadmin/misc/statistics/static/js/Statistics.jsx:38–82  ·  view source on GitHub ↗
(data, singleLineStatistics, prettifyFields=[])

Source from the content-addressed store, hash-verified

36}));
37
38function getColumn(data, singleLineStatistics, prettifyFields=[]) {
39 let columns = [];
40 if (!singleLineStatistics) {
41 if (!_.isUndefined(data)) {
42 data.forEach((row) => {
43 columns.push({
44 header: row.name,
45 accessorKey: row.name,
46 enableSorting: true,
47 enableResizing: true,
48 enableFilters: true,
49 sortingFn: 'alphanumeric',
50 });
51 });
52 }
53 } else {
54 columns = [
55 {
56 header: gettext('Statistics'),
57 accessorKey: 'name',
58 enableSorting: true,
59 enableResizing: true,
60 enableFilters: true,
61 },
62 {
63 header: 'Value',
64 accessorKey: 'value',
65 enableSorting: false,
66 enableResizing: true,
67 enableFilters: true,
68 },
69 ];
70 }
71 columns.forEach((c)=>{
72 // Prettify the cell view
73 if(prettifyFields.includes(c.header)) {
74 c.cell = ({cell})=><>{toPrettySize(cell.getValue())}</>;
75 c.cell.displayName = 'Cell';
76 c.cell.propTypes = {
77 value: PropTypes.any,
78 };
79 }
80 });
81 return columns;
82}
83
84function getTableData(res, node) {
85 let nodeStats = [],

Callers 1

getTableDataFunction · 0.85

Calls 3

toPrettySizeFunction · 0.90
gettextFunction · 0.85
getValueMethod · 0.80

Tested by

no test coverage detected