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 5e2cd412618ebb2ae6535e340cc43c29e2108d56
Author: iuliana <[email protected]>
AuthorDate: Wed Jun 9 15:37:31 2021 +0100

    Added a fix that works every time :)
---
 .../components/catalog-saver/catalog-saver.directive.js  | 16 ++++++++++++----
 .../catalog-saver/catalog-saver.modal.template.html      |  2 +-
 2 files changed, 13 insertions(+), 5 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 947fc1e..a53c3a2 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
@@ -146,8 +146,6 @@ export function CatalogItemModalController($scope, $filter, 
blueprintService, pa
         saving: false,
         force: false,
     };
-    $scope.catalogBundleId ="";
-    $scope.catalogBundleBase ="";
 
     $scope.getTitle = () => {
         switch ($scope.state.view) {
@@ -157,6 +155,15 @@ export function CatalogItemModalController($scope, 
$filter, blueprintService, pa
                 return `${$scope.config.name || $scope.config.symbolicName || 
'Blueprint'} ${$scope.isUpdate() ? 'updated' : 'saved'}`;
         }
     };
+    $scope.getCatalogURL = () => {
+        switch ($scope.state.view) {
+            case VIEWS.form:
+                return '';
+            case VIEWS.saved:
+                return 
`/brooklyn-ui-catalog/#!/bundles/catalog-bom-${$scope.config.catalogBundleId}/${$scope.config.version}/types/${$scope.config.catalogBundleBase}/${$scope.config.version}`;
+        }
+    };
+
     $scope.title = $scope.getTitle();
 
     $scope.save = () => {
@@ -170,6 +177,7 @@ export function CatalogItemModalController($scope, $filter, 
blueprintService, pa
             }
             $scope.config.versions.push($scope.config.version);
             $scope.state.view = VIEWS.saved;
+            $scope.catalogURL = $scope.getCatalogURL();
         }).catch(error => {
             $scope.state.error = error.error.message;
         }).finally(() => {
@@ -206,8 +214,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;
+        $scope.config.catalogBundleId = bundleId;
+        $scope.config.catalogBundleBase = bundleBase;
         return jsYaml.dump({ 'brooklyn.catalog': bomCatalogYaml });
     }
 
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 6b8898d..893769b 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-{{catalogBundleId}}/{{config.version}}/types/{{catalogBundleBase}}/{{config.version}}">View
 in catalog</a>
+            <a class="btn btn-primary btn-block" 
ng-href="{{getCatalogURL()}}">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>

Reply via email to