Hitachi Vantara Pentaho Community Forums
Results 1 to 13 of 13

Thread: Problem with embedding CDE dashboard into application

  1. #1

    Default Problem with embedding CDE dashboard into application

    Hi everyone!

    I have some trouble with embedding dashboard with API:

    http://localhost:8080/pentaho/plugin...ile=hello.wcdf

    My code:

    PHP Code:
    <?php$ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://localhost:8080/pentaho/plugin/pentaho-cdf-dd/api/renderer/getHeaders?solution=public&path=/plugin-samples/pentaho-cdf-dd/tests&file=testCCCv2-II.wcdf");
    curl_setopt($ch, CURLOPT_USERPWD, "admin:password");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    echo "<html><head>";
    echo "<script src='js/jquery-1.8.3.js' type='text/javascript'></script>";
    $result = curl_exec($ch);
    echo $result;
    echo "</head><body>";
    curl_setopt($ch, CURLOPT_URL, "http://localhost:8080/pentaho/plugin/pentaho-cdf-dd/api/renderer/getContent?solution=public&path=/plugin-samples/pentaho-cdf-dd/tests&file=testCCCv2-II.wcdf");
    $result = curl_exec($ch);
    echo $result;
    echo "</body>";
    curl_close($ch);?>
    It loading only text without any graphical elements - charts, backgrounds, pictures and etc. Chrome console show me:

    Code:
    Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/pentaho/plugin/pent...=1406623709131
    Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost/pentaho/plugin/pent...=1406623709131
    Uncaught SyntaxError: Unexpected token ILLEGAL localhost:8080/pentaho/api/repos/pentaho-cdf/js/cdf-blueprint-script-includes.js?v=02ad52cc9e2bdb9bbaff5b77c0b62458:2476
    Uncaught ReferenceError: BaseComponent is not defined localhost:8080/pentaho/api/repos/pentaho-cdf-dd/js/CDF.js?v=58dc642c5e8d7eb35465f897ab09a806:3
    Uncaught ReferenceError: Dashboards is not defined localhost/info2.php:468
    Uncaught ReferenceError: Dashboards is not defined localhost/info2.php:473
    


    There are "" symbols in the file cdf-blueprint-script-includes.js. If I connect correct js file with code line:

    PHP Code:
    echo "<script src='js/cdf-blueprint-script-includes.js' type='text/javascript'></script>"
    On loaded page still no images, charts and etc but now I see dashboard structure and in console we have:

    Code:
    GET http://localhost/pentaho/plugin/pent...=1406623709131 404 (Not Found) info2.php:10
    GET http://localhost/pentaho/plugin/pent...=1406623709131 404 (Not Found) info2.php:13
    Uncaught SyntaxError: Unexpected token ILLEGAL cdf-blueprint-script-includes.js:2476
    CDF: InitInstance 0 cdf-blueprint-script-includes.js:3610
    [Lifecycle >Start] Init[0] (Running: 1) cdf-blueprint-script-includes.js:3656
    [Lifecycle >Start] render_barChart [cccBarChart] (P: 5 ): preExecution Timing: 0ms since start, 0ms since last event (Running: 1) cdf-blueprint-script-includes.js:3619
    [Lifecycle >Start] render_lineChart [cccLineChart] (P: 5 ): preExecution Timing: 0ms since start, 0ms since last event (Running: 2) cdf-blueprint-script-includes.js:3619
    [Lifecycle >Start] render_pieChart [cccPieChart] (P: 5 ): preExecution Timing: 0ms since start, 0ms since last event (Running: 3) cdf-blueprint-script-includes.js:3619
    [Lifecycle <End  ] render_barChart [cccBarChart] (P: 5 ): postExecution Timing: 2.6s since start, 2.6s since last event (Running: 4) cdf-blueprint-script-includes.js:3619
    [Lifecycle <End  ] render_lineChart [cccLineChart] (P: 5 ): postExecution Timing: 2.6s since start, 2.6s since last event (Running: 3) cdf-blueprint-script-includes.js:3619
    [Lifecycle <End  ] render_pieChart [cccPieChart] (P: 5 ): postExecution Timing: 2.7s since start, 2.7s since last event (Running: 2) cdf-blueprint-script-includes.js:3619
    Uncaught TypeError: Cannot read property 'style' of null translator.js:106
    [Lifecycle <End  ] Init[0] (Running: 0) cdf-blueprint-script-includes.js:3666
    
    Trying this in Pentaho 5.0.1 stable and 5.1.snapshot with ctools plugins last stable and trunk versions. I attach two screenshots before and after adding blueprint js file.
    I will be grateful for any help!

    P.S. Sorry for my bad English :)
    Attached Images Attached Images   

  2. #2
    Join Date
    May 2014
    Posts
    15

    Default

    Have you tryed to put the dashboard inside a iframe?
    If your server needs authentication, you need somehow to bypass that! (turn it off on web.xml, just for testing purposes)

    Hope that helps

  3. #3
    Join Date
    Nov 2011
    Posts
    1,229

    Default

    Is your php page running in the same web server as the pentaho application ?
    If not, I think you need to use the root and absolute parameters in your getHeaders and getContent calls.
    Pedro Vale
    --
    CTools Product Development
    http://www.webdetails.pt

  4. #4

    Default

    Quote Originally Posted by farmerzen View Post
    Have you tryed to put the dashboard inside a iframe?
    If your server needs authentication, you need somehow to bypass that! (turn it off on web.xml, just for testing purposes)

    Hope that helps
    Hi!
    Thanks for reply!
    Yes, I tried, but I want a deeper integration than I can do with iframe.

  5. #5

    Default

    Quote Originally Posted by pamval View Post
    Is your php page running in the same web server as the pentaho application ?
    If not, I think you need to use the root and absolute parameters in your getHeaders and getContent calls.
    Hello, pamval.

    Yes, php page running in the same server (locally on my notebook: pentaho on tomcat with proxy to http://localhost/pentaho and web page on apache http://localhost/page.php).
    In addition, I have already solved my problems... But can you tell me more about how to use the root and absolute parameters?

    Thanks for reply!

  6. #6
    Join Date
    Nov 2011
    Posts
    1,229

    Default

    root and absolute allow you to specify absolute urls for your dashboard resources.

    In your scenario, calling getHeaders/getContent will return you scripts and css being included with <script src='/pentaho/<something>' />
    If you add absolute=true, your scripts and css will be included using the absolute URL <script src='http://localhost/pentaho/<something>' />

    If you use absolute=true and root=192.168.123.32:9090, the scripts and css will be included using the absolute URl from the given root: <script src='http://192.168.123.32:9090/pentaho/<something>' />
    Pedro Vale
    --
    CTools Product Development
    http://www.webdetails.pt

  7. #7

    Default

    That's great! Thank you!

  8. #8
    Join Date
    Feb 2007
    Posts
    230

    Default

    Hi

    This post seems most closer to my issue so I'll give it a try :-)

    I am trying to embed CDE dashboard in a way similar to Jarrence. The php page is stored on http://www.mysite.com:8081/myfolder/myphppage.php and pentaho is on the same server, with address http://www.mysite.com:8081/pentaho. I am getting 404 (Not found) error many times, for example http://www.mysite.com/myfolder/plugin/cda/api/doQuery and the source of error is cdf-bootstrap-script-includes.js. Obviously it is using the wrong url for doQuery call. I am using root (www.mysite.com:8081) and absolute (true) parameters in getHeaders and getContent, so the complete php is like:
    <?php
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "http://www.mysite.com:8081/pentaho/plugin/pentaho-cdf-dd/api/renderer/getHeaders?solution=public&path=/folder_path&file=file.wcdf&absolute=true&root=www.mysite.com:8081");
    curl_setopt($ch, CURLOPT_USERPWD, "guest:guest");
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    echo "<html><head>";
    $result = curl_exec($ch);
    echo $result;
    echo "</head><body>";
    curl_setopt($ch, CURLOPT_URL, "http://www.mysite.com:8081/pentaho/plugin/pentaho-cdf-dd/api/renderer/getContent?solution=public&path=/folder_path&file=file.wcdf&absolute=true&root=www.mysite.com:8081"");
    $result = curl_exec($ch);
    echo $result;
    echo "</body>";
    curl_close($ch);
    ?>

    I suppose I am doing something wrong but don't know what. I am using Pentaho 5.2 CE with latest CTools.

    Thanks for any help :-)

    regards, dejan

  9. #9
    Join Date
    Nov 2011
    Posts
    1,229

    Default

    yeah, there's one more step you need to take, which is to manipulate the CONTEXT_PATH variable.

    After <html><head> add a script tag where you set var CONTEXT_PATH = http://www.mysite.com:8081/pentaho.
    Pedro Vale
    --
    CTools Product Development
    http://www.webdetails.pt

  10. #10
    Join Date
    Oct 2010
    Posts
    21

    Default Embedded CDE in php application

    Hi,

    I am trying embebed a CDE Dashboard into php application and its not working fine enough, the graphics say: "No data found" this my code:

    Some one knows whats the problem with my code?

    PHP Code:
    <?php
    $ch 
    curl_init();
    curl_setopt($chCURLOPT_URL"http://localhost:8080/pentaho/plugin/pentaho-cdf-dd/api/renderer/getHeaders?userid=admin&password=password&root=localhost:8080&inferScheme=false&solution=public&path=/test&file=test.wcdf");
    //curl_setopt($ch, CURLOPT_USERPWD, "admin:password");
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
    echo 
    "<html><head>";
    ?>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript">
            var contextPath = "http://localhost:8080/pentaho";
    </script>
    <?php
    $result 
    curl_exec($ch);
    echo 
    $result;
    echo 
    "</head><body>";
    curl_setopt($chCURLOPT_URL"http://localhost:8080/pentaho/plugin/pentaho-cdf-dd/api/renderer/getContent?userid=admin&password=password&root=localhost:8080&inferScheme=false&solution=public&path=/test&file=test.wcdf");
    $result curl_exec($ch);
    echo 
    $result;
    echo 
    "</body>";
    curl_close($ch);
    ?>
    Sorry my english
    Thanks
    Regards

  11. #11
    Join Date
    Feb 2007
    Posts
    230

    Default

    I don't see where you have CONTEXT_PATH variable. You must have something like:

    <script language='javascript' type='text/javascript'>var CONTEXT_PATH = 'http://localhost:8080/pentaho'</script>

    regards, dejan

  12. #12

    Default

    I did it!

    Just append some more javascript variables,

    Code:
    <script type="text/javascript">
            var contextPath = "http://localhost:8080/pentaho";
            var FULL_QUALIFIED_URL = 'http://localhost:8080/pentaho/';
            var webAppPath = 'http://localhost:8080/pentaho';
    </script>
    and the php code exposed on this thread works fine
    I've get the solution from http://forums.pentaho.com/showthread...al-application
    Last edited by cmassalle; 07-31-2015 at 09:05 AM.

  13. #13
    Join Date
    Apr 2016
    Posts
    11

    Default

    Hello, I have the same errors. It will be really useful for the rest of us, if you can post how you had solved the errors.
    Uncaught SyntaxError: Unexpected token ILLEGAL
    jquery.sparkline.js:209 Uncaught ReferenceError: jQuery is not defined
    CDF.js?v=9628f72…:188 Uncaught ReferenceError: BaseComponent is not defined
    Noname2.html:841 Uncaught ReferenceError: Dashboards is not defined
    Noname2.html:854 Uncaught ReferenceError: Dashboards is not defined

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.