From 62a6671b7acb42a8b493cd581dcfc6816e11e2d2 Mon Sep 17 00:00:00 2001 From: Christopher Solanilla Date: Fri, 6 Sep 2024 11:33:25 -0400 Subject: [PATCH 1/2] checks the length of the title before saving --- src/components/widget-creator.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/widget-creator.jsx b/src/components/widget-creator.jsx index e6bb9a669..9183cdcdb 100644 --- a/src/components/widget-creator.jsx +++ b/src/components/widget-creator.jsx @@ -384,6 +384,18 @@ const WidgetCreator = ({instId, widgetId, minHeight='', minWidth=''}) => { } const save = (instanceName, qset, version = 1) => { + //cancel saving of the widget if title is too long to prevent crashing + let titleLength = instanceName.length; + if(titleLength>100) { + setAlertDialog({ + enabled: true, + title: 'Title too long', //the max length for title in my testing is 100 + message: 'Title must be less than 100 characters', + fatal: false, + enableLoginButton: false + }); + return; + } let newWidget = { widget_id: widgetId, name: instanceName, @@ -830,4 +842,4 @@ const WidgetCreator = ({instId, widgetId, minHeight='', minWidth=''}) => { } -export default WidgetCreator \ No newline at end of file +export default WidgetCreator From bc07c5c1a34fc7ff17bbb003b8eb8fd1aadcd7c6 Mon Sep 17 00:00:00 2001 From: Christopher Solanilla Date: Mon, 9 Sep 2024 08:21:45 -0400 Subject: [PATCH 2/2] converts spaces to tabs and returns false --- src/components/widget-creator.jsx | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/components/widget-creator.jsx b/src/components/widget-creator.jsx index 9183cdcdb..18b43c6d4 100644 --- a/src/components/widget-creator.jsx +++ b/src/components/widget-creator.jsx @@ -384,18 +384,17 @@ const WidgetCreator = ({instId, widgetId, minHeight='', minWidth=''}) => { } const save = (instanceName, qset, version = 1) => { - //cancel saving of the widget if title is too long to prevent crashing - let titleLength = instanceName.length; - if(titleLength>100) { - setAlertDialog({ - enabled: true, - title: 'Title too long', //the max length for title in my testing is 100 - message: 'Title must be less than 100 characters', - fatal: false, - enableLoginButton: false - }); - return; - } + //cancel saving of the widget if title is too long to prevent crashing + if(instanceName.length>100) { + setAlertDialog({ + enabled: true, + title: 'Title too long', //the max length for title in my testing is 100 + message: 'Title must be less than 100 characters', + fatal: false, + enableLoginButton: false + }); + return false; + } let newWidget = { widget_id: widgetId, name: instanceName,