Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluate iframe Integration #18

Closed
p-a-s-c-a-l opened this issue Sep 10, 2018 · 5 comments
Closed

Evaluate iframe Integration #18

p-a-s-c-a-l opened this issue Sep 10, 2018 · 5 comments
Assignees
Labels
BB: UI Integration Platform UI Integration Platform Building Block enhancement New feature or request

Comments

@p-a-s-c-a-l
Copy link
Member

As alternative to #11 check if iframe integration would work better.

@p-a-s-c-a-l p-a-s-c-a-l added the enhancement New feature or request label Sep 10, 2018
@p-a-s-c-a-l p-a-s-c-a-l added this to the CSIS Bootstrapping milestone Sep 10, 2018
@p-a-s-c-a-l p-a-s-c-a-l added this to To do in T4.3 Scenario Management via automation Sep 10, 2018
@p-a-s-c-a-l
Copy link
Member Author

To be investigated:

  • iFrame: ui-level integration, e.g. for just embedding a CLARITY Building Block as separate iframe (as it is done here, for example)
  • seamless.js could be added to drupal's default html header to let CLARITY Building Block in iframes talk to each other via JavaScript

@p-a-s-c-a-l
Copy link
Member Author

See also clarity-h2020/csis-theme#2 (comment) for problems related to embedding seamless.js into the drupal theme.

@p-a-s-c-a-l
Copy link
Member Author

Integrate iFrame with:

<script type="text/javascript">
  window.onload = function() {
    window.seamless(document.getElementById('mcda'));
  };
</script>

<iframe id="mcda" src="/apps/scenario-analysis/target/dist/index.html"></iframe>

See also clarity-h2020/scenario-analysis#2

T4.3 Scenario Management automation moved this from To do to Done Oct 29, 2018
@p-a-s-c-a-l
Copy link
Member Author

p-a-s-c-a-l commented Nov 5, 2018

If JS Dependecies are available, the following code can be used:

<script type="text/javascript">
if (typeof $ == 'undefined') {
   var $ = jQuery;
}
if (typeof $ == 'undefined') {
   var $ = window.jQuery;
}
window.Drupal.behaviors.myBehavior = {
  attach: function (context, settings) {
    // Using once() to apply the mcdaIFrameBehavior effect when you want to run just one function.
    $(window, context).once('mcdaIFrameBehavior').each(function () {
		var mcdaApp = window.seamless(document.getElementById('mcda'));
                var currentNodeId = window.location.pathname.split("/").pop()
                mcdaApp .send({
                    nodeId: currentNodeId 
                });
    });
  }
};
</script>
<iframe id="mcda" src="/apps/scenario-analysis/app/index.html"></iframe>

@p-a-s-c-a-l
Copy link
Member Author

Full Example: nodeConnector.js.

@p-a-s-c-a-l p-a-s-c-a-l added the BB: UI Integration Platform UI Integration Platform Building Block label Jan 15, 2019
@p-a-s-c-a-l p-a-s-c-a-l added this to To do in T1.4 Industrialization and Support via automation Oct 28, 2019
@p-a-s-c-a-l p-a-s-c-a-l added this to Backlog: High Priority in T1.3 Climate Services Co-creation via automation Oct 28, 2019
@p-a-s-c-a-l p-a-s-c-a-l moved this from Backlog: High Priority to Done in T1.3 Climate Services Co-creation Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BB: UI Integration Platform UI Integration Platform Building Block enhancement New feature or request
Development

No branches or pull requests

2 participants