You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by du...@apache.org on 2020/12/09 10:55:40 UTC

[brooklyn-ui] branch master updated: Add support for downloading bundle as ZIP files

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 54e4ea0  Add support for downloading bundle as ZIP files
     new 5419f66  Merge pull request #178 from tbouron/feature/download-bundle
54e4ea0 is described below

commit 54e4ea0515567e6d967e49fa0b372c2e3f4b2d25
Author: Thomas Bouron <th...@cloudsoftcorp.com>
AuthorDate: Thu Dec 3 10:15:22 2020 +0000

    Add support for downloading bundle as ZIP files
---
 ui-modules/catalog/app/views/bundle/bundle.state.js      | 4 ++++
 ui-modules/catalog/app/views/bundle/bundle.template.html | 3 +++
 ui-modules/utils/providers/catalog-api.provider.js       | 7 +++++++
 3 files changed, 14 insertions(+)

diff --git a/ui-modules/catalog/app/views/bundle/bundle.state.js b/ui-modules/catalog/app/views/bundle/bundle.state.js
index 8323050..22ccaf0 100644
--- a/ui-modules/catalog/app/views/bundle/bundle.state.js
+++ b/ui-modules/catalog/app/views/bundle/bundle.state.js
@@ -84,6 +84,10 @@ export function bundleController($scope, $state, $stateParams, brSnackbar, brUti
         });
     };
 
+    $scope.downloadBundle = () => {
+        return catalogApi.downloadBundle($scope.bundle.symbolicName, $scope.bundle.version, {urlOnly: true});
+    }
+
     $scope.isNonEmpty = (o) => {
         return brUtilsGeneral.isNonEmpty(o);
     };
diff --git a/ui-modules/catalog/app/views/bundle/bundle.template.html b/ui-modules/catalog/app/views/bundle/bundle.template.html
index 90f62da..47c7683 100644
--- a/ui-modules/catalog/app/views/bundle/bundle.template.html
+++ b/ui-modules/catalog/app/views/bundle/bundle.template.html
@@ -37,6 +37,9 @@
                                     </li>
                                 </ul>
                             </div>
+                            <a class="btn btn-sm btn-default" ng-href="{{downloadBundle()}}">
+                                <i class="fa fa-fw fa-download"></i> Download
+                            </a>
                         </h4>
                         <p class="media-auto-wrap text-muted" ng-if="bundle.symbolicName.startsWith('brooklyn-catalog-bom')"><small>
                             <i class="fa fa-fw fa-info-circle"></i> Bundle auto-generated from an uploaded BOM file
diff --git a/ui-modules/utils/providers/catalog-api.provider.js b/ui-modules/utils/providers/catalog-api.provider.js
index f223123..cb4d404 100644
--- a/ui-modules/utils/providers/catalog-api.provider.js
+++ b/ui-modules/utils/providers/catalog-api.provider.js
@@ -188,4 +188,11 @@ class CatalogApiProvider extends CatalogApi {
             .catch(new ErrorHandler(deferred));
         return deferred.promise;
     }
+
+    downloadBundle(bundleSymbolicName, bundleVersion, config) {
+        const url = `${this.host}/v1/catalog/bundles/${bundleSymbolicName}/${bundleVersion}/download`;
+        return config.urlOnly === true
+            ? url
+            : this.$http.get(`${this.host}/v1/catalog/bundles/${bundleSymbolicName}/${bundleVersion}/download`, angular.extend({}, config));
+    }
 }