Emoncms 9.7.3 can't clone dashboard + toggle published problem

Hey,

I’m on latest dev and just did a pull on master as well as on dashboard module. There seems to be a problem with the list of dashboards. For one thing when i click on the random icon for cloning a dashboard nothing seems to happen except that it seems to “enable” the publish icon in that row but no dashboard seems to be cloned. Also clicking / toggling the publish icon has no effect. Once the dashboard is toggeld as published it won’t unpublish even though the icon changes the dashboard remains published and i have no way to undo this.

I have been trying to look in the code to see whats wrong but not much luck figuring it out.

Just posting to see if anyone else has this problem ?

I’m running a locally hosted emoncms

i figured it out, it’s a bug in the cloning system.

the name column in the dashboar table is varchar(30) so max 30 characters, in the dashboardclone function in dashboard_model.php. the name is taken from the current dashboard and " clone" is added BUT there is no verification if the name for the dashboard does not exceed 30 characters. So if your original dashboard name is 30,29,28,27,26 or 25 characters the cloning of the dashboard fails because the sql statement fails with following error #1406 - Data too long for column 'name' at row 1. the culprit is this line dashboard/dashboard_model.php at master · emoncms/dashboard · GitHub

my original dashboard name was “Smart plug6 Microgolf oven” which are 26 characters the cloned dashboard name would become “Smart plug6 Microgolf oven clone” which are 32 characters and is bigger than what the name column is in the database !

i’ll create an issue about this on github

workaround is to temperary rename the original dashboard to a name that has 24 or lower characters

1 Like

also found a way to fix the values of published and public not updating for my version. For some reason it tried to set empty values to those fields in the database when the values where false with me (like update … set `published`= ‘’) and i got sql error ‘’ is not a valid integer value).

In my local version i changed the code a bit so it became what i wrote in this issue but i’m still not sure if i was the only one with this problem somehow ?

guys all the issues (even the clone dashboard one) are all due to this
https://www.euperia.com/development/mysql-fix-field-doesnt-default-value/1509 which @nchaveiro pointed out.

If i disable strict mode (which is on by default on mysql 5.7) all the issues are resolved …

for windows users using the latest wamp version , you can disable strict mode by clicking on the wamp system tray icon then choose mysql → my sql settings → sql mode → none

it will write the value from the above url in your mysql my.ini config file then and restart all services, solving all these problems with default code

Well spotted!

@TrystanLea i changed the solution to using Non strict mode for mysql, if strict mode is enabled emoncms has a few other problems as well. In strict mode the sql code for the clonining of the dashboard fails because the cloned dashboards name is bigger then the fields name however in none strict mode mysql just removes the extra characters an happily executes the sql statement without a problem. So solution is actually to disable strict mode not just the temporary work around of renaming the dashboard as that would not solve the other problems …

These github issues i made all had the same solution → disabling strict mode:

and i’m pretty certain this one has probably the same cause