Skip to content

Commit

Permalink
PR to help support the use of iframes to display dashboard and widget…
Browse files Browse the repository at this point in the history
…s in The Source (#126)

* update to mojo dashboard & belt widget to take username as param for The Source mogration

* update to mojo dashboard & belt widget to take username as param for The Source mogration

* removed commented line
  • Loading branch information
matallen authored Oct 19, 2020
1 parent 664f61f commit b457b56
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 deletions.
19 changes: 19 additions & 0 deletions src/main/webapp/mojo-dashboard-card-iframe.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<div>
<script src="https://code.jquery.com/jquery-3.5.1.min.js" type="text/javascript" unsafe.integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" unsafe.crossorigin="anonymous">
</script>

<p>
<iframe id="frame" src="https://community-ninja-board-ninja-board.int.open.paas.redhat.com/community-ninja-board/mojo/mojo-dashboard-card.jsp" style="width: 100%; height:500px;" border="0"></iframe>
</p>
<script type="text/javascript">
/*<![CDATA[*/
$(document).ready(function()
{
$("#frame").prop("src", $("#frame").prop("src")+"?username=" + Igloo.currentUser.namespace);
});
/*]]>*/
</script>
</div>
24 changes: 15 additions & 9 deletions src/main/webapp/mojo/mojo-miniBeltWidget.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ a:hover, a:active{
</center>

<script>
window.frameElement.style.height="247px"; // default window height
var ctx = "https://ninja-graphs-ninja-graphs.6923.rh-us-east-1.openshiftapps.com/ninja-graphs";
Expand Down Expand Up @@ -54,15 +53,22 @@ a:hover, a:active{
setTimeout(function(){ resizeParent(); }, 500);
}
}
Utils = {
getParameterByName: function(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return undefined;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
}
function getUsername(){
return Utils.getParameterByName("username");
}
function getUsername(){
var username;
if (undefined!=window.parent._jive_current_user)
username=window.parent._jive_current_user.username;
if (undefined!=window._jive_current_user)
username=window._jive_current_user.username;
return username;
}
function resizeParent() {
//var e=window.parent.document.getElementsByClassName("htmlWidgetIframe");
Expand Down

0 comments on commit b457b56

Please sign in to comment.