Sisense.js with Angular 6

Comments

10 comments

  • Avatar
    Jed Achas

    This is a great example of sisense implementation for angular 6. I, however, encountered some problems. Say I have 5 other pages w/c contains each dashboard. Now, I navigate from dashboard1 to dashboard2. Upon loading dashboard 2, the widgets were successfully loaded (thought there's a lot of sisensejs errors) but the URL in the address bar suddenly changed to the previous page w/c is dashboard1 in this case. Would you be able to produce some example on having at least 3 pages for this example?

    Thanks.

  • Avatar
    Jed Achas

    After numerous debug it seems that whenever Sisense.connect(...) is called the url in the address bar resets the first loaded URL. That's why if you navigate to another page and calls again Sisense.connect() to get another dashboard it resets the URL. And I don't know why. Any Idea how to resolve this? Thanks

  • Avatar
    Takashi Binns

    Hi Jed,

    You are correct that Sisense.js was rewriting the URL.  I've updated the sample code in GitLab to correct for this, please check out  the fixRewrite() function in /src/app/sisense/widget.service.ts for the change.

    thanks!

  • Avatar
    Jim Wendt

    Hey Takashi,

    I'm unable to resolve takashi.sisense.com is there an alternative server setting in widget.service.ts file?

  • Avatar
    Jed Achas

    Thanks a million Takashi! it did help. I have another question. There are times that when adding sisense.js script, it's not loaded, resulting to failed rendering of dashboard and widgets. How do you handle this kind of stuff? 

    Thanks

  • Avatar
    Ashish Goyal

    Hi Team, 

    Did anyone face this issue?

    I commented the line where we call the fixRewrite( ) function, since rewriting of URL shouldnt prevent the dashboard from loading. But then I start getting this error:

    Any help/ pointers appreciated. Thanks in advance.

    Other details:
    Operating System is Windows Server 2012 R2
    Sisense version is: 7.4.4.10068
    Angular version: 6.0.3
    Typescript version: 2.9.2

  • Avatar
    Jed Achas (Edited )

    You need to make sure that sisensejs is loaded first before calling sisensejs methods, such as connect() etc... Make sure also that your Sisense definition is included in the project.

  • Avatar
    Ashish Goyal

    Hi @Jed, Thanks for the response.

    Sisense.js is getting loaded before the method calls.
    Also, except for the Sisense server URL, no other line of code was changed in Takashi's gitlab repo.

    I even put the Sisense.js locally and loaded that in index.html, still the errors dint change.

    And by 'Sisense definition' do you mean the Sisense namespace declaration?. Since I dint change the code in the repo, do we need to explicitly include this namespace in widget.service.ts file after cloning the code from Gitlab?

  • Avatar
    Jed Achas

    You can try using observables or Promise to check if the script is loaded or not. 

    For Sisense namespace the easiest way to do it is just by using window['Sisense'] instead.

    But I'd recommend using the definition, you need to make sure it's included. Coz based on the errors it's not seeing the Sisense definition. You can add the definition file via in tsconfig.json in files property like this:  "files": ["./sisensejs.d.ts"].
     
    That should help. 
  • Avatar
    Ashish Goyal

    Hi @Jed, After doing the changes in tsconfig.json, now it gives error in the IDE itself ('Cannot find Sisense' and 'Cannot find Dashboard') and nothing shows up in the browser, just a white screen.


Please sign in to leave a comment.