You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by tb...@apache.org on 2018/11/06 15:21:13 UTC

[1/9] brooklyn-ui git commit: quick info pane is toggle-able, and has buttons to add

Repository: brooklyn-ui
Updated Branches:
  refs/heads/master 65d374087 -> bf3477bfd


quick info pane is toggle-able, and has buttons to add


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/bad66765
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/bad66765
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/bad66765

Branch: refs/heads/master
Commit: bad6676562e58ad9adf9a3b9fb893b5fc4763852
Parents: 4d42539
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Wed Oct 31 16:37:10 2018 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Thu Nov 1 12:15:22 2018 +0000

----------------------------------------------------------------------
 .../catalog-selector.directive.js               | 32 +++++++++++++-
 .../catalog-selector/catalog-selector.less      | 32 ++++++++++++++
 .../catalog-selector.template.html              | 46 ++++++++++++++------
 3 files changed, 95 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/bad66765/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
index fea5312..654526a 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
+++ b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
@@ -49,6 +49,7 @@ export function catalogSelectorDirective() {
         scope: {
             family: '<',
             onSelect: '&',
+            onSelectText: "@?",
             rowsPerPage: '<?',  // if unset then fill
             reservedKeys: '<?',
             state: '<?',
@@ -238,7 +239,32 @@ function controller($scope, $element, $timeout, $q, $uibModal, $log, $templateCa
             $log.warn("Could not mark item as used: "+item, e);
         }
     }
-    $scope.onSelectItem = function (item) {
+    $scope.mouseInfoPopover = (item, enter) => {
+        if ($scope.popoverModal && $scope.popover==item) {
+            // ignore if modal
+            return;
+        }
+        $scope.popoverModal = false;
+        if (enter) {
+            $scope.popover = item;
+        } else {
+            $scope.popover = null;
+        }
+    }
+    $scope.onClickItem = (item, $event) => {
+        if ($scope.popoverModal && $scope.popover == item) {
+            $scope.closePopover();
+        } else {
+            $scope.popover = item;
+            $scope.popoverModal = true;
+        }
+        $event.stopPropagation();
+    }
+    $scope.closePopover = () => {
+        $scope.popover = null;
+        $scope.popoverModal = false;
+    }
+    $scope.onSelectItemToAdd = function (item) {
         if (angular.isFunction($scope.onSelect)) {
             tryMarkUsed(item);
             $scope.onSelect({item: item});
@@ -268,6 +294,9 @@ function controller($scope, $element, $timeout, $q, $uibModal, $log, $templateCa
         tryMarkUsed(item);
     };
     
+    $scope.getOpenCatalogLink = (item) => {
+        return "/brooklyn-ui-catalog/#!/bundles/"+item.containingBundle.replace(":","/")+"/types/"+item.symbolicName+"/"+item.version;
+    }
     $scope.sortBy = function (order) {
         let newFirst = {};
         if (order) {
@@ -322,6 +351,7 @@ function controller($scope, $element, $timeout, $q, $uibModal, $log, $templateCa
         $scope.items = items;
     });
     $scope.lastUsedText = (item) => {
+        if (item==null) return "";
         let l = (Number)(item.lastUsed);
         if (!l || isNaN(l) || l<=0) return "";
         if (l < 100000) return 'Preselected for inclusion in "Recent" filter.';

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/bad66765/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.less
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.less b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.less
index d22ef1f..2f8f174 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.less
+++ b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.less
@@ -264,6 +264,9 @@ catalog-selector {
       .label {
         line-height: 2.2;
       }
+      .closer .br-icon-close-bar {
+        stroke: @brand-primary;
+      }
     }
     .deprecated-marker {
       float: right;
@@ -280,6 +283,35 @@ catalog-selector {
     .palette-item-tag {
         margin-right: 4px;
     }
+    .quick-info-title {
+        background-color: @gray-lightest;
+        border-bottom: 1px solid @popover-border-color;
+        margin-left: -15px;
+        margin-right: -15px;
+        margin-top: -3px;
+        margin-bottom: 12px;
+        padding: 0px 16px 6px 16px;
+    }
+    .closer {
+        width: 10px;
+        > svg { width: 10px; } 
+        cursor: pointer;
+        margin-left: 6px;
+    }
+    .quick-info-buttons {
+        border-top: 1px solid @popover-border-color;
+        margin-top: 10px;
+        padding-top: 10px;
+        display: flex;
+        div.spacer {
+            flex: 1 1 auto;
+        }
+        button {
+            padding: 6px 9px;
+            line-height: 1;
+            margin-left: 12px;
+        }
+    }
   }
 
   p:last-child {

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/bad66765/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html
index bd996e9..269e139 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html
+++ b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html
@@ -101,7 +101,7 @@
                  this could be configurable ("compressed"=xs-2 w no labels, "normal"=xs-3, "big"=xs-4) -->
             <div class="catalog-palette-item" ng-class="state.viewMode.classes"
                     ng-repeat="item in searchedItems = (items | catalogSelectorSearch:search | catalogSelectorFilters:this) | orderBy:state.currentOrderFields | limitTo:pagination.itemsPerPage:(pagination.page-1)*pagination.itemsPerPage track by (item.containingBundle + ':' + item.symbolicName + ':' + item.version)"
-                    ng-click="onSelectItem(item)">
+                    ng-click="onClickItem(item, $event)">
                 <div class="item" draggable="true" ng-dragstart="onDragItem(item, $event)" ng-dragend="onDragEnd(item, $event)">
                     <div class="item-logo">
                         <img ng-src="{{item | iconGeneratorPipe:'symbolicName'}}" alt="{{item.displayName}} logo" on-error="onImageError" item-id="{{item.symbolicName}}"/>
@@ -111,16 +111,17 @@
                     </div>
                     <i class="fa fa-info-circle"
                         uib-popover-template="'QuickInfoTemplate.html'"
-                        popover-title="{{item | entityName}}"
-                        popover-placement="right-top" popover-trigger="'mouseenter'"
+                        popover-is-open="popover == item"
+                        popover-placement="right" popover-trigger="'none'"
                         popover-class="catalog-selector-popover" popover-append-to-body="true"
-                        ng-click="$event.stopPropagation()"></i>
+                        ng-mouseenter="mouseInfoPopover(item, true)"
+                        ng-mouseleave="mouseInfoPopover(item, false)"></i>
                 </div>
             </div>
 
             <div class="catalog-palette-item"
                     ng-class="state.viewMode.classes" 
-                    ng-if="searchedItems.length === 0 && search && allowFreeForm()" ng-click="onSelectItem(freeFormTile)">
+                    ng-if="searchedItems.length === 0 && search && allowFreeForm()" ng-click="onClickItem(freeFormTile, $event)">
                 <div class="item" draggable="true" ng-dragstart="onDragItem(freeFormTile, $event)" ng-dragend="onDragEnd(freeFormTile, $event)">
                     <div class="item-logo">
                         <img ng-src="{{freeFormTile | iconGeneratorPipe:'symbolicName'}}" alt="{{freeFormTile.displayName}} logo" on-error="onImageError" item-id="{{freeFormTile.symbolicName}}"/>
@@ -128,6 +129,13 @@
                     <div class="item-content" ng-hide="state.viewMode.hideName">
                         <h3>{{freeFormTile | entityName}}</h3>
                     </div>
+                    <i class="fa fa-info-circle"
+                        uib-popover-template="'QuickInfoTemplate.html'"
+                        popover-is-open="popover == freeFormTile"
+                        popover-placement="right-top" popover-trigger="'none'"
+                        popover-class="catalog-selector-popover" popover-append-to-body="true"
+                        ng-mouseenter="mouseInfoPopover(freeFormTile, true)"
+                        ng-mouseleave="mouseInfoPopover(freeFormTile, false)"></i>
                 </div>
                 <div class="text-danger" ng-if="isReserved()">
                     Cannot add <code>{{freeFormTile.symbolicName}}</code> because it is reserved.
@@ -145,19 +153,29 @@
 <!-- QUICK INFO TEMPLATE :: START-->
 <script type="text/ng-template" id="QuickInfoTemplate.html">
     <div class="palette-item-quick-info">
-        <div class="deprecated-marker" ng-if="item.deprecated">DEPRECATED</div>
+        <div class="quick-info-title">{{ popover | entityName }}
+            <br-svg type="close" class="pull-right closer" ng-click="closePopover()"></br-svg>
+        </div>
+        <div class="deprecated-marker" ng-if="popover.deprecated">DEPRECATED</div>
         <div class="quick-info-metadata">
-            <p><i class="mini-icon fa fa-fw fa-bookmark"></i> <samp class="type-symbolic-name">{{item.symbolicName}}</samp></p>
-            <p ng-if="item.version"><i class="mini-icon fa fa-fw fa-code-fork"></i> {{item.version}}</p>
+            <p><i class="mini-icon fa fa-fw fa-bookmark"></i> <samp class="type-symbolic-name">{{popover.symbolicName}}</samp></p>
+            <p ng-if="popover.version"><i class="mini-icon fa fa-fw fa-code-fork"></i> {{popover.version}}</p>
         </div>
-        <p class="quick-info-description" ng-if="item.description">{{item.description}}</p>
+        <p class="quick-info-description" ng-if="popover.description">{{popover.description}}</p>
         <div class="quick-info-metadata bundle">
-            <p ng-if="lastUsedText(item)"><i class="mini-icon fa fa-clock-o"></i> {{ lastUsedText(item) }}</p>
-            <p ng-if="item.displayTags && item.displayTags.length"><i class="mini-icon fa fa-fw fa-tags"></i> 
-                <span ng-repeat-start="tag in item.displayTags" class="label label-primary palette-item-tag">{{ tag }}</span>
+            <p ng-if="lastUsedText(popover)"><i class="mini-icon fa fa-clock-o"></i> {{ lastUsedText(popover) }}
+              <br-svg type="close" class="closer" ng-click="popover.lastUsed = 0"></br-svg>
+            </p>
+            <p ng-if="popover.displayTags && popover.displayTags.length"><i class="mini-icon fa fa-fw fa-tags"></i> 
+                <span ng-repeat-start="tag in popover.displayTags" class="label label-primary palette-item-tag">{{ tag }}</span>
                 <span ng-repeat-end> </span> </p>
-            <p><i class="mini-icon fa fa-fw fa-file-zip-o"></i> {{item.containingBundle}}</p>
-            <p ng-if="item.relevance"><i class="mini-icon fa fa-sort-numeric-asc"></i> Relevance score: {{ roundTwoDecimals(item.relevance) }}</p>
+            <p><i class="mini-icon fa fa-fw fa-file-zip-o"></i> {{popover.containingBundle}}</p>
+            <p ng-if="popover.relevance"><i class="mini-icon fa fa-sort-numeric-asc"></i> Relevance score: {{ roundTwoDecimals(popover.relevance) }}</p>
+        </div>
+        <div class="quick-info-buttons">
+            <div class="spacer"></div>
+            <button class="btn btn-primary btn-outline" ng-click="onSelectItemToAdd(popover)">{{ onSelectText || "Select" }}</button>
+            <a ng-if="popover.containingBundle" href="{{ getOpenCatalogLink(popover) }}" target="_blank"><button class="btn btn-info btn-outline">Open in catalog</button></a>
         </div>
     </div>
 </script>


[9/9] brooklyn-ui git commit: This closes #96

Posted by tb...@apache.org.
This closes #96


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/bf3477bf
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/bf3477bf
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/bf3477bf

Branch: refs/heads/master
Commit: bf3477bfd140489ed5db11c0d5be82b68d41d654
Parents: 65d3740 1da5338
Author: Thomas Bouron <th...@cloudsoftcorp.com>
Authored: Tue Nov 6 15:20:58 2018 +0000
Committer: Thomas Bouron <th...@cloudsoftcorp.com>
Committed: Tue Nov 6 15:20:58 2018 +0000

----------------------------------------------------------------------
 .../catalog-selector.directive.js               | 122 +++++++++++++++----
 .../catalog-selector/catalog-selector.less      |  41 +++++++
 .../catalog-selector.template.html              |  51 +++++---
 .../components/designer/designer.directive.js   |   6 +
 .../app/components/filters/entity.filter.js     |   8 +-
 .../spec-editor/spec-editor.directive.js        |   8 +-
 .../spec-editor/spec-editor.template.html       |  26 +++-
 .../app/views/main/graphical/edit/add/add.html  |   2 +-
 .../app/views/main/graphical/edit/add/add.js    |  11 ++
 .../views/main/graphical/graphical.state.html   |   4 +-
 .../app/views/main/graphical/graphical.state.js |  28 +++--
 11 files changed, 243 insertions(+), 64 deletions(-)
----------------------------------------------------------------------



[8/9] brooklyn-ui git commit: fix popover title and flicker, minor other code tidies following PR

Posted by tb...@apache.org.
fix popover title and flicker, minor other code tidies following PR

also add message for freeform tile


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/1da5338f
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/1da5338f
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/1da5338f

Branch: refs/heads/master
Commit: 1da5338f77559ea9d9712c106afd2c8723f6acf2
Parents: 08bd8dd
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Fri Nov 2 14:27:05 2018 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Fri Nov 2 14:27:05 2018 +0000

----------------------------------------------------------------------
 .../catalog-selector/catalog-selector.directive.js       | 11 ++++++-----
 .../components/catalog-selector/catalog-selector.less    |  5 +++--
 .../catalog-selector/catalog-selector.template.html      |  9 +++++----
 .../app/components/spec-editor/spec-editor.directive.js  |  2 +-
 4 files changed, 15 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/1da5338f/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
index 4ff04b8..b8b3bc6 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
+++ b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
@@ -241,30 +241,32 @@ function controller($scope, $element, $timeout, $q, $uibModal, $log, $templateCa
         }
     }
     $scope.mouseInfoPopover = (item, enter) => {
-        if ($scope.popoverModal && $scope.popover==item) {
+        if ($scope.popoverModal && $scope.popoverVisible && $scope.popover==item) {
             // ignore if modal
             return;
         }
         $scope.popoverModal = false;
         if (enter) {
             $scope.popover = item;
+            $scope.popoverVisible = true;
         } else {
-            $scope.popover = null;
+            $scope.popoverVisible = false;
         }
     }
     $scope.onClickItem = (item, isInfoIcon, $event) => {
         if (!isInfoIcon && $scope.iconSelects) {
             $scope.onSelectItem(item);
-        } else if ($scope.popoverModal && $scope.popover == item) {
+        } else if ($scope.popoverModal && $scope.popoverVisible && $scope.popover == item) {
             $scope.closePopover();
         } else {
             $scope.popover = item;
+            $scope.popoverVisible = true;
             $scope.popoverModal = true;
         }
         $event.stopPropagation();
     }
     $scope.closePopover = () => {
-        $scope.popover = null;
+        $scope.popoverVisible = false;
         $scope.popoverModal = false;
     }
     $scope.getOnSelectText = function (item) {
@@ -365,7 +367,6 @@ function controller($scope, $element, $timeout, $q, $uibModal, $log, $templateCa
         if (l < 100000) return 'Preselected for inclusion in "Recent" filter.';
         return 'Last used: ' + distanceInWordsToNow(l, { includeSeconds: true, addSuffix: true });
     }; 
-    $scope.roundTwoDecimals = (num) => Math.round(num*100)/100.0;
     
     $scope.showPaletteControls = false;
     $scope.onFiltersShown = () => {

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/1da5338f/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.less
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.less b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.less
index 05f5da2..c7aae95 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.less
+++ b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.less
@@ -288,9 +288,10 @@ catalog-selector {
         border-bottom: 1px solid @popover-border-color;
         margin-left: -15px;
         margin-right: -15px;
-        margin-top: -3px;
+        margin-top: -10px;
         margin-bottom: 12px;
-        padding: 0px 16px 6px 16px;
+        padding: 8px 16px 6px 16px;
+        border-radius: 5px 5px 0 0;
         .closer {
             margin-top: 6px;
         }

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/1da5338f/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html
index 53efe76..3b6eaa3 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html
+++ b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html
@@ -112,7 +112,7 @@
                     <i class="fa fa-info-circle"
                         uib-popover-template="'QuickInfoTemplate.html'"
                         ng-click="onClickItem(item, true, $event)"
-                        popover-is-open="popover == item"
+                        popover-is-open="popover == item && popoverVisible"
                         popover-placement="right" popover-trigger="'none'"
                         popover-class="catalog-selector-popover" popover-append-to-body="true"
                         ng-mouseenter="mouseInfoPopover(item, true)"
@@ -132,7 +132,7 @@
                     </div>
                     <i class="fa fa-info-circle"
                         uib-popover-template="'QuickInfoTemplate.html'"
-                        popover-is-open="popover == freeFormTile"
+                        popover-is-open="popover == freeFormTile && popoverVisible"
                         popover-placement="right-top" popover-trigger="'none'"
                         popover-class="catalog-selector-popover" popover-append-to-body="true"
                         ng-mouseenter="mouseInfoPopover(freeFormTile, true)"
@@ -163,6 +163,7 @@
             <p ng-if="popover.version"><i class="mini-icon fa fa-fw fa-code-fork"></i> {{popover.version}}</p>
         </div>
         <p class="quick-info-description" ng-if="popover.description">{{popover.description}}</p>
+        <p class="quick-info-description" ng-if="popover == freeFormTile">This is an ad hoc tile for an item entered by the user not known in the catalog.</p>
         <div class="quick-info-metadata bundle">
             <p ng-if="lastUsedText(popover)"><i class="mini-icon fa fa-clock-o"></i> {{ lastUsedText(popover) }}
               <br-svg type="close" class="closer" ng-click="popover.lastUsed = 0"></br-svg>
@@ -170,8 +171,8 @@
             <p ng-if="popover.displayTags && popover.displayTags.length"><i class="mini-icon fa fa-fw fa-tags"></i> 
                 <span ng-repeat-start="tag in popover.displayTags" class="label label-primary palette-item-tag">{{ tag }}</span>
                 <span ng-repeat-end> </span> </p>
-            <p><i class="mini-icon fa fa-fw fa-file-zip-o"></i> {{popover.containingBundle}}</p>
-            <p ng-if="popover.relevance"><i class="mini-icon fa fa-sort-numeric-asc"></i> Relevance score: {{ roundTwoDecimals(popover.relevance) }}</p>
+            <p ng-if="popover.containingBundle"><i class="mini-icon fa fa-fw fa-file-zip-o"></i> {{popover.containingBundle}}</p>
+            <p ng-if="popover.relevance"><i class="mini-icon fa fa-sort-numeric-asc"></i> Relevance score: {{ popover.relevance | number:2 }}</p>
         </div>
         <div class="quick-info-buttons">
             <div class="spacer"></div>

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/1da5338f/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js b/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js
index b0663a1..9c18129 100644
--- a/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js
+++ b/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js
@@ -320,7 +320,7 @@ export function specEditorDirective($rootScope, $templateCache, $injector, $sani
                 scope.state.config.filter.values.all = true;
             }
         };
-        scope.recordFocus = specEditor.recordFocus = ($item)=> {
+        scope.recordFocus = specEditor.recordFocus = ($item) => {
             scope.state.config.focus = $item.name;
         };
 


[7/9] brooklyn-ui git commit: Merge branch 'master' into relevance-and-other-composer-tweaks

Posted by tb...@apache.org.
Merge branch 'master' into relevance-and-other-composer-tweaks


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/08bd8ddc
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/08bd8ddc
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/08bd8ddc

Branch: refs/heads/master
Commit: 08bd8ddcaf8a7e3387e7216715de99a204161523
Parents: bfde3e5 65d3740
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Fri Nov 2 11:42:48 2018 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Fri Nov 2 11:42:48 2018 +0000

----------------------------------------------------------------------
 .../app/components/providers/blueprint-loader-api.provider.js    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------



[5/9] brooklyn-ui git commit: allow spec editor sections to be customized

Posted by tb...@apache.org.
allow spec editor sections to be customized


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/feac3fc1
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/feac3fc1
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/feac3fc1

Branch: refs/heads/master
Commit: feac3fc1b1034160fda7c1a285061a2cd8ef4d1f
Parents: bad6676
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Wed Oct 31 16:56:58 2018 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Thu Nov 1 12:16:33 2018 +0000

----------------------------------------------------------------------
 .../spec-editor/spec-editor.directive.js        |  6 +++--
 .../spec-editor/spec-editor.template.html       | 26 +++++++++++++++-----
 2 files changed, 24 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/feac3fc1/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js b/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js
index a5341b9..b0663a1 100644
--- a/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js
+++ b/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.directive.js
@@ -78,13 +78,15 @@ export function specEditorDirective($rootScope, $templateCache, $injector, $sani
         scope: {
             model: '='
         },
-        controller: controller,
+        controller: ['$scope', '$element', controller],
         template: template,
         link: link,
         controllerAs: 'specEditor',
     };
 
-    function controller() {
+    function controller($scope, $element) {
+        (composerOverrides.configureSpecEditorController || function() {})(this, $scope, $element);
+        
         // does very little currently, but link adds to this
         return this;
     }

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/feac3fc1/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.template.html
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.template.html b/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.template.html
index 2b0a4c4..937bbaa 100644
--- a/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.template.html
+++ b/ui-modules/blueprint-composer/app/components/spec-editor/spec-editor.template.html
@@ -341,7 +341,9 @@
 </br-collapsible>
 
 <!-- ENTITY LOCATION -->
-<br-collapsible ng-if="[FAMILIES.ENTITY, FAMILIES.SPEC].indexOf(model.family) > -1" state="state.location.open">
+<ng-include src="'SpecEditorLocationSection.html'"></ng-include>
+<script type="text/ng-template" id="SpecEditorLocationSection.html">
+  <br-collapsible ng-if="[FAMILIES.ENTITY, FAMILIES.SPEC].indexOf(model.family) > -1" state="state.location.open">
     <heading>
         Location
         <span ng-if="(model.issues | filter:{group:'location'}).length> 0" class="badge" ng-class="getBadgeClass((model.issues | filter:{group:'location'}))">{{(model.issues | filter:{group:'location'}).length}}</span>
@@ -365,10 +367,13 @@
             <button class="btn btn-danger btn-link" ng-click="model.clearIssues({group: 'location'}).removeLocation()">Remove</button>
         </div>
     </div>
-</br-collapsible>
+  </br-collapsible>
+</script>
 
 <!-- ENTITY POLICIES -->
-<br-collapsible ng-if="[FAMILIES.ENTITY, FAMILIES.SPEC].indexOf(model.family) > -1" state="state.policy.open">
+<ng-include src="'SpecEditorPoliciesSection.html'"></ng-include>
+<script type="text/ng-template" id="SpecEditorPoliciesSection.html">
+  <br-collapsible ng-if="[FAMILIES.ENTITY, FAMILIES.SPEC].indexOf(model.family) > -1" state="state.policy.open">
     <heading>
         Policies
         <span ng-if="getPoliciesIssues().length> 0" class="badge" ng-class="getBadgeClass(getPoliciesIssues())">{{getPoliciesIssues().length}}</span>
@@ -398,10 +403,13 @@
             <ng-include src="'AdjunctTemplate.html'"></ng-include>
         </div>
     </div>
-</br-collapsible>
+  </br-collapsible>
+</script>
 
 <!-- ENTITY ENRICHERS -->
-<br-collapsible ng-if="[FAMILIES.ENTITY, FAMILIES.SPEC].indexOf(model.family) > -1" state="state.enricher.open">
+<ng-include src="'SpecEditorEnrichersSection.html'"></ng-include>
+<script type="text/ng-template" id="SpecEditorEnrichersSection.html">
+  <br-collapsible ng-if="[FAMILIES.ENTITY, FAMILIES.SPEC].indexOf(model.family) > -1" state="state.enricher.open">
     <heading>
         Enrichers
         <span ng-if="getEnrichersIssues().length> 0" class="badge" ng-class="getBadgeClass(getEnrichersIssues())">{{getEnrichersIssues().length}}</span>
@@ -431,7 +439,13 @@
             <ng-include src="'AdjunctTemplate.html'"></ng-include>
         </div>
     </div>
-</br-collapsible>
+  </br-collapsible>
+</script>
+
+<ng-include src="'SpecEditorOtherSections.html'"></ng-include>
+<script type="text/ng-template" id="SpecEditorOtherSections.html">
+</script>
+
 
 <!-- CONFIG INFO TEMPLATE :: START -->
 <script type="text/ng-template" id="ConfigInfoTemplate.html">


[6/9] brooklyn-ui git commit: Merge branch 'master' into relevance-and-other-composer-tweaks

Posted by tb...@apache.org.
Merge branch 'master' into relevance-and-other-composer-tweaks


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/bfde3e51
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/bfde3e51
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/bfde3e51

Branch: refs/heads/master
Commit: bfde3e5106a90c5e5342e1a4d26d4e46d9027549
Parents: e20a8d1 777332a
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Fri Nov 2 11:06:37 2018 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Fri Nov 2 11:06:37 2018 +0000

----------------------------------------------------------------------
 .../providers/blueprint-loader-api.js           | 37 ++++++++++
 .../providers/blueprint-loader-api.provider.js  | 71 ++++++++++++++++++++
 ui-modules/blueprint-composer/app/index.js      |  9 +--
 .../app/views/main/main.controller.js           | 20 +-----
 4 files changed, 115 insertions(+), 22 deletions(-)
----------------------------------------------------------------------



[3/9] brooklyn-ui git commit: sort search results by relevance

Posted by tb...@apache.org.
sort search results by relevance

and display sort fields dropdown in order used


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/6ae7338f
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/6ae7338f
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/6ae7338f

Branch: refs/heads/master
Commit: 6ae7338f72a25cc7862ad0db37860a108dabce3d
Parents: a0cddab
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Wed Oct 31 12:56:20 2018 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Thu Nov 1 12:15:22 2018 +0000

----------------------------------------------------------------------
 .../catalog-selector.directive.js               | 65 +++++++++++++++-----
 .../catalog-selector.template.html              |  5 +-
 2 files changed, 52 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/6ae7338f/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
index 60f7beb..9f0bd14 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
+++ b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
@@ -25,10 +25,11 @@ import { distanceInWordsToNow } from 'date-fns';
 const MIN_ROWS_PER_PAGE = 4;
 
 const PALETTE_VIEW_ORDERS = {
-        name: { label: "Name", field: "displayName" },
-        lastUsed: { label: "Recent", field: "-lastUsed" }, 
-        bundle: { label: "Bundle", field: "containingBundle" }, 
-        id: { label: "ID", field: "symbolicName" }, 
+        relevance: { id: "relevance", label: "Relevance", field: "relevance" },
+        name: { id: "name", label: "Name", field: "displayName" },
+        lastUsed: { id: "lastUsed", label: "Recent", field: "-lastUsed" }, 
+        bundle: { id: "bundle", label: "Bundle", field: "containingBundle" }, 
+        id: { id: "id", label: "ID", field: "symbolicName" }, 
     };
 
 const PALETTE_VIEW_MODES = {
@@ -39,7 +40,7 @@ const PALETTE_VIEW_MODES = {
     };
 
 // fields in either bundle or type record:
-const FIELDS_TO_SEARCH = ['name', 'displayName', 'symbolicName', 'version', 'type', 'supertypes', 'containingBundle', 'description', 'displayTags', 'tags'];
+const FIELDS_TO_SEARCH = ['displayName', 'name', 'symbolicName', 'version', 'type', 'supertypes', 'containingBundle', 'description', 'displayTags', 'tags'];
 
 export function catalogSelectorDirective() {
     return {
@@ -88,23 +89,42 @@ export function catalogSelectorSearchFilter() {
     return function (items, search) {
         if (search) {
             return items.filter(function (item) {
-                return search.toLowerCase().split(' ').reduce( (found, part) => 
-                    found &&
-                    FIELDS_TO_SEARCH
-                        .filter(field => item.hasOwnProperty(field) && item[field])
-                        .reduce((match, field) => {
+                item.relevance = 0;
+                let wordNum = 0;
+                return search.toLowerCase().split(' ').reduce( (found, part) => {
+                    wordNum++;
+                    let fieldNum = 0;
+                    return found &&
+                        FIELDS_TO_SEARCH.reduce((match, field) => {
                             if (match) return true;
+                            fieldNum++;
+                            if (!item.hasOwnProperty(field) || !item[field]) return false;
                             let text = item[field];
                             if (!text.toLowerCase) {
                                 text = JSON.stringify(text).toLowerCase();
                             } else {
                                 text = text.toLowerCase();
                             }
-                            return match || text.indexOf(part) > -1;
+                            let index = text.indexOf(part);
+                            if (index == -1) return false;
+                            // found, set relevance -- uses an ad hoc heuristic preferring first fields and short text length,
+                            // earlier occurrences and earlier words weighted more highly (smaller number is better)
+                            let score = fieldNum * (2 / (1 + wordNum)) * Math.log(1 + text.length * index);
+                            /* to debug the scoring function:
+                            if (item.symbolicName.indexOf("EIP") >= 0 || item.symbolicName.indexOf("OpsWorks") >= 0) { 
+                                console.log(item.symbolicName, ": match", part, "in", field,
+                                    "#", fieldNum, wordNum, 
+                                    "pos", index, "/", text.length, 
+                                    ":", item.relevance, "+=", score);
+                            }
+                            */
+                            item.relevance += score;
+                            return true;
                         }, false)
-                , true);
+                }, true);
             });
         } else {
+            items.forEach( item => item.relevance = 0 );
             return items;
         }
     }
@@ -150,7 +170,6 @@ function controller($scope, $element, $timeout, $q, $uibModal, $log, $templateCa
     
     if (!$scope.state) $scope.state = {};
     if (!$scope.state.viewMode) $scope.state.viewMode = PALETTE_VIEW_MODES.normal;
-    if (!$scope.state.currentOrder) $scope.state.currentOrder = [ PALETTE_VIEW_ORDERS.name.field, '-version' ];
     
     $scope.pagination = {
         page: 1,
@@ -247,11 +266,23 @@ function controller($scope, $element, $timeout, $q, $uibModal, $log, $templateCa
         paletteDragAndDropService.dragEnd();
         tryMarkUsed(item);
     };
+    
     $scope.sortBy = function (order) {
-        let newOrder = [].concat($scope.state.currentOrder);
-        newOrder = newOrder.filter( (o) => o !== order.field );
-        $scope.state.currentOrder = [order.field].concat(newOrder);
+        let newFirst = {};
+        if (order) {
+            newFirst[order.id] = order;
+        }
+        $scope.state.currentOrder = Object.assign(newFirst, $scope.state.currentOrder, newFirst);
+        $scope.state.currentOrderFields = [];
+        $scope.state.currentOrderValues = [];
+        Object.values($scope.state.currentOrder).forEach( it => {
+            $scope.state.currentOrderValues.push(it);
+            $scope.state.currentOrderFields.push(it.field);
+        });
     };
+    if (!$scope.state.currentOrder) $scope.state.currentOrder = Object.assign({}, PALETTE_VIEW_ORDERS);
+    $scope.sortBy();
+    
     $scope.allowFreeForm = function () {
         return [
             EntityFamily.LOCATION
@@ -295,6 +326,8 @@ function controller($scope, $element, $timeout, $q, $uibModal, $log, $templateCa
         if (l < 100000) return 'Preselected for inclusion in "Recent" filter.';
         return 'Last used: ' + distanceInWordsToNow(l, { includeSeconds: true, addSuffix: true });
     }; 
+    $scope.roundTwoDecimals = (num) => Math.round(num*100)/100.0;
+    
     $scope.showPaletteControls = false;
     $scope.onFiltersShown = () => {
       $timeout( () => {

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/6ae7338f/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html
index 870600c..bd996e9 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html
+++ b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html
@@ -74,7 +74,7 @@
                     <i class="fa fa-sort"></i></div>
                 </a>
                 <ul class="dropdown-menu right-align-icon" role="menu" uib-dropdown-menu aria-labelledby="palette-sort">
-                        <li role="menuitem" ng-repeat="order in viewOrders track by $index" ng-class="{'active': state.currentOrder[0] === order.field}" class="layer">
+                        <li role="menuitem" ng-repeat="order in state.currentOrderValues track by $index" class="layer">
                             <a ng-click="sortBy(order)"><i class="fa fa-fw fa-circle"></i> {{ order.label }}</a>
                         </li>
                 </ul>
@@ -100,7 +100,7 @@
             <!-- here and below, col-xs-3 or -4 or -2 all work giving different densities;
                  this could be configurable ("compressed"=xs-2 w no labels, "normal"=xs-3, "big"=xs-4) -->
             <div class="catalog-palette-item" ng-class="state.viewMode.classes"
-                    ng-repeat="item in searchedItems = (items | catalogSelectorSearch:search | catalogSelectorFilters:this) | orderBy:state.currentOrder | limitTo:pagination.itemsPerPage:(pagination.page-1)*pagination.itemsPerPage track by (item.containingBundle + ':' + item.symbolicName + ':' + item.version)"
+                    ng-repeat="item in searchedItems = (items | catalogSelectorSearch:search | catalogSelectorFilters:this) | orderBy:state.currentOrderFields | limitTo:pagination.itemsPerPage:(pagination.page-1)*pagination.itemsPerPage track by (item.containingBundle + ':' + item.symbolicName + ':' + item.version)"
                     ng-click="onSelectItem(item)">
                 <div class="item" draggable="true" ng-dragstart="onDragItem(item, $event)" ng-dragend="onDragEnd(item, $event)">
                     <div class="item-logo">
@@ -157,6 +157,7 @@
                 <span ng-repeat-start="tag in item.displayTags" class="label label-primary palette-item-tag">{{ tag }}</span>
                 <span ng-repeat-end> </span> </p>
             <p><i class="mini-icon fa fa-fw fa-file-zip-o"></i> {{item.containingBundle}}</p>
+            <p ng-if="item.relevance"><i class="mini-icon fa fa-sort-numeric-asc"></i> Relevance score: {{ roundTwoDecimals(item.relevance) }}</p>
         </div>
     </div>
 </script>


[4/9] brooklyn-ui git commit: allow selection text and behaviour to be customized in palette

Posted by tb...@apache.org.
allow selection text and behaviour to be customized in palette

when adding, clicking the icon adds it directly; but on palette clicking opens popup;
and popup button gets correct configurable message


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/e20a8d12
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/e20a8d12
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/e20a8d12

Branch: refs/heads/master
Commit: e20a8d12bffb05b7010fe824a8c57deec27a8e0f
Parents: feac3fc
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Thu Nov 1 11:22:53 2018 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Thu Nov 1 12:16:33 2018 +0000

----------------------------------------------------------------------
 .../catalog-selector.directive.js               | 29 ++++++++++++++------
 .../catalog-selector/catalog-selector.less      |  8 ++++++
 .../catalog-selector.template.html              |  7 +++--
 .../components/designer/designer.directive.js   |  6 ++++
 .../app/components/filters/entity.filter.js     |  8 ++++--
 .../app/views/main/graphical/edit/add/add.html  |  2 +-
 .../app/views/main/graphical/edit/add/add.js    | 11 ++++++++
 .../views/main/graphical/graphical.state.html   |  4 +--
 .../app/views/main/graphical/graphical.state.js | 28 +++++++++++--------
 9 files changed, 74 insertions(+), 29 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/e20a8d12/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
index 654526a..4ff04b8 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
+++ b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
@@ -41,19 +41,20 @@ const PALETTE_VIEW_MODES = {
     };
 
 // fields in either bundle or type record:
-const FIELDS_TO_SEARCH = ['displayName', 'name', 'symbolicName', 'version', 'type', 'supertypes', 'containingBundle', 'description', 'displayTags', 'tags'];
+const FIELDS_TO_SEARCH = ['displayName', 'name', 'symbolicName', 'type', 'version', 'containingBundle', 'description', 'displayTags', 'tags', 'supertypes'];
 
 export function catalogSelectorDirective() {
     return {
         restrict: 'E',
         scope: {
             family: '<',
-            onSelect: '&',
-            onSelectText: "@?",
-            rowsPerPage: '<?',  // if unset then fill
+            onSelect: '&', // action to do when item is selected
+            onSelectText: "&?", // function returning text to show in the "on select" button for an item
+            iconSelects: '<?',  // boolean whether clicking the icon triggers selection directly or shows popup (false, default) 
+            rowsPerPage: '<?',  // optionally show fixed number of rows; unset (default and normal) computes based on available height
             reservedKeys: '<?',
-            state: '<?',
-            mode: '@?',  // for use by downstream projects to pass in special modes
+            state: '<?', // for shared state usage
+            mode: '@?',  // for use by downstream projects to pass in special modes to do add'l processing / rendering
         },
         template: template,
         controller: ['$scope', '$element', '$timeout', '$q', '$uibModal', '$log', '$templateCache', 'paletteApi', 'paletteDragAndDropService', 'iconGenerator', 'composerOverrides', 'recentlyUsedService', controller],
@@ -251,8 +252,10 @@ function controller($scope, $element, $timeout, $q, $uibModal, $log, $templateCa
             $scope.popover = null;
         }
     }
-    $scope.onClickItem = (item, $event) => {
-        if ($scope.popoverModal && $scope.popover == item) {
+    $scope.onClickItem = (item, isInfoIcon, $event) => {
+        if (!isInfoIcon && $scope.iconSelects) {
+            $scope.onSelectItem(item);
+        } else if ($scope.popoverModal && $scope.popover == item) {
             $scope.closePopover();
         } else {
             $scope.popover = item;
@@ -264,7 +267,12 @@ function controller($scope, $element, $timeout, $q, $uibModal, $log, $templateCa
         $scope.popover = null;
         $scope.popoverModal = false;
     }
-    $scope.onSelectItemToAdd = function (item) {
+    $scope.getOnSelectText = function (item) {
+        if (!($scope.onSelectText)) return "Select";
+        return $scope.onSelectText({item: item});
+    }
+    $scope.onSelectItem = function (item) {
+        $scope.closePopover();
         if (angular.isFunction($scope.onSelect)) {
             tryMarkUsed(item);
             $scope.onSelect({item: item});
@@ -394,6 +402,9 @@ function controller($scope, $element, $timeout, $q, $uibModal, $log, $templateCa
         }
     }
     
+    // can be overridden to disable "open in catalog" button
+    $scope.allowOpenInCatalog = true;
+    
     // this can be overridden for palette sections/modes which show a subset of the types returned by the server;
     // this is applied when the data is received from the server.
     // it is used by catalogSelectorFiltersFilter; 

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/e20a8d12/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.less
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.less b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.less
index 2f8f174..05f5da2 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.less
+++ b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.less
@@ -291,6 +291,9 @@ catalog-selector {
         margin-top: -3px;
         margin-bottom: 12px;
         padding: 0px 16px 6px 16px;
+        .closer {
+            margin-top: 6px;
+        }
     }
     .closer {
         width: 10px;
@@ -311,6 +314,11 @@ catalog-selector {
             line-height: 1;
             margin-left: 12px;
         }
+        .select-item-button {
+            flex: 0 1 auto;
+            text-overflow: ellipsis;
+            overflow: hidden;
+        }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/e20a8d12/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html
index 269e139..53efe76 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html
+++ b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.template.html
@@ -101,7 +101,7 @@
                  this could be configurable ("compressed"=xs-2 w no labels, "normal"=xs-3, "big"=xs-4) -->
             <div class="catalog-palette-item" ng-class="state.viewMode.classes"
                     ng-repeat="item in searchedItems = (items | catalogSelectorSearch:search | catalogSelectorFilters:this) | orderBy:state.currentOrderFields | limitTo:pagination.itemsPerPage:(pagination.page-1)*pagination.itemsPerPage track by (item.containingBundle + ':' + item.symbolicName + ':' + item.version)"
-                    ng-click="onClickItem(item, $event)">
+                    ng-click="onClickItem(item, false, $event)">
                 <div class="item" draggable="true" ng-dragstart="onDragItem(item, $event)" ng-dragend="onDragEnd(item, $event)">
                     <div class="item-logo">
                         <img ng-src="{{item | iconGeneratorPipe:'symbolicName'}}" alt="{{item.displayName}} logo" on-error="onImageError" item-id="{{item.symbolicName}}"/>
@@ -111,6 +111,7 @@
                     </div>
                     <i class="fa fa-info-circle"
                         uib-popover-template="'QuickInfoTemplate.html'"
+                        ng-click="onClickItem(item, true, $event)"
                         popover-is-open="popover == item"
                         popover-placement="right" popover-trigger="'none'"
                         popover-class="catalog-selector-popover" popover-append-to-body="true"
@@ -174,8 +175,8 @@
         </div>
         <div class="quick-info-buttons">
             <div class="spacer"></div>
-            <button class="btn btn-primary btn-outline" ng-click="onSelectItemToAdd(popover)">{{ onSelectText || "Select" }}</button>
-            <a ng-if="popover.containingBundle" href="{{ getOpenCatalogLink(popover) }}" target="_blank"><button class="btn btn-info btn-outline">Open in catalog</button></a>
+            <button class="btn btn-primary btn-outline select-item-button" ng-click="onSelectItem(popover, false, $event)">{{ getOnSelectText(popover) }}</button>
+            <a ng-if="popover.containingBundle && allowOpenInCatalog" href="{{ getOpenCatalogLink(popover) }}" target="_blank"><button class="btn btn-info btn-outline">Open in catalog</button></a>
         </div>
     </div>
 </script>

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/e20a8d12/ui-modules/blueprint-composer/app/components/designer/designer.directive.js
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/designer/designer.directive.js b/ui-modules/blueprint-composer/app/components/designer/designer.directive.js
index 2f91745..e704928 100644
--- a/ui-modules/blueprint-composer/app/components/designer/designer.directive.js
+++ b/ui-modules/blueprint-composer/app/components/designer/designer.directive.js
@@ -29,6 +29,9 @@ const TAG = 'DIRECTIVE :: DESIGNER :: ';
 export function designerDirective($log, $state, $q, iconGenerator, catalogApi, blueprintService, brSnackbar, paletteDragAndDropService) {
     let directive = {
         restrict: 'E',
+        scope: {
+            onSelectionChange: '<?'
+        },
         template: '',
         link: link
     };
@@ -109,13 +112,16 @@ export function designerDirective($log, $state, $q, iconGenerator, catalogApi, b
                     break;
             }
             if (angular.isDefined(id)) {
+                $log.debug(TAG + 'Select canvas, selected node: ' + id);
                 $scope.selectedEntity = blueprintService.findAny(id);
+                if ($scope.onSelectionChange) $scope.onSelectionChange($scope.selectedEntity);
             }
         });
 
         $element.bind('click-svg', (event)=> {
             $log.debug(TAG + 'Select canvas, un-select node (if one selected before)');
             $scope.selectedEntity = null;
+            if ($scope.onSelectionChange) $scope.onSelectionChange($scope.selectedEntity);
             $scope.$apply(()=> {
                 redrawGraph();
                 $state.go('main.graphical');

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/e20a8d12/ui-modules/blueprint-composer/app/components/filters/entity.filter.js
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/filters/entity.filter.js b/ui-modules/blueprint-composer/app/components/filters/entity.filter.js
index 2fa5c47..32a785b 100644
--- a/ui-modules/blueprint-composer/app/components/filters/entity.filter.js
+++ b/ui-modules/blueprint-composer/app/components/filters/entity.filter.js
@@ -16,11 +16,13 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-const DEFAULT = '';
-
 export function entityNameFilter() {
     return function (input) {
-        var result = input ? (input.displayName || input.name || input.symbolicName || input.type || DEFAULT) : DEFAULT;
+        var result = input ? (input.displayName || input.name || input.symbolicName || input.type || null) : null;
+        if (!result) {
+            if (input && !input.parent) result = 'Application';
+            else result = 'Unnamed entity';
+        }
         if (result.match(/^[^\w]*deprecated[^\w]*/i)) {
             result = result.replace(/^[^\w]*deprecated[^\w]*/i, '');
         }

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/e20a8d12/ui-modules/blueprint-composer/app/views/main/graphical/edit/add/add.html
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/views/main/graphical/edit/add/add.html b/ui-modules/blueprint-composer/app/views/main/graphical/edit/add/add.html
index dfabeaf..24acefc 100644
--- a/ui-modules/blueprint-composer/app/views/main/graphical/edit/add/add.html
+++ b/ui-modules/blueprint-composer/app/views/main/graphical/edit/add/add.html
@@ -45,7 +45,7 @@
                 <br-svg type="close" class="pull-right" ng-click="vm.selectedSection = undefined"></br-svg>
             </h3>
         </div>
-        <catalog-selector state="paletteState" family="section.type" mode="{{ section.mode }}" on-select="vm.onTypeSelected(item)" class="palette-full-height-wrapper"></catalog-selector>
+        <catalog-selector state="paletteState" family="section.type" mode="{{ section.mode }}" on-select="vm.onTypeSelected(item)" on-select-text="vm.getOnSelectText(item)" icon-selects="true" class="palette-full-height-wrapper"></catalog-selector>
     </div>
   </div>
  </div>

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/e20a8d12/ui-modules/blueprint-composer/app/views/main/graphical/edit/add/add.js
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/views/main/graphical/edit/add/add.js b/ui-modules/blueprint-composer/app/views/main/graphical/edit/add/add.js
index e409655..f1b92f9 100644
--- a/ui-modules/blueprint-composer/app/views/main/graphical/edit/add/add.js
+++ b/ui-modules/blueprint-composer/app/views/main/graphical/edit/add/add.js
@@ -88,6 +88,17 @@ export function GraphicalEditAddController($scope, $filter, $state, $stateParams
 
         return label;
     };
+    
+    this.getOnSelectText = () => {
+        switch ($scope.family) {
+            case EntityFamily.ENTITY: return "Add as child";
+            case EntityFamily.SPEC: return "Set as spec";
+            case EntityFamily.POLICY: return "Add this policy";
+            case EntityFamily.ENRICHER: return "Add this enricher";
+            case EntityFamily.LOCATION: return "Add this location";
+        }
+        return "Select";
+    };
 
     this.onTypeSelected = (type)=> {
         switch ($scope.family) {

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/e20a8d12/ui-modules/blueprint-composer/app/views/main/graphical/graphical.state.html
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/views/main/graphical/graphical.state.html b/ui-modules/blueprint-composer/app/views/main/graphical/graphical.state.html
index fd69c55..711d4c1 100644
--- a/ui-modules/blueprint-composer/app/views/main/graphical/graphical.state.html
+++ b/ui-modules/blueprint-composer/app/views/main/graphical/graphical.state.html
@@ -31,7 +31,7 @@
         </div>
     </div>
 
-    <designer></designer>
+    <designer on-selection-change="vm.onCanvasSelection"></designer>
   </div>
 
   <div class="pane pane-palette" ng-if="vm.selectedSection">
@@ -44,7 +44,7 @@
                 <br-svg type="close" class="pull-right" ng-click="vm.selectedSection = undefined"></br-svg>
             </h3>
         </div>
-        <catalog-selector state="paletteState" family="section.type" mode="{{ section.mode }}" on-select="vm.onTypeSelected(item)" class="palette-full-height-wrapper"></catalog-selector>
+        <catalog-selector state="paletteState" family="section.type" mode="{{ section.mode }}" on-select="vm.addSelectedTypeToTargetEntity(item)" on-select-text="vm.getOnSelectText()" class="palette-full-height-wrapper"></catalog-selector>
     </div>
   </div>
 

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/e20a8d12/ui-modules/blueprint-composer/app/views/main/graphical/graphical.state.js
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/views/main/graphical/graphical.state.js b/ui-modules/blueprint-composer/app/views/main/graphical/graphical.state.js
index 4f053cc..ffb9616 100644
--- a/ui-modules/blueprint-composer/app/views/main/graphical/graphical.state.js
+++ b/ui-modules/blueprint-composer/app/views/main/graphical/graphical.state.js
@@ -28,47 +28,53 @@ export const graphicalState = {
     templateProvider: function(composerOverrides) {
         return composerOverrides.paletteGraphicalStateTemplate || template;
     },
-    controller: ['$scope', '$state', 'blueprintService', 'paletteService', graphicalController],
+    controller: ['$scope', '$state', '$filter', 'blueprintService', 'paletteService', graphicalController],
     controllerAs: 'vm',
     data: {
         label: 'Graphical Designer'
     }
 };
 
-function graphicalController($scope, $state, blueprintService, paletteService) {
+function graphicalController($scope, $state, $filter, blueprintService, paletteService) {
     this.EntityFamily = EntityFamily;
 
     this.sections = paletteService.getSections();
     this.selectedSection = Object.values(this.sections).find(section => section.type === EntityFamily.ENTITY);
     $scope.paletteState = {};  // share state among all sections
 
-    this.onTypeSelected = (selectedType)=> {
-        let rootEntity = blueprintService.get();
+    this.onCanvasSelection = (item) => {
+        $scope.canvasSelectedItem = item;
+    }
+    this.getOnSelectText = (selectableType) => $scope.canvasSelectedItem ? "Add to " + $filter('entityName')($scope.canvasSelectedItem) : "Add to application";
+    
+    this.addSelectedTypeToTargetEntity = (selectedType, targetEntity) => {
+        if (!targetEntity) targetEntity = $scope.canvasSelectedItem;
+        if (!targetEntity) targetEntity = blueprintService.get();
 
         if (selectedType.supertypes.includes(EntityFamily.ENTITY.superType)) {
             let newEntity = blueprintService.populateEntityFromApi(new Entity(), selectedType);
-            rootEntity.addChild(newEntity);
+            targetEntity.addChild(newEntity);
             blueprintService.refreshEntityMetadata(newEntity, EntityFamily.ENTITY).then(() => {
                 $state.go(graphicalEditEntityState, {entityId: newEntity._id});
             })
         }
         else if (selectedType.supertypes.includes(EntityFamily.POLICY.superType)) {
             let newPolicy = blueprintService.populateEntityFromApi(new Entity(), selectedType);
-            rootEntity.addPolicy(newPolicy);
+            targetEntity.addPolicy(newPolicy);
             blueprintService.refreshEntityMetadata(newPolicy, EntityFamily.POLICY).then(() => {
-                $state.go(graphicalEditPolicyState, {entityId: rootEntity._id, policyId: newPolicy._id});
+                $state.go(graphicalEditPolicyState, {entityId: targetEntity._id, policyId: newPolicy._id});
             });
         }
         else if (selectedType.supertypes.includes(EntityFamily.ENRICHER.superType)) {
             let newEnricher = blueprintService.populateEntityFromApi(new Entity(), selectedType);
-            rootEntity.addEnricher(newEnricher);
+            targetEntity.addEnricher(newEnricher);
             blueprintService.refreshEntityMetadata(newEnricher, EntityFamily.ENRICHER).then(() => {
-                $state.go(graphicalEditEnricherState, {entityId: rootEntity._id, enricherId: newEnricher._id});
+                $state.go(graphicalEditEnricherState, {entityId: targetEntity._id, enricherId: newEnricher._id});
             });
         }
         else if (selectedType.supertypes.includes(EntityFamily.LOCATION.superType)) {
-            blueprintService.populateLocationFromApi(rootEntity, selectedType);
-            $state.go(graphicalEditEntityState, {entityId: rootEntity._id});
+            blueprintService.populateLocationFromApi(targetEntity, selectedType);
+            $state.go(graphicalEditEntityState, {entityId: targetEntity._id});
         }
     };
 }


[2/9] brooklyn-ui git commit: make default view 3x wide rather than 4x wide

Posted by tb...@apache.org.
make default view 3x wide rather than 4x wide


Project: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/commit/4d42539e
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/tree/4d42539e
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-ui/diff/4d42539e

Branch: refs/heads/master
Commit: 4d42539e695fdd8354b076b2ae724f730f4aef0f
Parents: 6ae7338
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Wed Oct 31 13:24:47 2018 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Thu Nov 1 12:15:22 2018 +0000

----------------------------------------------------------------------
 .../components/catalog-selector/catalog-selector.directive.js | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/4d42539e/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
----------------------------------------------------------------------
diff --git a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
index 9f0bd14..fea5312 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
+++ b/ui-modules/blueprint-composer/app/components/catalog-selector/catalog-selector.directive.js
@@ -33,9 +33,10 @@ const PALETTE_VIEW_ORDERS = {
     };
 
 const PALETTE_VIEW_MODES = {
-        compact: { name: "Compact", classes: "col-xs-2 item-compact", itemsPerRow: 6, rowHeightPx: 75, hideName: true },
-        normal: { name: "Normal", classes: "col-xs-3", itemsPerRow: 4 },
-        large: { name: "Large", classes: "col-xs-4", itemsPerRow: 3 },
+        tiny: { name: "Tiny", classes: "col-xs-2 item-compact", itemsPerRow: 6, rowHeightPx: 75, hideName: true },
+        compact: { name: "Compact", classes: "col-xs-3", itemsPerRow: 4 },
+        normal: { name: "Normal", classes: "col-xs-4", itemsPerRow: 3 },
+        large: { name: "Large", classes: "col-xs-6", itemsPerRow: 2 },
         list: { name: "List", classes: "col-xs-12 item-full-width", itemsPerRow: 1 },
     };