This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Cannot import widget.tar.gz
#1
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.
Done is better than perfect
Reply
#2
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

Attached Files
.gz   alarm_fire_alert2.tar.gz (Size: 1.17 KB / Downloads: 35)
------------------------------
Ctrl+F5
Reply
#3
Probably this is because of the folder, I will check this later. But please add some better http status or response?
Done is better than perfect
Reply
#4
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
Done is better than perfect
Reply
#5
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);
}
Done is better than perfect
Reply
#6
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.
------------------------------
Ctrl+F5
Reply
#7
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.
Done is better than perfect
Reply
#8
No difference only you can swap files via ftp, much easier to manage when you do a lot of versions/testing.
------------------------------
Ctrl+F5
Reply
#9
(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
Done is better than perfect
Reply


Forum Jump: