From f72f4aa3595649fd70232a91834057eddf95bd3f Mon Sep 17 00:00:00 2001 From: Aditya Toshniwal Date: Tue, 14 Mar 2023 11:04:08 +0530 Subject: [PATCH] Dashboard graph Y-axis width should increase with label. #5929 --- web/pgadmin/browser/static/js/node_view.jsx | 2 +- .../static/js/components/PgChart/StreamingChart.jsx | 10 ++++++++++ web/pgadmin/static/js/helpers/Notifier.jsx | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/web/pgadmin/browser/static/js/node_view.jsx b/web/pgadmin/browser/static/js/node_view.jsx index 47dc8e41a..9dded4d1a 100644 --- a/web/pgadmin/browser/static/js/node_view.jsx +++ b/web/pgadmin/browser/static/js/node_view.jsx @@ -80,7 +80,7 @@ export function getNodeView(nodeType, treeNodeInfo, actionType, itemNodeData, fo resolve(res.data); onSave && onSave(res.data); }).catch((err)=>{ - Notify.pgNotifier('error', err, '', function(msg) { + Notify.pgNotifier('error-noalert', err, '', function(msg) { if (msg == 'CRYPTKEY_SET') { return Promise.resolve(onSaveClick(isNew, data)); } else if (msg == 'CRYPTKEY_NOT_SET') { diff --git a/web/pgadmin/static/js/components/PgChart/StreamingChart.jsx b/web/pgadmin/static/js/components/PgChart/StreamingChart.jsx index 903c85590..924be1e3a 100644 --- a/web/pgadmin/static/js/components/PgChart/StreamingChart.jsx +++ b/web/pgadmin/static/js/components/PgChart/StreamingChart.jsx @@ -92,6 +92,16 @@ export default function StreamingChart({xRange=75, data, options}) { { show: false, }, + { + size: function(_obj, values) { + let size = 40; + if(values?.length > 0) { + size = values[values.length-1].length*12; + if(size < 40) size = 40; + } + return size; + } + } ], plugins: options.showTooltip ? [tooltipPlugin(data.refreshRate)] : [], }), [data.refreshRate, data?.datasets?.length, width, height, options]); diff --git a/web/pgadmin/static/js/helpers/Notifier.jsx b/web/pgadmin/static/js/helpers/Notifier.jsx index a21419bf9..4bda523cc 100644 --- a/web/pgadmin/static/js/helpers/Notifier.jsx +++ b/web/pgadmin/static/js/helpers/Notifier.jsx @@ -192,6 +192,9 @@ let Notifier = { return; } } + if(type == 'error-noalert' && onJSONResult && typeof(onJSONResult) == 'function') { + return onJSONResult(); + } this.alert(promptmsg, msg.replace(new RegExp(/\r?\n/, 'g'), '
')); }, alert: (title, text, onOkClick, okLabel=gettext('OK'))=>{