6 Replies Latest reply on Feb 18, 2016 4:24 AM by Mirko Swillus

    How to bind a tile to an instance?

    Mirko Swillus

      Hi Jivers,

       

      I'm trying to use the private / extended props feature in Tiles on Jive 8.0.2.1 OnPrem and I know the document Private Properties and Extended Properties for Jive Tiles, where the author states this feature is available on Jive 8c5. Now that I have the Getters and Setters on the jive.tile object, I was hoping that this is functioning. But whenever I use the setter or the getter on both the private and the extended API, I'm getting this error Object (using the call jive.tile.getPrivateProps( function(props) {}) ):

       

      {error: "No bound instance for storing private props"}

      So now for the questions:

      1. Can I use this feature in Jive 8.0.2.1 On Prem?
      2. If so, how do I manage to bind this Tile or the AddOn which contains the Tile to my instance?

       

      Here is my definition.js for that Tile:

       

      {
          "displayName": "mkos-view-tile",
          "name": "mkos-view-tile",
          "description": "mkos-view-tile",
          "style": "CUSTOM_VIEW",
          "displayWidth": "ALL",
          "dataProviderKey": "internal",
          "pageTypes": [
              "PLACE",
              "USER"
          ],
          "icons": {
              "16": "https://developer.jivesoftware.com/DeveloperAssets/images/icons/jivedev-xsmall.png",
              "48": "https://developer.jivesoftware.com/DeveloperAssets/images/icons/jivedev-small.png",
              "128": "https://developer.jivesoftware.com/DeveloperAssets/images/icons/jivedev-med.png"
          },
          "view": "/mkos-view-tile/view.html?features=os-2.5,core-v3,jq-1.6,tile,oauth,responsive"
      }
      

       

       

      Thanks in advance,

      Mirko

        • Re: How to bind a tile to an instance?
          danil

          Hi Mirko Swillus . I'll subscribe on this question, having the same problem.

           

          Will be waiting for Ryan Rutan help

            • Re: How to bind a tile to an instance?

              So did a quick look at the source code, and it looks like this error happens when you dont have a tileInstanceID. 

               

              Try outputting jive.tile.tileInstanceId to the console and see if it has a value greater than 0?  If it does, this should work.

               

              Some thoughts.  Are you using this on a Config screen?  If so, has the tile been "saved" yet?  If it hasn't been saved, you wont have a tileInstanceId.  So if this is the case.  Save the tile...and save the page.  Then go back in and edit and see if this changes?    If that is the case, I'll make a note with engineering to see if there is anyway we can clean up the flow of this config behavior, as I admit, this is the most likely place where privateProps will be set (on initial setup).

               

              I cant see a reason why this would happen on a custom view tile on render, as that would easily have a Tile Instance ID in place.

               

              Hope that helps, but definitely let us know what you're seeing.

                • Re: How to bind a tile to an instance?
                  danil

                  Hi Ryan Rutan thanks for feedback. You always saving us like a Superman

                   

                  I'll attach screenshots.

                   

                  Here's a console screen with logs for Tile View. So we have tileInstanceID here and even an empty props objects.

                   

                  Here's a config view were we get error. Same code but tileInstanceID is udefined. I understand that we don't have tileInstanceID on config screen before pressing Save button. Are this external\private properties working only for view? In my case I'm tring to use them cause I'm doing custom view tile only with client code, no DB. And I have to store big data object that is not acceptible through regular config data cause there's a limit of  about 8000 + characters. I don't know are there any limits to External Properties object though. Maybe you can also help me with some advice here. Sorry for small oftopic but It might be related and helfull for others.

                   

                   

                   

                   

                  Thanks

              • Re: How to bind a tile to an instance?
                danil

                Hi Mirko Swillus I found solution

                 

                Use this

                Jive JavaScript API v3.14 → osapi.jive.corev3.systemExtProps class

                 

                 

                 

                osapi.jive.corev3.systemExtProps
                          .create({test: 'some stuff here..'})   //you can put data here and add more fields like `test`
                                    .execute(function (resp) {
                                          console.log(resp)
                          });

                osapi.jive.corev3.systemExtProps.get({}).execute(function (resp) {
                          console.log(resp);
                }); 

                  • Re: How to bind a tile to an instance?
                    Mirko Swillus

                    Hej Danil (cc Ryan Rutan),

                     

                    thanks for your answer! Unfortunately I was quite busy the last days, but now I had the time to reproduce your solution.

                     

                    The create request works very well, got a 200 response from the service with the ExtProps object. But the get request is producing a 500er error with this message: An unexpected error has occurred.

                     

                    When looking into the sbs.log I see the following stack trace:

                    2016-02-18 13:05:55,055 [http-bio-8081-exec-2] [-1:admin:REGULAR] ERROR com.jivesoftware.api.core.jsonrpc.JiveRequestHandlerImpl - An error occured processing an API request: public javax.ws.rs.core.Response com.jivesoftware.api.core.v3.services.ExtPropsService.createSystemExtProps(java.lang.String,java.lang.String) throws com.jivesoftware.api.core.v3.exceptions.BadRequestException,com.jivesoftware.api.core.v3.exceptions.ConflictException,com.jivesoftware.api.core.v3.exceptions.ForbiddenException: [{"test":"some stuff here.."}, @all]

                    java.lang.reflect.InvocationTargetException

                      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

                      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

                      at java.lang.reflect.Method.invoke(Method.java:497)

                      at com.jivesoftware.api.core.jsonrpc.JiveRequestHandlerImpl.execute(JiveRequestHandlerImpl.java:283)

                      ...

                    Caused by: java.lang.IllegalArgumentException: Multiple Path annotations for 'getSystemExtProps' overloaded method

                      at com.jivesoftware.api.core.v3.util.UriStringBuilder.path(UriStringBuilder.java:126)

                      at com.jivesoftware.api.core.v3.providers.ServicePathProvider.servicePath(ServicePathProvider.java:66)

                      at com.jivesoftware.api.core.v3.providers.ServicePathProvider.servicePath(ServicePathProvider.java:43)

                      at com.jivesoftware.api.core.v3.providers.ServicePathProvider.servicePathURI(ServicePathProvider.java:49)

                      at com.jivesoftware.api.core.v3.services.ExtPropsService.createSystemExtProps(ExtPropsService.java:157)

                      at com.jivesoftware.api.core.v3.services.ExtPropsService.createSystemExtProps(ExtPropsService.java:123)

                      ... 188 more

                     

                    As I said, I'm on Jive 8.0.2.1 OnPrem. Do you really managed to get an ExtProps object using this call:


                    osapi.jive.corev3.systemExtProps.get({}).execute(function (resp) {
                              console.log(resp);
                    }); 

                     

                    Thanks again, that was very helpful already. Cheers,

                     

                    Mirko