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

[brooklyn-ui] branch fix/smart-188 created (now ed599f7)

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

iuliana pushed a change to branch fix/smart-188
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git.


      at ed599f7  Added fix that does not pollute validation

This branch includes the following new commits:

     new ed599f7  Added fix that does not pollute validation

The 1 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.


[brooklyn-ui] 01/01: Added fix that does not pollute validation

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

iuliana pushed a commit to branch fix/smart-188
in repository https://gitbox.apache.org/repos/asf/brooklyn-ui.git

commit ed599f73ed7c9ec16ed41971b9bc1b9115e474cb
Author: iuliana <iu...@cloudsoft.io>
AuthorDate: Fri Jun 4 14:47:52 2021 +0100

    Added fix that does not pollute validation
---
 .../catalog-saver/catalog-saver.directive.js       | 32 ++++++++++++----------
 .../catalog-saver.modal.template.html              |  2 +-
 2 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
index 052a97b..3acc373 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
+++ b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.directive.js
@@ -70,24 +70,24 @@ export function saveToCatalogModalDirective($rootScope, $uibModal, $injector, $f
         $scope.isNewFromTemplate = () => ($scope.config.itemType !== 'template' && $scope.config.original.itemType === 'template');
         $scope.isUpdate = () => !$scope.isNewFromTemplate() && Object.keys($scope.config.original).length>0;
         $scope.buttonTextFn = () => $scope.config.label || ($scope.isUpdate() && ($scope.config.name || $scope.config.original.name || $scope.config.symbolicName || $scope.config.original.symbolicName)) || 'Add to catalog';
-        $scope.buttonText = $scope.buttonTextFn(); 
-        
+        $scope.buttonText = $scope.buttonTextFn();
+
         $scope.activateModal = () => {
             let entity = blueprintService.get();
             let metadata = blueprintService.entityHasMetadata(entity) ? blueprintService.getEntityMetadata(entity) : new Map();
-              
+
             if (!$scope.config.itemType) {
                 // This is the default item type
                 $scope.config.itemType = 'application';
             }
-            
+
             // Set various properties from the blueprint entity data if not already set
             if (!$scope.config.iconUrl && (entity.hasIcon() || metadata.has('iconUrl'))) {
                 $scope.config.iconUrl = entity.icon || metadata.get('iconUrl');
             }
             if (!$scope.isNewFromTemplate()) {
                 // (these should only be set if not making something new from a template, as the entity items will refer to the template)
-                
+
                 // the name and the ID can be set in the UI, 
                 // or all can be inherited if root node is a known application type we are editting 
                 // (normally in those cases $scope.config will already be set by caller, but maybe not always) 
@@ -101,13 +101,12 @@ export function saveToCatalogModalDirective($rootScope, $uibModal, $injector, $f
                     $scope.config.version = entity.version || metadata.get('version');
                 }
                 if (!$scope.config.bundle) {
-                    if (!$scope.config.symbolicName) {
-                        $scope.config.symbolicName =  $scope.config.name;
+                    if ($scope.config.symbolicName) {
+                        $scope.config.bundle = $scope.config.symbolicName;
                     }
-                    $scope.config.bundle = $scope.config.symbolicName;
                 }
             }
-            
+
             // Override this callback to update configuration data elsewhere
             $scope.config = (composerOverrides.updateCatalogConfig || ((config, $element) => config))($scope.config, $element);
 
@@ -117,7 +116,7 @@ export function saveToCatalogModalDirective($rootScope, $uibModal, $injector, $f
                 controller: ['$scope', '$filter', 'blueprintService', 'paletteApi', 'brUtilsGeneral', CatalogItemModalController],
                 scope: $scope,
             });
-            
+
             // Promise is resolved when the modal is closed. We expect the modal to pass back the action to perform thereafter
             modalInstance.result.then(reason => {
                 switch (reason) {
@@ -143,6 +142,8 @@ export function CatalogItemModalController($scope, $filter, blueprintService, pa
         saving: false,
         force: false,
     };
+    $scope.catalogBundleId ="";
+    $scope.catalogBundleBase ="";
 
     $scope.getTitle = () => {
         switch ($scope.state.view) {
@@ -180,7 +181,7 @@ export function CatalogItemModalController($scope, $filter, blueprintService, pa
         if (!bundleBase || !bundleId) {
             throw "Either the display name must be set, or the bundle and symbolic name must be explicitly set";
         }
-        
+
         let bomItem = {
             id: bundleId,
             itemType: $scope.config.itemType,
@@ -201,7 +202,8 @@ export function CatalogItemModalController($scope, $filter, blueprintService, pa
         if (brUtilsGeneral.isNonEmpty($scope.config.iconUrl)) {
             bomItem.iconUrl = $scope.config.iconUrl;
         }
-        
+        $scope.catalogBundleId = bundleId;
+        $scope.catalogBundleBase = bundleBase;
         return jsYaml.dump({ 'brooklyn.catalog': bomCatalogYaml });
     }
 
@@ -274,7 +276,7 @@ export function catalogVersionDirective($parse) {
 
         ctrl.$validators.exist = (modelValue, viewValue) => {
             return !angular.isDefined(matches) || ctrl.$isEmpty(viewValue) || viewValue.endsWith('SNAPSHOT') || force === true || matches.indexOf(viewValue) === -1;
-        };        
+        };
     }
 }
 
@@ -283,6 +285,6 @@ function templateCache($templateCache) {
     $templateCache.put(TEMPLATE_MODAL_URL, modalTemplate);
 }
 
-function bundlizeProvider() { 
-    return (input) => input && input.split(/[^a-zA-Z0-9]+/).filter(x => x).join('-').toLowerCase(); 
+function bundlizeProvider() {
+    return (input) => input && input.split(/[^a-zA-Z0-9]+/).filter(x => x).join('-').toLowerCase();
 }
diff --git a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.modal.template.html b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.modal.template.html
index 1fc7de9..6b8898d 100644
--- a/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.modal.template.html
+++ b/ui-modules/blueprint-composer/app/components/catalog-saver/catalog-saver.modal.template.html
@@ -122,7 +122,7 @@
             <p>What would you like to do next?</p>
             <button class="btn btn-default btn-block" ng-click="$dismiss('Continue editing')">Continue to edit this blueprint</button>
             <button class="btn btn-info btn-block" ng-click="$close(REASONS.new)">Create a new blueprint</button>
-            <a class="btn btn-primary btn-block" ng-href="/brooklyn-ui-catalog/#!/bundles/catalog-bom-{{config.bundle}}/{{config.version}}/types/{{config.symbolicName}}/{{config.version}}">View in catalog</a>
+            <a class="btn btn-primary btn-block" ng-href="/brooklyn-ui-catalog/#!/bundles/catalog-bom-{{catalogBundleId}}/{{config.version}}/types/{{catalogBundleBase}}/{{config.version}}">View in catalog</a>
             <button ng-if="['template', 'entity'].indexOf(config.itemType) > -1" class="btn btn-link btn-block" ng-click="$close(REASONS.deploy)">Or deploy</button>
         </div>
     </div>