12 Replies Latest reply on Sep 29, 2014 7:03 AM by dbgilbert

    Jive SDK creating a new tile

    dbgilbert

      I've been messing around with the Jive SDK, modifying the list and stockprice examples successfully. But when I attempt to make a new tile I get nowhere; it lets me generate the add-on upload .zip and runs app.js, and I've added the tile to a place, but all calls to findByDefinitionName to get instances of the tile return nothing. I created the tile by auto-generating the list example and changing every instance of sampletile-list to my tile's name, and every grep and manual examination checks out so I'm pretty sure it's not a typo. I've tried returning instances in tiles/template.json to the original sampletile-list in case that was supposed to remain unchanged, but still got nothing. All I can find documentation-wise is examples using the auto-generated tiles; there seems to be nothing about making a tile from scratch or mutating the auto-generated tiles into entirely new tiles.

       

      Am I missing some step for creating my own tiles? Is there a list somewhere of the different places I would need to modify to change the list tile to my own tile? Is there an alternative to using findByDefinitionName, or does lack of instances being returned point towards a particular mistake in my conversion?

        • Re: Jive SDK creating a new tile
          aron.racho

          You could try generating the tile this way, with the --name parameter

           

          jive-sdk create list --name="mytilename"

           

          The tool should generate a service with your name correctly in all the pertinent places.

          1 person found this helpful
            • Re: Jive SDK creating a new tile
              dbgilbert

              Now I feel silly, not knowing something simple like that. I'll give it a try.

                • Re: Jive SDK creating a new tile
                  dbgilbert

                  I made a new tile using jive-sdk create list --name="mytilename" and it seemed to produce the same thing I had done manually, barring some default descriptions and such. Unfortunately the problem persists, which leads me to believe there is some other problem. I also checked out replacing findByDefinitionName with findAll, just for completeness sake in testing; doing so in the list tile sample works, and doing so in my own tile fails the same as when searching by name. I now suspect the problem is something other than a mismatched name.

                   

                  I've noticed that, in the add-ons screen, I've got an alert for this add-on: "An error occurred sending instance registration to client 'http://<myNitrousBox>/jive/oauth/register' (status=502 Bad Gateway)". If I attempt to reconnect, I get the success message, but the alert remains and nothing changes.

                   

                  Bizarrely, the list-tile sample's add-on has the same exact error, but it appears to be fully functional (the stock-price sample does not have this alert). I'm completely baffled as to what's not working with the tile I made.

              • Re: Jive SDK creating a new tile
                dbgilbert

                Still no luck after using jive-sdk create list --name="myTileName"

                 

                I also tried replacing the services.js file in my list example to make sure I wasn't somehow breaking things with something in there: the tile worked as desired. So now I'm wondering what could possibly be causing the non-example to not work; they're essentially identical! It can't even be some problem with sharing clientURL's or add-on names, because the list sample co-exists quite happily with the stockprice sample.

                  • Re: Jive SDK creating a new tile
                    aron.racho

                    I'll try this to make sure something did not regress, let me get back to you.

                      • Re: Jive SDK creating a new tile
                        dbgilbert

                        In case it helps, I ran diff on everything except the contents of node_modules; there's definitely no difference in substance between the working and broken versions, so either something in node_modules has changed, or the problem lies somewhere in the add-on upload side of things.

                         

                        I'm testing the tiles in the same place, and the two add-ons both give the same error 502 bad gateway regarding registration (while the stockprice one does not); if it weren't for the fact that the sample list appears to work quite happily despite that alert I'd have assumed that was the culprit, and I am still confused as to how the sampletile-list continues to work (even if the tile is removed and re-added to a place) despite claiming that registration is failing.

                          • Re: Jive SDK creating a new tile
                            aron.racho

                            Ok i just tried this for myself.

                             

                            In my nitrous.io VM:

                             

                            1. First I created an addon with a tile called aronlist

                            jive-sdk create list --name=aronlist                                                                                                                                                                                                         

                             

                            2. Then I setup my jiveclientconfiguration like so:

                            {

                                "clientUrl": "http://mighty-missile-20-135980.usw1-2.nitrousbox.com",

                                "port": "8080",

                                "development" : true

                            }

                            Note the development parameter, which is now default for all generated addons. Did you have this parameter set in your examples?

                             

                            3. I started up the service, and downloaded the extension.zip that was generated.

                             

                            4. I uploaded the extension to sandbox.jiveon.com and create a social group.

                             

                            5. My tile appeared and I was able to configure it, and observe that datapushes were happening successfully from my nitrous service to the tile.

                             

                            I'll try the same with the stockprice one just in case that example is somehow broken.

                              • Re: Jive SDK creating a new tile
                                dbgilbert

                                On 2, I have port 8090 instead of 8080, and development is missing. But that is the case for both the working samplelist-tile and stockprice tiles I tested, and for the non-working named list tile I made...

                                 

                                I'm also not using the sandbox but instead a hidden group on our Jive instance.

                                 

                                I'll try this from scratch again using the jiveclientconfiguration values you have.

                                • Re: Jive SDK creating a new tile
                                  dbgilbert

                                  Tried again with port 8080 and development set to true, and all appears well this time. Thanks for your help!

                                  • Re: Jive SDK creating a new tile
                                    dbgilbert

                                    Now that I've got the tile running my custom code, I've noticed that the configuration page is still the sampletile-list config (asking for the number to start the counter). This is even after replacing the config page's html and javascript, uninstalling and re-installing the add-on with the new extension.zip, and restarting the node server. Is this some caching problem that will go away in a few hours, or am I missing something that's pointing the config iFrame to the wrong place?

                                     

                                    I'm also having trouble getting the server to react to the tile being added. I only want to run an API call to Brightidea once an hour and when the tile is added (so that it is initially populated), but right now it doesn't appear to run the processTileInstance function when a new instance is registered.

                                     

                                    edit: to clarify, the configuration is only incorrect during the initial config appearance when you're adding the tile. It's correct when you try to configure the tile later. Is the initial config html found somewhere different than the normal config?

                                      • Re: Jive SDK creating a new tile
                                        dbgilbert

                                        After waiting a bit and trying again (deleted tile instance, create a new one) these two problems vanished; the new tile creation showed the proper config screen and updated upon creation. I'm going to assume Jive was just a bit slower to update stuff than I'd expected.

                              • Re: Jive SDK creating a new tile
                                aron.racho

                                Stock price example seems to work as well (i created it via jive-sdk create example-stockprice --name=aron-stockprice)

                                 

                                Screen Shot 2014-09-26 at 2.15.46 PM.png