Github user tbouron commented on a diff in the pull request: https://github.com/apache/brooklyn-ui/pull/94#discussion_r228905899 --- Diff: ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js --- @@ -230,16 +248,85 @@ function controller($scope, $element, $q, $uibModal, $log, $templateCache, palet }); $scope.items = items; }); - // this can be overridden for third-party filters. - // it receives result of filtering based on search so filters can adjust based on number of search resullts - $scope.filterPaletteItems = (items) => items; + $scope.lastUsedText = (item) => { + let l = (Number)(item.lastUsed); + if (!l || isNaN(l) || l<=0) return ""; + if (l < 100000) return 'Preselected for inclusion in "Recent" filter.'; + return 'Last used: ' + moment(l).fromNow(); + }; + $scope.showPaletteControls = false; + $scope.onFiltersShown = () => { + $timeout( () => { + // check do we need to show the multiline + let filters = angular.element($element[0].querySelector(".filters")); + $scope.$apply( () => $scope.filterSettings.filtersMultilineAvailable = filters[0].scrollHeight > filters[0].offsetHeight ); + + repaginate($scope, $element); + } ); + }; + $scope.togglePaletteControls = () => { + $scope.showPaletteControls = !$scope.showPaletteControls; + $timeout( () => repaginate($scope, $element) ); + } + $scope.toggleShowAllFilters = () => { + $scope.filterSettings.showAllFilters = !$scope.filterSettings.showAllFilters; + $timeout( () => repaginate($scope, $element) ); --- End diff -- Same as above
---