Freeboard / freeboard

A damn-sexy, open source real-time dashboard builder for IOT and other web mashups. A free open-source alternative to Geckoboard.
http://freeboard.io
MIT License
6.45k stars 1.2k forks source link

Cannot load dashboard.json file using "index.html#source=dashboard.json" #212

Open ghost opened 7 years ago

ghost commented 7 years ago

Dear developer community

i run lastest FreeDashboard of this github repo in local computer. i modify something (add some widgets). Then, i save "dashboard.json" into same forder with index.html and try to run "index.html#source=dashboard.json". Issue is that dashboard does not display as i modified. Do you meet same problem like me ?

Thank you

Pmoshbr commented 7 years ago

Hello I'm having the same problem... Somebody can help us???

fundef1 commented 7 years ago

it seems the freeboard project is in an odd state ... at least documentation wise. anyway, the documentation to load a saved .json is not entirely up-to-day and should also say: index.html?load=dashboard.json as a way of loading a dashboard. there's still a layout bug, you can find a fix in the issues. (or open/close the editing console :)

note: i came here because I had a similar dashboard-not-loading issue. In the end it was due to my server not correctly serving application/json headers. i fixed it by adding this: in freeboard.js

//fix for mosquitto not serving application/json header
//if it's not object we need to parse it first 
     if (data !== Object(data)) data = JSON.parse(data);
////
theFreeboardModel.loadDashboard(data);
RadianM commented 6 years ago

it seems the freeboard project is in an odd state ... at least documentation wise.

Too true. Sorry for digging out an old issue but this is all becoming much more relevant now bug labs tells me they're killing the free tier.

While ?load= does indeed load the dashboard, the dashboard page initially opens with the tools area at the bottom. Clicking on the tool icon then swaps the tool panel to the top where it becomes an up-arrow that finally hides the panel when selected. Does anyone know a trick for starting up with only the dashboard on view?

mbwmbw1337 commented 6 years ago

@RadianM did you ever get an answer to this? I may have to update the code myself...

mbwmbw1337 commented 6 years ago

@RadianM - Please see the bold edit below. Add the following line to /lib/js/freeboard/freeboard.js initialize : function(allowEdit, finishedCallback) function. Around line 469.

Add: theFreeboardModel.setEditing(false);

if(freeboardLocation != "")
            {
                $.ajax({
                    url    : freeboardLocation,
                    success: function(data)
                    {
                        theFreeboardModel.loadDashboard(data);
                        theFreeboardModel.setEditing(false);

                        if(_.isFunction(finishedCallback))
                        {
                            finishedCallback();
                        }
                    }
                });
            }
RadianM commented 6 years ago

Cool, worked like a charm!

mbwmbw1337 commented 6 years ago

Fantastic! Thank you for letting me know, glad someone else was able to use it :).