Logic Machine Forum
Cannot import widget.tar.gz - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: Cannot import widget.tar.gz (/showthread.php?tid=2849)



Cannot import widget.tar.gz - buuuudzik - 17.09.2020

I've tried import into Mosaic newly created widget, my first one, I wanna try how it works but unfortunately probably it doesn't work.

POST /apps/data/mosaic30/api/?a=cwidget&name=Elevator&key=buuuudzikelevator

ends with status 404 in Network tab and widget doesn't appear on Extension list.


RE: Cannot import widget.tar.gz - Daniel - 18.09.2020

Each widget must gave its own ID
Code:
$(function(){
    Widget['gamma_air'] = Widget.extend({
        config: {
            title: 'Air conditioner1',
The gamma_air is here the ID, it must be changed, there is second place below where you should change it too.  The ID must be used while adding widget as Key
When you will be zipping the widget, zip them without any folder.

Attached example working widget to import. The KEY is  alarm_fire_alert3


RE: Cannot import widget.tar.gz - buuuudzik - 18.09.2020

Probably this is because of the folder, I will check this later. But please add some better http status or response?


RE: Cannot import widget.tar.gz - buuuudzik - 19.09.2020

I've checked this and yes, the unnecessary folder was a problem. Now I have teoretically my widget is on Extension list but only until I not refresh Mosaic.

Another thing is that this is probably not finished version of widget, under development, so it can probably have some bugs but I don't know how to create dev environment of Mosaic widgets so I am testing importing it into Mosaic.

But widget after import is not visible in available widgets to add and there is no feedback why. Also Mosaic after import widget hasn't bottom bar, but in console there is no error.


I am using demo LM from your page:
http://4n.lv:7999/apps/data/mosaic30/admin/#

After click "Clear all" button all return to normal state and bottom bar is visible.

Please give some info:
- how dev environment could look,
- add some statuses on server and maybe better error handling with some logs


RE: Cannot import widget.tar.gz - buuuudzik - 20.09.2020

I've found that the problem was a lack of ";" after widget which was before my widget. A lot of widgets are created in IFFE and then all of them are concatenated so every widget should ends with ";".

I think also that every widget should be in:
Code:
try {
WIDGET CODE...;
} catch(err) {
console.log(err);
}



RE: Cannot import widget.tar.gz - Daniel - 21.09.2020

I will send you the app as file to PM. You can extract it and then upload to LM manually via ftp apps. You will be then able to manually swap files.


RE: Cannot import widget.tar.gz - buuuudzik - 21.09.2020

What is the difference between this app and current Mosaic?

I found the way how to replace same widget. I must remove it from Extensions, refresh whole app, and import it once again.


RE: Cannot import widget.tar.gz - Daniel - 21.09.2020

No difference only you can swap files via ftp, much easier to manage when you do a lot of versions/testing.


RE: Cannot import widget.tar.gz - buuuudzik - 21.09.2020

(21.09.2020, 09:01)Daniel. Wrote: No difference only you can swap files via ftp, much easier to manage when you do a lot of versions/testing.

I will check in home but probably I dont have access to app files which is installed by shop