@@ -9910,7 +9910,7 @@ angular.module('patternfly.navigation').component('pfApplicationLauncher', {
99109910 </li>
99119911 </ul>
99129912 </div>
9913- <span ng-if="notification.status" class="{{'pull-left ' + $ctrl.customScope.getNotficationStatusIconClass(notification)}}" ng-click="$ctrl.customScope.markRead(notification)"></span>
9913+ <span ng-if="notification.status" class="{{'pull-left ' + $ctrl.customScope.getNotficationStatusIconClass(notification)}}" ng-click="$ctrl.customScope.markRead(notification)"></span>
99149914 <div class="drawer-pf-notification-content" ng-click="$ctrl.customScope.markRead(notification)">
99159915 <span class="drawer-pf-notification-message" tooltip-append-to-body="true" tooltip-popup-delay="500" tooltip-placement="bottom" tooltip="{{notification.message}}">
99169916 {{notification.message}}
@@ -10417,6 +10417,12 @@ angular.module( 'patternfly.notification' ).component('pfInlineNotification', {
1041710417 });
1041810418 };
1041910419
10420+ var updateAccordionSizing = function () {
10421+ $timeout(function () {
10422+ angular.element($window).triggerHandler('resize');
10423+ }, 100);
10424+ };
10425+
1042010426 ctrl.toggleCollapse = function (selectedGroup) {
1042110427 if (selectedGroup.open) {
1042210428 selectedGroup.open = false;
@@ -10425,6 +10431,7 @@ angular.module( 'patternfly.notification' ).component('pfInlineNotification', {
1042510431 group.open = false;
1042610432 });
1042710433 selectedGroup.open = true;
10434+ updateAccordionSizing();
1042810435 }
1042910436 };
1043010437
@@ -10448,12 +10455,20 @@ angular.module( 'patternfly.notification' ).component('pfInlineNotification', {
1044810455 ctrl.$onChanges = function (changesObj) {
1044910456 if (changesObj.notificationGroups) {
1045010457 setupGroups();
10458+ updateAccordionSizing();
1045110459 }
1045210460
10453- if (changesObj.drawerHidden) {
10454- $timeout(function () {
10455- angular.element($window).triggerHandler('resize');
10456- }, 100);
10461+ if (!ctrl.drawerHidden &&
10462+ (changesObj.drawerHidden ||
10463+ changesObj.showMarkAllRead ||
10464+ changesObj.showClearAll ||
10465+ changesObj.actionButtonTitle ||
10466+ changesObj.titleInclude ||
10467+ changesObj.headingInclude ||
10468+ changesObj.subheadingInclude ||
10469+ changesObj.notificationBodyInclude ||
10470+ changesObj.notificationFooterInclude)) {
10471+ updateAccordionSizing();
1045710472 }
1045810473 };
1045910474
@@ -13870,13 +13885,20 @@ angular.module('patternfly.utils').directive('pfFixedAccordion', ["$window", "$t
1387013885 groupClass: '@'
1387113886 },
1387213887 link: function ($scope, $element, $attrs) {
13888+ var contentElementHeight = function (contentElement) {
13889+ var contentHeight = contentElement.offsetHeight;
13890+ contentHeight += parseInt(getComputedStyle(contentElement).marginTop);
13891+ contentHeight += parseInt(getComputedStyle(contentElement).marginBottom);
13892+
13893+ return contentHeight;
13894+ };
13895+
1387313896 var setBodyScrollHeight = function (parentElement, bodyHeight) {
1387413897 // Set the max-height for the fixed height components
1387513898 var collapsePanels = parentElement[0].querySelectorAll('.panel-collapse');
1387613899 var collapsePanel;
1387713900 var scrollElement;
1387813901 var panelContents;
13879- var nextContent;
1388013902 var innerHeight;
1388113903 var scroller;
1388213904
@@ -13887,24 +13909,21 @@ angular.module('patternfly.utils').directive('pfFixedAccordion', ["$window", "$t
1388713909
1388813910 if (angular.isDefined($scope.scrollSelector)) {
1388913911 scroller = angular.element(collapsePanel[0].querySelector($scope.scrollSelector));
13890- if (scroller.length === 1 ) {
13912+ if (scroller.length) {
1389113913 scrollElement = angular.element(scroller[0]);
13914+
1389213915 panelContents = collapsePanel.children();
1389313916 angular.forEach(panelContents, function (contentElement) {
13894- nextContent = angular.element(contentElement);
13895-
1389613917 // Get the height of all the non-scroll element contents
13897- if (nextContent[0] !== scrollElement[0]) {
13898- innerHeight += nextContent[0].offsetHeight;
13899- innerHeight += parseInt(getComputedStyle(nextContent[0]).marginTop);
13900- innerHeight += parseInt(getComputedStyle(nextContent[0]).marginBottom);
13918+ if (contentElement !== scrollElement[0]) {
13919+ innerHeight += contentElementHeight(contentElement);
1390113920 }
1390213921 });
1390313922 }
1390413923 }
1390513924
13906- // set the max- height
13907- angular.element(scrollElement).css('max-height', ( bodyHeight - innerHeight) + 'px');
13925+ // Make sure we have enough height to be able to scroll the contents if necessary
13926+ angular.element(scrollElement).css('max-height', Math.max(( bodyHeight - innerHeight), 25 ) + 'px');
1390813927 angular.element(scrollElement).css('overflow-y', 'auto');
1390913928 });
1391013929 };
@@ -13913,7 +13932,6 @@ angular.module('patternfly.utils').directive('pfFixedAccordion', ["$window", "$t
1391313932 var height, openPanel, contentHeight, bodyHeight, overflowY = 'hidden';
1391413933 var parentElement = angular.element($element[0].querySelector('.panel-group'));
1391513934 var headings = angular.element(parentElement).children();
13916- var headingElement;
1391713935
1391813936 height = parentElement[0].clientHeight;
1391913937
@@ -13927,10 +13945,7 @@ angular.module('patternfly.utils').directive('pfFixedAccordion', ["$window", "$t
1392713945 contentHeight = 0;
1392813946
1392913947 angular.forEach(headings, function (heading) {
13930- headingElement = angular.element(heading);
13931- contentHeight += headingElement.prop('offsetHeight');
13932- contentHeight += parseInt(getComputedStyle(headingElement[0]).marginTop);
13933- contentHeight += parseInt(getComputedStyle(headingElement[0]).marginBottom);
13948+ contentHeight += contentElementHeight(heading);
1393413949 });
1393513950
1393613951 // Determine the height remaining for opened collapse panels
@@ -13957,6 +13972,8 @@ angular.module('patternfly.utils').directive('pfFixedAccordion', ["$window", "$t
1395713972 });
1395813973 };
1395913974
13975+ var debounceResize = _.debounce(setCollapseHeights, 150, { maxWait: 250 });
13976+
1396013977 if ($scope.groupHeight) {
1396113978 angular.element($element[0].querySelector('.panel-group')).css('height', $scope.groupHeight);
1396213979 }
@@ -13970,10 +13987,11 @@ angular.module('patternfly.utils').directive('pfFixedAccordion', ["$window", "$t
1397013987
1397113988 // Update on window resizing
1397213989 $element.on('resize', function () {
13973- setCollapseHeights ();
13990+ debounceResize ();
1397413991 });
13992+
1397513993 angular.element($window).on('resize', function () {
13976- setCollapseHeights ();
13994+ debounceResize ();
1397713995 });
1397813996 }
1397913997 };
@@ -17452,7 +17470,7 @@ angular.module('patternfly.wizard').component('pfWizard', {
1745217470
1745317471
1745417472 $templateCache.put('notification/notification-drawer.html',
17455- "<div class=drawer-pf ng-class=\"{'hide': $ctrl.drawerHidden, 'drawer-pf-expanded': $ctrl.drawerExpanded}\"><div ng-if=$ctrl.drawerTitle class=drawer-pf-title><a ng-if=$ctrl.allowExpand class=\"drawer-pf-toggle-expand fa fa-angle-double-left\" ng-click=$ctrl.toggleExpandDrawer()></a> <a ng-if=$ctrl.onClose class=\"drawer-pf-close pficon pficon-close\" ng-click=$ctrl.onClose()></a><h3 class=text-center>{{$ctrl.drawerTitle}}</h3></div><div ng-if=$ctrl.titleInclude class=drawer-pf-title ng-include src=$ctrl.titleInclude></div><div ng-if=!$ctrl.notificationGroups class=apf-blank-notification-groups><pf-empty-state config=$ctrl.emptyStateConfig></pf-empty-state></div><div ng-if=$ctrl.notificationGroups pf-fixed-accordion scroll-selector=.panel-body><div class=panel-group><div class=\"panel panel-default\" ng-repeat=\"notificationGroup in $ctrl.notificationGroups track by $index\"><div class=panel-heading><h4 class=panel-title><a ng-if=!$ctrl.singleGroup ng-click=$ctrl.toggleCollapse(notificationGroup) ng-class=\"{collapsed: !notificationGroup.open}\" ng-include src=$ctrl.headingInclude></a> <span ng-if=$ctrl.singleGroup ng-include src=$ctrl.headingInclude></span></h4><span class=panel-counter ng-include src=$ctrl.subheadingInclude></span></div><div class=\"panel-collapse collapse\" ng-class=\"{in: notificationGroup.open || $ctrl.notificationGroups.length === 1}\"><div ng-if=$ctrl.hasNotifications(notificationGroup)><div class=panel-body><div class=drawer-pf-notification ng-class=\"{unread: notification.unread, 'expanded-notification': $ctrl.drawerExpanded}\" ng-repeat=\"notification in notificationGroup.notifications\" ng-include src=$ctrl.notificationBodyInclude></div><div ng-if=notificationGroup.isLoading class=\"drawer-pf-loading text-center\"><span class=\"spinner spinner-xs spinner-inline\"></span> Loading More</div></div><div class=drawer-pf-action><span class=drawer-pf-action-link ng-if=\"$ctrl.showMarkAllRead && $ctrl.hasUnread(notificationGroup)\"><button class=\"btn btn-link\" ng-click=$ctrl.onMarkAllRead(notificationGroup)>Mark All Read</button></span> <span class=drawer-pf-action-link><button class=\"btn btn-link\" ng-if=$ctrl.showClearAll ng-click=$ctrl.onClearAll(notificationGroup)><span class=\"pficon pficon-close\"></span> Clear All</button></span></div><div class=drawer-pf-action ng-if=$ctrl.actionButtonTitle><a class=\"btn btn-link btn-block\" ng-click=$ctrl.actionButtonCallback(notificationGroup)>{{$ctrl.actionButtonTitle}}</a></div></div><div ng-if=!$ctrl.hasNotifications(notificationGroup)><div class=panel-body><pf-empty-state config=notificationGroup.emptyStateConfig></pf-empty-state></div></div><div ng-if=$ctrl.notificationFooterInclude ng-include src=$ctrl.notificationFooterInclude></div></div></div></div></div></div>"
17473+ "<div class=drawer-pf ng-class=\"{'hide': $ctrl.drawerHidden, 'drawer-pf-expanded': $ctrl.drawerExpanded}\"><div ng-if=$ctrl.drawerTitle class=drawer-pf-title><a ng-if=$ctrl.allowExpand class=\"drawer-pf-toggle-expand fa fa-angle-double-left\" ng-click=$ctrl.toggleExpandDrawer()></a> <a ng-if=$ctrl.onClose class=\"drawer-pf-close pficon pficon-close\" ng-click=$ctrl.onClose()></a><h3 class=text-center>{{$ctrl.drawerTitle}}</h3></div><div ng-if=$ctrl.titleInclude class=drawer-pf-title ng-include src=$ctrl.titleInclude></div><div ng-if=!$ctrl.notificationGroups class=apf-blank-notification-groups><pf-empty-state config=$ctrl.emptyStateConfig></pf-empty-state></div><div ng-if=$ctrl.notificationGroups pf-fixed-accordion scroll-selector=.panel-body><div class=panel-group><div class=\"panel panel-default\" ng-repeat=\"notificationGroup in $ctrl.notificationGroups track by $index\"><div class=panel-heading><h4 class=panel-title><a ng-if=!$ctrl.singleGroup ng-click=$ctrl.toggleCollapse(notificationGroup) ng-class=\"{collapsed: !notificationGroup.open}\" ng-include src=$ctrl.headingInclude></a> <span ng-if=$ctrl.singleGroup ng-include src=$ctrl.headingInclude></span></h4><span class=panel-counter ng-include src=$ctrl.subheadingInclude></span></div><div class=\"panel-collapse collapse\" ng-class=\"{in: notificationGroup.open || $ctrl.notificationGroups.length === 1}\"><div ng-if=$ctrl.hasNotifications(notificationGroup) class=panel-body><div class=drawer-pf-notification ng-class=\"{unread: notification.unread, 'expanded-notification': $ctrl.drawerExpanded}\" ng-repeat=\"notification in notificationGroup.notifications\" ng-include src=$ctrl.notificationBodyInclude></div><div ng-if=notificationGroup.isLoading class=\"drawer-pf-loading text-center\"><span class=\"spinner spinner-xs spinner-inline\"></span> Loading More</div></div><div ng-if=\"($ctrl.showClearAll || $ctrl.showMarkAllRead) && $ctrl.hasNotifications(notificationGroup)\" class=drawer-pf-action><span class=drawer-pf-action-link ng-if=\"$ctrl.showMarkAllRead && $ctrl.hasUnread(notificationGroup)\"><button class=\"btn btn-link\" ng-click=$ctrl.onMarkAllRead(notificationGroup)>Mark All Read</button></span> <span class=drawer-pf-action-link><button class=\"btn btn-link\" ng-if=$ctrl.showClearAll ng-click=$ctrl.onClearAll(notificationGroup)><span class=\"pficon pficon-close\"></span> Clear All</button></span></div><div ng-if=\"$ctrl.actionButtonTitle && $ctrl.hasNotifications(notificationGroup)\" class=drawer-pf-action><a class=\"btn btn-link btn-block\" ng-click=$ctrl.actionButtonCallback(notificationGroup)>{{$ctrl.actionButtonTitle}}</a></div><div ng-if=!$ctrl.hasNotifications(notificationGroup)><div class=panel-body><pf-empty-state config=notificationGroup.emptyStateConfig></pf-empty-state></div></div><div ng-if=$ctrl.notificationFooterInclude ng-include src=$ctrl.notificationFooterInclude></div></div></div></div></div></div>"
1745617474 );
1745717475
1745817476
0 commit comments