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/10/30 17:33:52 UTC

[05/10] brooklyn-ui git commit: share palette view state among all palettes

share palette view state among all palettes


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

Branch: refs/heads/master
Commit: 6ccc2b1af2c7c9953a113fb0e6346c60b8ae3fee
Parents: 7670595
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Wed Oct 24 16:08:57 2018 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Wed Oct 24 16:13:22 2018 +0100

----------------------------------------------------------------------
 .../catalog-selector/catalog-selector.directive.js     | 13 +++++++------
 .../catalog-selector/catalog-selector.template.html    |  2 +-
 .../app/views/main/graphical/graphical.state.html      |  2 +-
 .../app/views/main/graphical/graphical.state.js        |  1 +
 4 files changed, 10 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/6ccc2b1a/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 df0c739..7c9a16d 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
@@ -39,6 +39,7 @@ export function catalogSelectorDirective() {
             onSelect: '&',
             rowsPerPage: '<',  // if unset then fill
             reservedKeys: '<?',
+            state: '<?',
             mode: '@?',  // for use by downstream projects to pass in special modes
         },
         template: template,
@@ -147,15 +148,15 @@ function controller($scope, $element, $timeout, $q, $uibModal, $log, $templateCa
     this.$timeout = $timeout;
 
     $scope.viewModes = PALETTE_VIEW_MODES;
-    $scope.state = {
-        orders: ['name', 'type', 'id'],
-        currentOrder: 'name',
-        viewMode: PALETTE_VIEW_MODES.normal,
-    };
+    $scope.viewOrders = ['name', 'type', 'id'];
+    
+    if (!$scope.state) $scope.state = {};
+    if (!$scope.state.viewMode) $scope.state.viewMode = PALETTE_VIEW_MODES.normal;
+    if (!$scope.state.currentOrder) $scope.state.currentOrder = 'name';
     
     $scope.pagination = {
         page: 1,
-        itemsPerPage: $scope.state.viewMode.itemsPerRow * ($scope.rowsPerPage || MIN_ROWS_PER_PAGE)
+        itemsPerPage: $scope.state.viewMode.itemsPerRow * ($scope.rowsPerPage || 1)  // will fill out after load
     };
     
     $scope.getEntityNameForPalette = function(item, entityName) {

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/6ccc2b1a/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 7159b80..0b87153 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
@@ -46,7 +46,7 @@
                         </li>
                         
                         <li role="menuitem" class="dropdown-header">Sort</li>
-                        <li role="menuitem" ng-repeat="order in state.orders track by $index" ng-class="{'active': state.currentOrder === order}" class="layer">
+                        <li role="menuitem" ng-repeat="order in viewOrders track by $index" ng-class="{'active': state.currentOrder === order}" class="layer">
                             <a ng-click="state.currentOrder = order"><i class="fa fa-fw fa-circle"></i> {{order | capitalize}}</a>
                         </li>
                     </ul>

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/6ccc2b1a/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 5ee0f88..7dc0d79 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
@@ -42,7 +42,7 @@
                 <br-svg type="close" class="pull-right" ng-click="vm.selectedSection = undefined"></br-svg>
             </h3>
         </div>
-        <catalog-selector family="section.type" on-select="vm.onTypeSelected(item)" class="palette-full-height-wrapper"></catalog-selector>
+        <catalog-selector state="state" family="section.type" on-select="vm.onTypeSelected(item)" class="palette-full-height-wrapper"></catalog-selector>
     </div>
 </div>
 

http://git-wip-us.apache.org/repos/asf/brooklyn-ui/blob/6ccc2b1a/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 40a123d..d4fe313 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
@@ -40,6 +40,7 @@ function graphicalController($scope, $state, blueprintService, paletteService) {
 
     this.sections = paletteService.getSections();
     this.selectedSection = Object.values(this.sections).find(section => section.type === EntityFamily.ENTITY);
+    $scope.state = {};  // share state among all sections
 
     this.onTypeSelected = (selectedType)=> {
         let rootEntity = blueprintService.get();