OSDir


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GitHub] brooklyn-ui pull request #94: Composer recent and filters


Github user tbouron commented on a diff in the pull request:

    https://github.com/apache/brooklyn-ui/pull/94#discussion_r228905790
  
    --- 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( () => {
    --- End diff --
    
    You can use `$scope.$applyAsync` instead, which is cleaner than a timeout
    ```suggestion
          $scope.$applyAsync( () => {
    ```


---