pdmangel / node-red-contrib-openhab2

Other
20 stars 14 forks source link

Does not work with proxy in between #18

Closed lsafelix75 closed 6 years ago

lsafelix75 commented 6 years ago

@pdmangel, the following $.getJSON(...) will fail if NodeRed is going through a proxy server. I suggest to change this to the following to avoid absolute path. Cheers

 $.getJSON("openhab2/items", config)

    ```

            **$.getJSON("/openhab2/items", config)**
              .done( function(data) {
                 itemSelectionEl.children().remove();
                 var items = data;
                 items.sort(function(a,b) {
                     if ( a.name < b.name )
                         return -1;
                     else if ( a.name > b.name )
                         return 1;
                     else
                         return 0;
                 });
                 if ( allowEmpty )
                     itemSelectionEl.append('<option value=""></option>');
                 items.forEach(function(item) {
                     itemSelectionEl.append('<option>' + item.name + '</option>');
                        var it = itemSelectionEl.find('option').last();
                        it.attr('value', item.name);
                        });
                 itemSelectionEl.val(itemName);
              })
pdmangel commented 6 years ago

I committed the change to github.