You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2014/09/30 22:48:23 UTC
[17/35] git commit: AMBARI-7502. Views: view iframe height cutoff -
Fixes for Firefox, Safari (srimanth)
AMBARI-7502. Views: view iframe height cutoff - Fixes for Firefox, Safari (srimanth)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/cd5a4b96
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/cd5a4b96
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/cd5a4b96
Branch: refs/heads/branch-alerts-dev
Commit: cd5a4b96f0b0d6cc1758c13c3d191bd5ee4fd596
Parents: b7f3bc6
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Mon Sep 29 17:30:57 2014 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Mon Sep 29 17:32:45 2014 -0700
----------------------------------------------------------------------
ambari-web/app/views/main/views/details.js | 54 +++++++++++++++++++++++++
1 file changed, 54 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/cd5a4b96/ambari-web/app/views/main/views/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/views/details.js b/ambari-web/app/views/main/views/details.js
index 98184ef..92dd358 100644
--- a/ambari-web/app/views/main/views/details.js
+++ b/ambari-web/app/views/main/views/details.js
@@ -27,6 +27,60 @@ App.MainViewsDetailsView = Em.View.extend({
attributeBindings: ['src','seamless'],
seamless: "seamless",
+ interval: null,
+
+ /**
+ * Drop autoHeight timer
+ */
+ willDestroyElement: function() {
+ var interval = this.get('interval');
+ if (interval) {
+ clearInterval(interval);
+ }
+ },
+
+ /**
+ * Updates iframe height every 5s
+ */
+ didInsertElement : function() {
+ var interval, self = this;
+ interval = setInterval(function() {
+ self.resizeFunction();
+ }, 5000);
+ self.set('interval', interval);
+ this.resizeFunction();
+ },
+
+ resizeFunction : function() {
+ var body = $(document.body);
+ var footer = $("footer", body);
+ var header = $("#top-nav", body);
+ var iframe = $("iframe", body);
+
+ var bodyHeight = body.outerHeight();
+ var footerHeight = footer != null ? footer.outerHeight() : 0;
+ var headerHeight = header != null ? header.outerHeight() : 0;
+
+ var defaultHeight = bodyHeight - footerHeight - headerHeight;
+ console.debug("IFrame default Height = " + defaultHeight + " ("
+ + bodyHeight + " - " + headerHeight + " - " + footerHeight + ")");
+
+ if (iframe != null && iframe.length > 0) {
+ var childrenHeight = 0;
+ var iframeElement = iframe[0];
+ if (iframeElement.contentWindow != null
+ && iframeElement.contentWindow.document != null
+ && iframeElement.contentWindow.document.body != null) {
+ var iFrameContentBody = iframeElement.contentWindow.document.body;
+ childrenHeight = iFrameContentBody.scrollHeight;
+ console.debug("IFrame content Height = " + childrenHeight);
+ }
+ var iFrameHeight = Math.max(childrenHeight, defaultHeight);
+ console.debug("IFrame final height = ", iFrameHeight);
+ iframe.css('height', iFrameHeight);
+ }
+ },
+
src: function() {
return window.location.origin + this.get('controller.content.href');
}.property('controller.content')