You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2019/11/18 15:29:25 UTC

[brooklyn-ui] branch master updated (746ba8d -> 95820f4)

This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git.


    from 746ba8d  last merge missed out IS_PRODUCTION initialization in one app
     add dfaa1cb  IconService.get can take entities now, not just the symbolic name
     add 3f95815  remove a couple spurious console.logs
     add 2b668af  share css mixin for make-icon
     add 56276fa  add icons to app inspector
     add 4eded1d  compute icon in controller as pipes on objects are really inefficient
     new ecdf6fa  address PR comments
     new b7afa2c  This closes #140
     new c160eab  add an "Open in Composer" button to quick launch
     new 19b5d76  better handling for edge conditions
     new 09ad705  in quick launch, if any app is tagged catalog_quick_launch, then only apps with that tags will be shown. as before in all cases this only shows those apps marked as templates.
     new 95820f4  This closes #142

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../app/components/entity-tree/entity-node.html    |  5 +-
 .../app/components/entity-tree/entity-node.less    | 19 ++++++-
 .../entity-tree/entity-tree.directive.js           | 13 ++---
 .../main/inspect/summary/summary.controller.js     | 14 ++---
 .../app/views/main/inspect/summary/summary.less    | 32 ++++++++++--
 .../main/inspect/summary/summary.template.html     |  7 ++-
 .../catalog-saver/catalog-saver.directive.js       |  1 -
 ui-modules/blueprint-composer/app/index.less       |  7 ---
 .../app/views/main/main.controller.js              |  1 -
 ui-modules/catalog/app/index.less                  | 12 -----
 ui-modules/home/app/index.less                     |  6 ---
 .../app/views/main/deploy/deploy.controller.js     |  3 +-
 ui-modules/home/app/views/main/main.controller.js  |  7 +++
 ui-modules/utils/br-core/style/mixins.less         | 12 +++++
 ui-modules/utils/icon-generator/icon-generator.js  | 61 ++++++++++++++++++----
 ui-modules/utils/quick-launch/quick-launch.html    |  3 +-
 ui-modules/utils/quick-launch/quick-launch.js      | 47 ++++++++++++++---
 ui-modules/utils/quick-launch/quick-launch.less    |  1 +
 18 files changed, 182 insertions(+), 69 deletions(-)


[brooklyn-ui] 03/06: in quick launch, if any app is tagged catalog_quick_launch, then only apps with that tags will be shown. as before in all cases this only shows those apps marked as templates.

Posted by he...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git

commit 09ad7055008316a4904da2fee0595274bc6bd1a7
Author: Alex Heneveld <al...@cloudsoftcorp.com>
AuthorDate: Mon Nov 18 13:50:18 2019 +0000

    in quick launch, if any app is tagged catalog_quick_launch, then only apps with that tags will be shown. as before in all cases this only shows those apps marked as templates.
---
 ui-modules/home/app/views/main/main.controller.js | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/ui-modules/home/app/views/main/main.controller.js b/ui-modules/home/app/views/main/main.controller.js
index 1c7360b..e967953 100644
--- a/ui-modules/home/app/views/main/main.controller.js
+++ b/ui-modules/home/app/views/main/main.controller.js
@@ -42,6 +42,13 @@ export const mainState = {
         }],
         catalogApps: ['catalogApi', (catalogApi) => {
             return catalogApi.getTypes({params: {supertype: 'org.apache.brooklyn.api.entity.Application'}}).then(applications => {
+                // optionally tag things with 'catalog_quick_launch': if any apps are so tagged, 
+                // then only apps with such tags will be shown;
+                // in all cases only show those marked as templates
+                var appsWithTag = applications.filter(application => application.tags && application.tags.indexOf("catalog_quick_launch")>=0);
+                if (appsWithTag.length) {
+                    applications = appsWithTag;
+                }
                 return applications.filter(application => application.template);
             });
         }]


[brooklyn-ui] 02/06: better handling for edge conditions

Posted by he...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git

commit 19b5d7671e3eb9aceeddda84a4bb511b88124ad1
Author: Alex Heneveld <al...@cloudsoftcorp.com>
AuthorDate: Mon Nov 18 13:44:41 2019 +0000

    better handling for edge conditions
---
 ui-modules/utils/quick-launch/quick-launch.js | 37 +++++++++++++++++----------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/ui-modules/utils/quick-launch/quick-launch.js b/ui-modules/utils/quick-launch/quick-launch.js
index 4d53cc3..e4b1a67 100644
--- a/ui-modules/utils/quick-launch/quick-launch.js
+++ b/ui-modules/utils/quick-launch/quick-launch.js
@@ -64,9 +64,15 @@ export function quickLaunchDirective() {
 
         $scope.$watch('app', () => {
             $scope.clearError();
-            $scope.appHasWizard = !checkForLocationTags($scope.app.plan.data);
-            $scope.yamlViewDisplayed = !$scope.appHasWizard;
             $scope.editorYaml = $scope.app.plan.data;
+            var parsedPlan = null;
+            try {
+                parsedPlan = yaml.safeLoad($scope.editorYaml);
+            } catch (e) { /* ignore, it's an unparseable template */ }
+            // enable wizard if it's parseble and doesn't specify a location
+            // (if it's not parseable, or it specifies a location, then the YAML view is displayed)
+            $scope.appHasWizard = parsedPlan!=null && !checkForLocationTags(parsedPlan);
+            $scope.yamlViewDisplayed = !$scope.appHasWizard;
             $scope.entityToDeploy = {
                 type: $scope.app.symbolicName
             };
@@ -172,16 +178,21 @@ export function quickLaunchDirective() {
         }
 
         function buildComposerYaml() {
-            let newApp = {
-                name: $scope.model.name || $scope.app.displayName,
-            };
-            if ($scope.model.location) {
-                newApp.location = $scope.model.location;
-            }
-            if ($scope.entityToDeploy[BROOKLYN_CONFIG]) {
-                newApp[BROOKLYN_CONFIG] = $scope.entityToDeploy[BROOKLYN_CONFIG]
+            if ($scope.yamlViewDisplayed) {
+                return angular.copy($scope.editorYaml);
+            } else {
+                let newApp = {
+                    name: $scope.model.name || $scope.app.displayName,
+                };
+                if ($scope.model.location) {
+                    newApp.location = $scope.model.location;
+                }
+                if ($scope.entityToDeploy[BROOKLYN_CONFIG]) {
+                    newApp[BROOKLYN_CONFIG] = $scope.entityToDeploy[BROOKLYN_CONFIG]
+                }
+                // TODO if plan data has config in the root (unlikely) this will have errors
+                return yaml.safeDump(newApp) + "\n" + $scope.app.plan.data;
             }
-            return yaml.safeDump(newApp) + "\n" + $scope.app.plan.data;
         }
 
         function showEditor() {
@@ -203,8 +214,8 @@ export function quickLaunchDirective() {
         }
     }
 
-    function checkForLocationTags(planYaml) {
-        return reduceFunction(false, yaml.safeLoad(planYaml));
+    function checkForLocationTags(parsedPlan) {
+        return reduceFunction(false, parsedPlan);
 
         function reduceFunction(locationFound, entity) {
             if (entity.hasOwnProperty('location') || entity.hasOwnProperty('location')) {


[brooklyn-ui] 04/06: address PR comments

Posted by he...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git

commit ecdf6fa118c113c425fdc0a85d8f04c72e2d67b7
Author: Alex Heneveld <al...@cloudsoftcorp.com>
AuthorDate: Mon Nov 18 15:28:01 2019 +0000

    address PR comments
---
 ui-modules/app-inspector/app/components/entity-tree/entity-node.less   | 1 -
 .../app-inspector/app/components/entity-tree/entity-tree.directive.js  | 3 +--
 ui-modules/utils/icon-generator/icon-generator.js                      | 2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/ui-modules/app-inspector/app/components/entity-tree/entity-node.less b/ui-modules/app-inspector/app/components/entity-tree/entity-node.less
index ac4f717..6b7e3c4 100644
--- a/ui-modules/app-inspector/app/components/entity-tree/entity-node.less
+++ b/ui-modules/app-inspector/app/components/entity-tree/entity-node.less
@@ -86,7 +86,6 @@
     }
   }
   .node-icon {
-    .pull-right();
     flex-grow: 0 !important;
     max-height: 20px; //let it extend above and below span's boundaries
     overflow: visible !important;
diff --git a/ui-modules/app-inspector/app/components/entity-tree/entity-tree.directive.js b/ui-modules/app-inspector/app/components/entity-tree/entity-tree.directive.js
index 9f6d596..76183e7 100644
--- a/ui-modules/app-inspector/app/components/entity-tree/entity-tree.directive.js
+++ b/ui-modules/app-inspector/app/components/entity-tree/entity-tree.directive.js
@@ -97,7 +97,7 @@ export function entityTreeDirective() {
     }
 }
 
-export function entityNodeDirective($log, iconService) {
+export function entityNodeDirective() {
     return {
         restrict: 'E',
         template: entityNodeTemplate,
@@ -188,4 +188,3 @@ export function entityNodeDirective($log, iconService) {
 
     }
 }
-entityNodeDirective.$inject = ['$log', 'iconService'];
diff --git a/ui-modules/utils/icon-generator/icon-generator.js b/ui-modules/utils/icon-generator/icon-generator.js
index a2695b5..4839d88 100644
--- a/ui-modules/utils/icon-generator/icon-generator.js
+++ b/ui-modules/utils/icon-generator/icon-generator.js
@@ -147,7 +147,7 @@ function IconService($q, $http, iconGenerator, $log, cache) {
             } else if (entityOrTypeId.type) {
                 let entity = entityOrTypeId;
                 id = entity.type;
-                    if (id === 'org.apache.brooklyn.entity.stock.BasicApplication' && entity.children.length === 1) {
+                if (id === 'org.apache.brooklyn.entity.stock.BasicApplication' && entity.children && entity.children.length === 1) {
                     id = entity.children[0].catalogItemId || entity.children[0].type;
                 }
             }


[brooklyn-ui] 01/06: add an "Open in Composer" button to quick launch

Posted by he...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git

commit c160eabf2b18f814fffe937cc2f0e1859b035dab
Author: Alex Heneveld <al...@cloudsoftcorp.com>
AuthorDate: Mon Nov 18 12:02:21 2019 +0000

    add an "Open in Composer" button to quick launch
    
    the effect is to open the template's definition in composer
---
 .../app/views/main/deploy/deploy.controller.js     |  3 ++-
 ui-modules/utils/quick-launch/quick-launch.html    |  3 ++-
 ui-modules/utils/quick-launch/quick-launch.js      | 28 ++++++++++++++++++----
 ui-modules/utils/quick-launch/quick-launch.less    |  1 +
 4 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/ui-modules/home/app/views/main/deploy/deploy.controller.js b/ui-modules/home/app/views/main/deploy/deploy.controller.js
index 7055d01..896ec7e 100644
--- a/ui-modules/home/app/views/main/deploy/deploy.controller.js
+++ b/ui-modules/home/app/views/main/deploy/deploy.controller.js
@@ -81,7 +81,8 @@ export function deployStateController($scope, $state, $stateParams, $uibModal, b
     function modalController($scope, $location, entitySpec, locations) {
         $scope.app = entitySpec;
         $scope.locations = locations;
-        $scope.args = $location.search();
+        // can optionally add: { noEditButton: true, noComposerButton: true }, or pass in URL
+        $scope.args = angular.extend({}, $location.search());
     }
 }
 
diff --git a/ui-modules/utils/quick-launch/quick-launch.html b/ui-modules/utils/quick-launch/quick-launch.html
index 52b0b13..99f4d5e 100644
--- a/ui-modules/utils/quick-launch/quick-launch.html
+++ b/ui-modules/utils/quick-launch/quick-launch.html
@@ -136,7 +136,8 @@
 
 <div class="quick-launch-actions">
     <button class="btn btn-lg btn-default" ng-if="yamlViewDisplayed && appHasWizard" ng-disabled="deploying" ng-click="hideEditor()">Back</button>
-    <button class="btn btn-lg btn-default" ng-if="!yamlViewDisplayed" ng-disabled="deploying" ng-click="showEditor()">Open in Editor</button>
+    <button class="btn btn-lg btn-default" ng-if="!yamlViewDisplayed && !args.noEditButton" ng-disabled="deploying" ng-click="showEditor()">YAML</button>
+    <button class="btn btn-lg btn-default" ng-if="!args.noComposerButton" ng-disabled="deploying" ng-click="openComposer()">Open in Composer</button>
     <button class="btn btn-lg btn-success pull-right" ng-disabled="(deploy.$invalid || deploying) && !yamlViewDisplayed" ng-click="deployApp()">{{deploying ? 'Deploying&hellip;' : 'Deploy'}}</button>
 </div>
 
diff --git a/ui-modules/utils/quick-launch/quick-launch.js b/ui-modules/utils/quick-launch/quick-launch.js
index 645caf4..4d53cc3 100644
--- a/ui-modules/utils/quick-launch/quick-launch.js
+++ b/ui-modules/utils/quick-launch/quick-launch.js
@@ -39,17 +39,18 @@ export function quickLaunchDirective() {
             app: '=',
             locations: '=',
             args: '=?',
-            callback: '=?'
+            callback: '=?',
         },
-        controller: ['$scope', '$http', 'brSnackbar', controller]
+        controller: ['$scope', '$http', '$location', 'brSnackbar', controller]
     };
 
-    function controller($scope, $http, brSnackbar) {
+    function controller($scope, $http, $location, brSnackbar) {
         $scope.deploying = false;
         $scope.model = {
             newConfigFormOpen: false
         };
-        if ($scope.args && $scope.args.location) {
+        $scope.args = $scope.args || {};
+        if ($scope.args.location) {
             $scope.model.location = $scope.args.location;
         }
         $scope.toggleNewConfigForm = toggleNewConfigForm;
@@ -57,6 +58,7 @@ export function quickLaunchDirective() {
         $scope.deleteConfigField = deleteConfigField;
         $scope.deployApp = deployApp;
         $scope.showEditor = showEditor;
+        $scope.openComposer = openComposer;
         $scope.hideEditor = hideEditor;
         $scope.clearError = clearError;
 
@@ -169,6 +171,19 @@ export function quickLaunchDirective() {
             return yaml.safeDump(newApp);
         }
 
+        function buildComposerYaml() {
+            let newApp = {
+                name: $scope.model.name || $scope.app.displayName,
+            };
+            if ($scope.model.location) {
+                newApp.location = $scope.model.location;
+            }
+            if ($scope.entityToDeploy[BROOKLYN_CONFIG]) {
+                newApp[BROOKLYN_CONFIG] = $scope.entityToDeploy[BROOKLYN_CONFIG]
+            }
+            return yaml.safeDump(newApp) + "\n" + $scope.app.plan.data;
+        }
+
         function showEditor() {
             $scope.editorYaml = buildYaml();
             $scope.yamlViewDisplayed = true;
@@ -178,6 +193,11 @@ export function quickLaunchDirective() {
             $scope.yamlViewDisplayed = false;
         }
 
+        function openComposer() {
+            window.location.href = '/brooklyn-ui-blueprint-composer/#!/graphical?'+
+                'yaml='+encodeURIComponent(buildComposerYaml());
+        }
+
         function clearError() {
             delete $scope.model.deployError;
         }
diff --git a/ui-modules/utils/quick-launch/quick-launch.less b/ui-modules/utils/quick-launch/quick-launch.less
index 22f3bbe..634fb1c 100644
--- a/ui-modules/utils/quick-launch/quick-launch.less
+++ b/ui-modules/utils/quick-launch/quick-launch.less
@@ -97,6 +97,7 @@ brooklyn-quick-launch {
 
   .quick-launch-actions {
     border-top: 1px solid @gray-lighter;
+    min-height: 90px;  // needed if only floating buttons are shown (eg pull-right success)
   }
 }
 


[brooklyn-ui] 05/06: This closes #140

Posted by he...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git

commit b7afa2ca495e09181f1dc9f408424d194783a6e8
Merge: 746ba8d ecdf6fa
Author: Alex Heneveld <al...@cloudsoftcorp.com>
AuthorDate: Mon Nov 18 15:28:23 2019 +0000

    This closes #140

 .../app/components/entity-tree/entity-node.html    |  5 +-
 .../app/components/entity-tree/entity-node.less    | 19 ++++++-
 .../entity-tree/entity-tree.directive.js           | 13 ++---
 .../main/inspect/summary/summary.controller.js     | 14 ++---
 .../app/views/main/inspect/summary/summary.less    | 32 ++++++++++--
 .../main/inspect/summary/summary.template.html     |  7 ++-
 .../catalog-saver/catalog-saver.directive.js       |  1 -
 ui-modules/blueprint-composer/app/index.less       |  7 ---
 .../app/views/main/main.controller.js              |  1 -
 ui-modules/catalog/app/index.less                  | 12 -----
 ui-modules/home/app/index.less                     |  6 ---
 ui-modules/utils/br-core/style/mixins.less         | 12 +++++
 ui-modules/utils/icon-generator/icon-generator.js  | 61 ++++++++++++++++++----
 13 files changed, 131 insertions(+), 59 deletions(-)


[brooklyn-ui] 06/06: This closes #142

Posted by he...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git

commit 95820f4ff402696648db8b12889cd5152ef2ee89
Merge: b7afa2c 09ad705
Author: Alex Heneveld <al...@cloudsoftcorp.com>
AuthorDate: Mon Nov 18 15:28:25 2019 +0000

    This closes #142

 .../app/views/main/deploy/deploy.controller.js     |  3 +-
 ui-modules/home/app/views/main/main.controller.js  |  7 ++++
 ui-modules/utils/quick-launch/quick-launch.html    |  3 +-
 ui-modules/utils/quick-launch/quick-launch.js      | 47 ++++++++++++++++++----
 ui-modules/utils/quick-launch/quick-launch.less    |  1 +
 5 files changed, 51 insertions(+), 10 deletions(-)