@@ -554,7 +554,15 @@ hawtioPluginLoader.addModule('openshiftCommonUI');
554
554
" <span class=\"{{notification.type | alertIcon}}\" aria-hidden=\"true\"></span>\n" +
555
555
" <span class=\"sr-only\">{{notification.type}}</span>\n" +
556
556
" <span class=\"toast-notification-message\" ng-if=\"notification.message\">{{notification.message}}</span>\n" +
557
- " <span ng-if=\"notification.details\">{{notification.details}}</span>\n" +
557
+ " <span ng-if=\"notification.details\">\n" +
558
+ " <truncate-long-text\n" +
559
+ " limit=\"200\"\n" +
560
+ " content=\"notification.details\"\n" +
561
+ " use-word-boundary=\"true\"\n" +
562
+ " expandable=\"true\"\n" +
563
+ " hide-collapse=\"true\">\n" +
564
+ " </truncate-long-text>\n" +
565
+ " </span>\n" +
558
566
" <span ng-repeat=\"link in notification.links\">\n" +
559
567
" <a ng-if=\"!link.href\" href=\"\" ng-click=\"onClick(notification, link)\" role=\"button\">{{link.label}}</a>\n" +
560
568
" <a ng-if=\"link.href\" ng-href=\"{{link.href}}\" ng-attr-target=\"{{link.target}}\">{{link.label}}</a>\n" +
@@ -582,11 +590,11 @@ hawtioPluginLoader.addModule('openshiftCommonUI');
582
590
" </span>\n" +
583
591
" <span ng-if=\"toggles.expanded\">\n" +
584
592
" <div ng-if=\"prettifyJson\" class=\"well\">\n" +
585
- " <span class=\"pull-right\" style=\"margin-top: -10px;\"><a href=\"\" ng-click=\"toggles.expanded = false\" class=\"truncation-collapse-link\">Collapse</a></span>\n" +
593
+ " <span ng-if=\"!hideCollapse\" class=\"pull-right\" style=\"margin-top: -10px;\"><a href=\"\" ng-click=\"toggles.expanded = false\" class=\"truncation-collapse-link\">Collapse</a></span>\n" +
586
594
" <span ng-bind-html=\"content | prettifyJSON | highlightKeywords : keywords\" class=\"pretty-json truncated-content\"></span>\n" +
587
595
" </div>\n" +
588
596
" <span ng-if=\"!prettifyJson\">\n" +
589
- " <span class=\"pull-right\"><a href=\"\" ng-click=\"toggles.expanded = false\" class=\"truncation-collapse-link\">Collapse</a></span>\n" +
597
+ " <span ng-if=\"!hideCollapse\" class=\"pull-right\"><a href=\"\" ng-click=\"toggles.expanded = false\" class=\"truncation-collapse-link\">Collapse</a></span>\n" +
590
598
" <span ng-bind-html=\"content | highlightKeywords : keywords\" class=\"truncated-content\"></span>\n" +
591
599
" </span>\n" +
592
600
" </span>\n" +
@@ -1103,6 +1111,8 @@ angular.module('openshiftCommonUI')
1103
1111
newlineLimit : '=' ,
1104
1112
useWordBoundary : '=' ,
1105
1113
expandable : '=' ,
1114
+ // When expandable is on, optionally hide the collapse link so text can only be expanded. (Used for toast notifications.)
1115
+ hideCollapse : '=' ,
1106
1116
keywords : '=highlightKeywords' , // optional keywords to highlight using the `highlightKeywords` filter
1107
1117
prettifyJson : '=' // prettifies JSON blobs when expanded, only used if expandable is true
1108
1118
} ,
@@ -4807,6 +4817,18 @@ angular.module('openshiftCommonUI').provider('NotificationsService', function()
4807
4817
notifications . push ( notification ) ;
4808
4818
} ;
4809
4819
4820
+ var hideNotification = function ( notificationID ) {
4821
+ if ( ! notificationID ) {
4822
+ return ;
4823
+ }
4824
+
4825
+ _ . each ( notifications , function ( notification ) {
4826
+ if ( notification . id === notificationID ) {
4827
+ notification . hidden = true ;
4828
+ }
4829
+ } ) ;
4830
+ } ;
4831
+
4810
4832
var getNotifications = function ( ) {
4811
4833
return notifications ;
4812
4834
} ;
@@ -4841,9 +4863,7 @@ angular.module('openshiftCommonUI').provider('NotificationsService', function()
4841
4863
} ;
4842
4864
4843
4865
var isAutoDismiss = function ( notification ) {
4844
- return _ . find ( autoDismissTypes , function ( type ) {
4845
- return type === notification . type ;
4846
- } ) ;
4866
+ return _ . includes ( autoDismissTypes , notification . type ) ;
4847
4867
} ;
4848
4868
4849
4869
// Also handle `addNotification` events on $rootScope, which is used by DataService.
@@ -4853,6 +4873,7 @@ angular.module('openshiftCommonUI').provider('NotificationsService', function()
4853
4873
4854
4874
return {
4855
4875
addNotification : addNotification ,
4876
+ hideNotification : hideNotification ,
4856
4877
getNotifications : getNotifications ,
4857
4878
clearNotifications : clearNotifications ,
4858
4879
isNotificationPermanentlyHidden : isNotificationPermanentlyHidden ,
0 commit comments