From 2274c86e9feb5bf11521d3fed1660e722f9ea11b Mon Sep 17 00:00:00 2001 From: Isaac Seessel Date: Thu, 12 Apr 2018 15:34:47 -0400 Subject: [PATCH 1/9] Change @getApps --- .../components/mnoe-api/marketplace.svc.coffee | 13 +------------ src/app/index.run.coffee | 4 +--- src/app/views/marketplace/marketplace.html | 6 +++--- src/app/views/marketplace/marketplace.less | 18 +++++++++--------- 4 files changed, 14 insertions(+), 27 deletions(-) diff --git a/src/app/components/mnoe-api/marketplace.svc.coffee b/src/app/components/mnoe-api/marketplace.svc.coffee index a084e6cf..a81019ba 100644 --- a/src/app/components/mnoe-api/marketplace.svc.coffee +++ b/src/app/components/mnoe-api/marketplace.svc.coffee @@ -27,7 +27,7 @@ angular.module 'mnoEnterpriseAngular' # Using this syntax will not trigger the data extraction in MnoeApiSvc # as the /marketplace payload isn't encapsulated in "{ marketplace: categories {...}, apps {...} }" marketplacePromises = [] - @getApps = -> + @getMarketplace = -> params = {organization_id: MnoeOrganizations.selectedId} paramsKey = JSON.stringify(params) return marketplacePromises[paramsKey] if marketplacePromises[paramsKey]? @@ -55,17 +55,6 @@ angular.module 'mnoEnterpriseAngular' _.find(response.products, (a) -> a.id == id || a.nid == nid) ) - localProductsPromise = [] - @getLocalProducts = (limit, offset, sort, params = {}) -> - params['organization_id'] = MnoeOrganizations.selectedId - params['where[local]'] = 'true' - paramsKey = JSON.stringify([limit, offset, sort, params]) - return localProductsPromise[paramsKey] if localProductsPromise[paramsKey]? - localProductsPromise[paramsKey] = MnoeApiSvc.all('products').getList(params).then( - (response) -> - _transform_products(response.plain()) - ) - @getProduct = (productId) -> MnoeApiSvc.one('/products', productId).get().then( (response) -> diff --git a/src/app/index.run.coffee b/src/app/index.run.coffee index ff0c1c4d..068a614f 100644 --- a/src/app/index.run.coffee +++ b/src/app/index.run.coffee @@ -81,9 +81,7 @@ angular.module 'mnoEnterpriseAngular' orgPromise = MnoeOrganizations.getCurrentOrganisation().then( (response) -> # Pre-load the marketplace, the products and the local products - MnoeMarketplace.getApps() - MnoeMarketplace.getProducts() if MnoeConfig.isProvisioningEnabled() - MnoeMarketplace.getLocalProducts() if MnoeConfig.areLocalProductsEnabled() + MnoeMarketplace.getMarketplace() # App instances needs to be run after fetching the organization (At least the first call) MnoeAppInstances.getAppInstances().then( diff --git a/src/app/views/marketplace/marketplace.html b/src/app/views/marketplace/marketplace.html index 26292f3f..fe613507 100644 --- a/src/app/views/marketplace/marketplace.html +++ b/src/app/views/marketplace/marketplace.html @@ -4,15 +4,15 @@

{{ 'mno_enterprise.templates.dashboard.marketplace.ind
{{ 'mno_enterprise.templates.dashboard.marketplace.index.applications' | translate }}
- +
mno_enterprise.templates.dashboard.marketplace.index.reseller_products
- +
- + diff --git a/src/app/views/marketplace/marketplace.less b/src/app/views/marketplace/marketplace.less index fcd15a6d..37b9f267 100644 --- a/src/app/views/marketplace/marketplace.less +++ b/src/app/views/marketplace/marketplace.less @@ -36,12 +36,12 @@ //------------------------------- // App Card //------------------------------- - .marketplace-app-card { + .marketplace-product-card { position: relative; background-color: @dashboard-marketplace-tile-bg-color; color: @dashboard-marketplace-tile-text-color; cursor: pointer; - @dashboard-marketplace-app-card(); + @dashboard-marketplace-product-card(); img.media-object { max-width: 100px; @@ -64,7 +64,7 @@ } } - .marketplace-app-card-checkbox { + .marketplace-product-card-checkbox { position: absolute; top: 0; left: 0; @@ -81,33 +81,33 @@ } // Application logo - .marketplace-app-card img.media-object { + .marketplace-product-card img.media-object { max-width: 100px; border: solid 1px @dashboard-marketplace-tile-img-border-color; border-radius: 5px; } - .marketplace-app-card:hover img.media-object { + .marketplace-product-card:hover img.media-object { border: solid 1px darken(@dashboard-marketplace-tile-hover-img-border-color,5%); } // Application Description - .marketplace-app-card .media-body { + .marketplace-product-card .media-body { padding-right: 10px; color: @dashboard-marketplace-tile-text-color; } - .marketplace-app-card:hover .media-body { + .marketplace-product-card:hover .media-body { color: @dashboard-marketplace-tile-hover-text-color; } // App tile arrow right - .marketplace-app-card .arrow { + .marketplace-product-card .arrow { position: absolute; right: 20px; top: 50px; color: @dashboard-marketplace-tile-hover-arrow-color; visibility: hidden; } - .marketplace-app-card:hover .arrow { + .marketplace-product-card:hover .arrow { visibility: visible; } } From 8fc3812173092aa78d69589b9d14eade621aa336 Mon Sep 17 00:00:00 2001 From: Isaac Seessel Date: Fri, 13 Apr 2018 13:53:01 -0400 Subject: [PATCH 2/9] [MNOE-1034] Get rid of local-products-listing in exchange for products-listing --- .../mno-local-product-listing.coffee | 31 ------------- .../mno-product-listing.coffee} | 45 ++++++++++--------- .../mno-product-listing.html} | 22 ++++----- .../mnoe-config/mnoe-config.svc.coffee | 6 +-- .../theme-editor.directive.coffee | 2 +- src/app/index.route.coffee | 14 +++--- src/app/stylesheets/variables.less | 4 +- src/app/views/public/landing/landing.html | 6 +-- src/app/views/public/public.less | 4 ++ src/locales/en.json | 8 ++-- 10 files changed, 58 insertions(+), 84 deletions(-) delete mode 100644 src/app/components/mno-local-products/mno-local-product-listing.coffee rename src/app/components/{mno-apps/mno-app-listing.coffee => mno-products/mno-product-listing.coffee} (65%) rename src/app/components/{mno-apps/mno-app-listing.html => mno-products/mno-product-listing.html} (84%) diff --git a/src/app/components/mno-local-products/mno-local-product-listing.coffee b/src/app/components/mno-local-products/mno-local-product-listing.coffee deleted file mode 100644 index 80c22a53..00000000 --- a/src/app/components/mno-local-products/mno-local-product-listing.coffee +++ /dev/null @@ -1,31 +0,0 @@ -# -# Mnoe Products -# - -angular.module 'mnoEnterpriseAngular' - .component('mnoLocalProductListing', { - templateUrl: 'app/components/mno-local-products/mno-local-product-listing.html', - bindings: { - isPublic: '@' - } - controller: (MnoeMarketplace, MnoeConfig) -> - vm = this - - #==================================== - # Initialization - #==================================== - vm.$onInit = -> - vm.publicPage = vm.isPublic == "true" - vm.productState = if vm.publicPage then "public.local_product" else "home.marketplace.local_product" - vm.isLoading = true - MnoeMarketplace.getApps().then( - (response) -> - if vm.publicPage - vm.products = _.filter(response.products, (product) -> product.local && _.includes(MnoeConfig.publicLocalProducts(), product.nid)) - else - vm.products = _.filter(response.products, 'local') - vm.isLoading = false - ) - - return - }) diff --git a/src/app/components/mno-apps/mno-app-listing.coffee b/src/app/components/mno-products/mno-product-listing.coffee similarity index 65% rename from src/app/components/mno-apps/mno-app-listing.coffee rename to src/app/components/mno-products/mno-product-listing.coffee index ae10f165..355ae14e 100644 --- a/src/app/components/mno-apps/mno-app-listing.coffee +++ b/src/app/components/mno-products/mno-product-listing.coffee @@ -1,8 +1,9 @@ angular.module 'mnoEnterpriseAngular' - .component('mnoAppListing', { - templateUrl: 'app/components/mno-apps/mno-app-listing.html', + .component('mnoProductListing', { + templateUrl: 'app/components/mno-products/mno-product-listing.html', bindings: { - isPublic: '@' + isPublic: '@', + isLocal: '<' } controller: ($scope, toastr, MnoeOrganizations, MnoeMarketplace, MnoeConfig) -> vm = this @@ -18,7 +19,7 @@ angular.module 'mnoEnterpriseAngular' vm.isMarketplaceCompare = MnoeConfig.isMarketplaceComparisonEnabled() vm.showCompare = false vm.nbAppsToCompare = 0 - vm.appState = if vm.publicPage then "public.product" else "home.marketplace.app" + vm.appState = if vm.publicPage then "public.product" else "home.marketplace.product" vm.displayAll = {label: "", active: 'active'} vm.selectedPublicCategory = vm.displayAll vm.initialize() @@ -26,7 +27,7 @@ angular.module 'mnoEnterpriseAngular' # Scope Management #==================================== - vm.appsFilter = (app) -> + vm.productsFilter = (app) -> vm.currentSelectedCategory = if vm.publicPage then vm.selectedPublicCategory.label else vm.selectedCategory if (vm.searchTerm? && vm.searchTerm.length > 0) || !vm.currentSelectedCategory return true @@ -43,40 +44,40 @@ angular.module 'mnoEnterpriseAngular' vm.showCompare = false # Uncheck all checkboxes - vm.uncheckAllApps = () -> - angular.forEach(vm.apps, (items) -> - items.toCompare = false + uncheckAllProducts = () -> + angular.forEach(vm.products, (product) -> + product.toCompare = false ) # Toggle compare block vm.enableComparison = -> - vm.nbAppsToCompare = 0 - vm.uncheckAllApps() + vm.nbProductsToCompare = 0 + uncheckAllProducts() vm.showCompare = true - vm.toggleAppToCompare = (app) -> - selected = app.toCompare - if selected && vm.nbAppsToCompare >= 4 + vm.toggleProductToCompare = (product) -> + selected = product.toCompare + if selected && vm.nbProductsToCompare >= 4 toastr.info("mno_enterprise.templates.dashboard.marketplace.index.toastr.error") - app.toCompare = false + product.toCompare = false else - vm.nbAppsToCompare += if selected then 1 else (-1) + vm.nbProductsToCompare += if selected then 1 else (-1) vm.canBeCompared = -> - return vm.nbAppsToCompare <= 4 && vm.nbAppsToCompare >=2 + return vm.nbProductsToCompare <= 4 && vm.nbProductsToCompare >=2 vm.initialize = -> vm.isLoading = true - MnoeMarketplace.getApps().then( + MnoeMarketplace.getMarketplace().then( (response) -> # Remove restangular decoration - response = response.plain() + vm.products = if vm.isLocal + _.filter(response.products, (product) -> product.local) + else + _.filter(response.products, (product) -> !product.local) - vm.categories = response.categories - vm.publicCategories = _.map(response.categories, (c) -> {label: c, active: ''}) - vm.apps = response.apps if vm.publicPage - vm.apps = _.filter(vm.apps, (app) -> _.includes(MnoeConfig.publicApplications(), app.nid)) + vm.products = _.filter(vm.products, (product) -> _.includes(MnoeConfig.publicProducts(), product.nid)) ).finally(-> vm.isLoading = false) $scope.$watch MnoeOrganizations.getSelectedId, (val) -> diff --git a/src/app/components/mno-apps/mno-app-listing.html b/src/app/components/mno-products/mno-product-listing.html similarity index 84% rename from src/app/components/mno-apps/mno-app-listing.html rename to src/app/components/mno-products/mno-product-listing.html index e0048454..b76e3311 100644 --- a/src/app/components/mno-apps/mno-app-listing.html +++ b/src/app/components/mno-products/mno-product-listing.html @@ -22,9 +22,9 @@ {{ 'mno_enterprise.templates.dashboard.marketplace.index.compare' | translate }}
-
{{'mno_enterprise.templates.dashboard.marketplace.index.select_apps' | translate }}
+
{{'mno_enterprise.templates.dashboard.marketplace.index.select_products' | translate }}
@@ -53,23 +53,23 @@
- -
-
+ +
+
- +
- +
-

{{::app.name}}

- {{::app.tiny_description}} +

{{::product.name}}

+ {{::product.tiny_description}}
diff --git a/src/app/components/mnoe-config/mnoe-config.svc.coffee b/src/app/components/mnoe-config/mnoe-config.svc.coffee index 498b6a15..42f76454 100644 --- a/src/app/components/mnoe-config/mnoe-config.svc.coffee +++ b/src/app/components/mnoe-config/mnoe-config.svc.coffee @@ -143,9 +143,9 @@ angular.module 'mnoEnterpriseAngular' else $log.debug("DASHBOARD_CONFIG.public_pricing.display_pricing missing") - @publicApplications = () -> - if DASHBOARD_CONFIG.public_pages?.applications? - DASHBOARD_CONFIG.public_pages.applications + @publicProducts = () -> + if DASHBOARD_CONFIG.public_pages?.products? + DASHBOARD_CONFIG.public_pages.products else $log.debug("DASHBOARD_CONFIG.public_pages.applications missing") [] diff --git a/src/app/components/theme-editor/theme-editor.directive.coffee b/src/app/components/theme-editor/theme-editor.directive.coffee index 12e03240..babe3f78 100644 --- a/src/app/components/theme-editor/theme-editor.directive.coffee +++ b/src/app/components/theme-editor/theme-editor.directive.coffee @@ -315,7 +315,7 @@ ThemeEditorCtrl = ($scope, $window, $log, $timeout, toastr, themeEditorSvc) -> '@dashboard-marketplace-show-sections-bg-color': '@bg-on-bg-inverse-color' '@dashboard-marketplace-show-sections-text-color': '@text-strong-color' - '@dashboard-marketplace-app-card': '{ display: block; padding: 10px; height: 120px; margin-bottom: 10px; font-weight: 300; }' + '@dashboard-marketplace-product-card': '{ display: block; padding: 10px; height: 120px; margin-bottom: 10px; font-weight: 300; }' }, 'Reviews & Comments Section': { diff --git a/src/app/index.route.coffee b/src/app/index.route.coffee index fe9a8cba..88d0e726 100644 --- a/src/app/index.route.coffee +++ b/src/app/index.route.coffee @@ -23,9 +23,9 @@ angular.module 'mnoEnterpriseAngular' .state 'public.product', data: pageTitle: "Product Preview" - url: '/product/:appId' - templateUrl: 'app/components/mno-apps/mno-app.html' - controller: 'mnoApp' + url: '/product/:productId' + templateUrl: 'app/components/mno-product/mno-product.html' + controller: 'mnoProduct' controllerAs: 'vm' resolve: { isPublic: -> true @@ -144,13 +144,13 @@ angular.module 'mnoEnterpriseAngular' templateUrl: 'app/views/marketplace/marketplace.html' controller: 'DashboardMarketplaceCtrl' controllerAs: 'vm' - .state 'home.marketplace.app', + .state 'home.marketplace.product', data: pageTitle:'Marketplace' - url: '^/marketplace/:appId' + url: '^/marketplace/:productId' views: '@home': - templateUrl: 'app/components/mno-apps/mno-app.html', - controller: 'mnoApp' + templateUrl: 'app/components/mno-products/mno-product.html', + controller: 'mnoProduct' controllerAs: 'vm' resolve: { isPublic: -> false diff --git a/src/app/stylesheets/variables.less b/src/app/stylesheets/variables.less index 03ee0e14..65dc0afe 100644 --- a/src/app/stylesheets/variables.less +++ b/src/app/stylesheets/variables.less @@ -71,7 +71,7 @@ @landing-marketplace-tile-hover-name-color: @landing-marketplace-tile-name-color; @landing-marketplace-tile-hover-img-border-color: darken(@landing-marketplace-tile-img-border-color,10%); @landing-marketplace-tile-hover-arrow-color: @text-strong-color; -@landing-marketplace-app-card: { display: block; padding: 10px; height: 120px; margin-bottom: 10px; font-weight: 300; }; +@landing-marketplace-product-card: { display: block; padding: 10px; height: 120px; margin-bottom: 10px; font-weight: 300; }; @public-marketplace-show-header-text-color: @text-strong-color; @public-marketplace-show-sections-bg-color: @bg-on-bg-inverse-color; @@ -398,7 +398,7 @@ @dashboard-marketplace-show-sections-bg-color: @bg-on-bg-inverse-color; @dashboard-marketplace-show-sections-text-color: @text-strong-color; -@dashboard-marketplace-app-card: { display: block; padding: 10px; height: 120px; margin-bottom: 10px; font-weight: 300; }; +@dashboard-marketplace-product-card: { display: block; padding: 10px; height: 120px; margin-bottom: 10px; font-weight: 300; }; @provisioning-breadcrumb-item-color: @text-strong-color; @provisioning-breadcrumb-item-badge-bg: @decorator-main-color; diff --git a/src/app/views/public/landing/landing.html b/src/app/views/public/landing/landing.html index 60b3d096..f7b95842 100644 --- a/src/app/views/public/landing/landing.html +++ b/src/app/views/public/landing/landing.html @@ -40,16 +40,16 @@
{{ 'mno_enterprise.templates.dashboard.marketplace.index.applications' | translate }}
- +
mno_enterprise.templates.dashboard.marketplace.index.reseller_products
- +
- +
diff --git a/src/app/views/public/public.less b/src/app/views/public/public.less index e7846144..bd06e331 100644 --- a/src/app/views/public/public.less +++ b/src/app/views/public/public.less @@ -209,6 +209,10 @@ margin-bottom: 25px; } + .marketplace-product-card { + @landing-marketplace-product-card(); + background-color: @landing-marketplace-tile-bg-color; + .local-marketplace-list { display: flex; flex-direction: row; diff --git a/src/locales/en.json b/src/locales/en.json index 30e6643b..6f9eb11f 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -744,11 +744,11 @@ "mno_enterprise.templates.dashboard.marketplace.index.applications": "Products", "mno_enterprise.templates.dashboard.marketplace.index.reseller_products": "{appname}'s products", "mno_enterprise.templates.dashboard.marketplace.index.search": "Search", - "mno_enterprise.templates.dashboard.marketplace.index.compare": "Compare application", - "mno_enterprise.templates.dashboard.marketplace.index.select_apps": "Compare up to 4 applications", - "mno_enterprise.templates.dashboard.marketplace.index.toastr.error": "You can only compare up to 4 applications.", + "mno_enterprise.templates.dashboard.marketplace.index.compare": "Compare products", + "mno_enterprise.templates.dashboard.marketplace.index.select_products": "Compare up to 4 products", + "mno_enterprise.templates.dashboard.marketplace.index.toastr.error": "You can only compare up to 4 products.", "mno_enterprise.templates.dashboard.marketplace.index.cancel": "Cancel", - "mno_enterprise.templates.dashboard.marketplace.index.compare_apps": "Compare", + "mno_enterprise.templates.dashboard.marketplace.index.compare_products": "Compare", "mno_enterprise.templates.dashboard.marketplace.show.back": "Back", "mno_enterprise.templates.dashboard.marketplace.show.start_app": "Start Now!", "mno_enterprise.templates.dashboard.marketplace.show.launch_app": "Launch app", From 31d3db3a0893ec6a23690c42d3099b2a72ca3d43 Mon Sep 17 00:00:00 2001 From: Isaac Seessel Date: Fri, 13 Apr 2018 18:06:32 -0400 Subject: [PATCH 3/9] [MNOE-1034]Add productId/appID to product url --- .../mno-products/mno-product-listing.coffee | 12 ++++++++++-- .../components/mno-products/mno-product-listing.html | 2 +- src/app/index.route.coffee | 4 ++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/app/components/mno-products/mno-product-listing.coffee b/src/app/components/mno-products/mno-product-listing.coffee index 355ae14e..c601ba66 100644 --- a/src/app/components/mno-products/mno-product-listing.coffee +++ b/src/app/components/mno-products/mno-product-listing.coffee @@ -18,10 +18,18 @@ angular.module 'mnoEnterpriseAngular' vm.searchTerm = '' vm.isMarketplaceCompare = MnoeConfig.isMarketplaceComparisonEnabled() vm.showCompare = false - vm.nbAppsToCompare = 0 - vm.appState = if vm.publicPage then "public.product" else "home.marketplace.product" + vm.nbProductsToCompare = 0 + vm.productState = if vm.publicPage then "public.product" else "home.marketplace.product" vm.displayAll = {label: "", active: 'active'} + vm.appOrProduct = (product) -> + if product.app_id + "({appId: '#{product.app_id}', productNid: '#{product.nid}'})" + else + "({productId: '#{product.id}', productNid: '#{product.nid}'})" + vm.productRef = (product) -> + vm.productState + vm.appOrProduct(product) vm.selectedPublicCategory = vm.displayAll + vm.initialize() #==================================== # Scope Management diff --git a/src/app/components/mno-products/mno-product-listing.html b/src/app/components/mno-products/mno-product-listing.html index b76e3311..c668faad 100644 --- a/src/app/components/mno-products/mno-product-listing.html +++ b/src/app/components/mno-products/mno-product-listing.html @@ -62,7 +62,7 @@ ng-model="product.toCompare">
- +
diff --git a/src/app/index.route.coffee b/src/app/index.route.coffee index 88d0e726..8a553c80 100644 --- a/src/app/index.route.coffee +++ b/src/app/index.route.coffee @@ -23,7 +23,7 @@ angular.module 'mnoEnterpriseAngular' .state 'public.product', data: pageTitle: "Product Preview" - url: '/product/:productId' + url: '/product/?productId?appId' templateUrl: 'app/components/mno-product/mno-product.html' controller: 'mnoProduct' controllerAs: 'vm' @@ -147,7 +147,7 @@ angular.module 'mnoEnterpriseAngular' .state 'home.marketplace.product', data: pageTitle:'Marketplace' - url: '^/marketplace/:productId' + url: '^/marketplace/?productNid?appId?productId' views: '@home': templateUrl: 'app/components/mno-products/mno-product.html', controller: 'mnoProduct' From 5cf0161872ffa49b33465df7b764cd376619cf74 Mon Sep 17 00:00:00 2001 From: Isaac Seessel Date: Tue, 17 Apr 2018 14:55:09 -0400 Subject: [PATCH 4/9] [MNOE-1034] Configure frontend for product#categories --- src/app/components/mno-products/mno-product-listing.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/app/components/mno-products/mno-product-listing.coffee b/src/app/components/mno-products/mno-product-listing.coffee index c601ba66..5c0e715c 100644 --- a/src/app/components/mno-products/mno-product-listing.coffee +++ b/src/app/components/mno-products/mno-product-listing.coffee @@ -79,6 +79,9 @@ angular.module 'mnoEnterpriseAngular' MnoeMarketplace.getMarketplace().then( (response) -> # Remove restangular decoration + response = response.plain() + + vm.categories = response.categories vm.products = if vm.isLocal _.filter(response.products, (product) -> product.local) else From 7ac8b6f65b1b74e6c79c9524606c0a22d38edd03 Mon Sep 17 00:00:00 2001 From: Isaac Seessel Date: Thu, 19 Apr 2018 17:04:06 -0400 Subject: [PATCH 5/9] [MNOE-1034] Configure local pages for products #values_attributes --- src/app/components/mno-products/mno-product-listing.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/components/mno-products/mno-product-listing.html b/src/app/components/mno-products/mno-product-listing.html index c668faad..13f030f4 100644 --- a/src/app/components/mno-products/mno-product-listing.html +++ b/src/app/components/mno-products/mno-product-listing.html @@ -69,7 +69,7 @@

{{::product.name}}

- {{::product.tiny_description}} + {{::product.values_attributes.tiny_description}}
From 9988f9cf021bba5e4304095bcfe33b1d2287e02e Mon Sep 17 00:00:00 2001 From: Isaac Seessel Date: Fri, 20 Apr 2018 13:04:44 -0400 Subject: [PATCH 6/9] [MNOE-1034]Replace mno-product with mno-app --- .../mno-products/mno-product-listing.coffee | 9 +- .../mno-product.coffee} | 85 +++++++++---------- .../mno-product.html} | 6 +- src/app/index.route.coffee | 4 +- src/app/views/public/public.less | 2 + 5 files changed, 48 insertions(+), 58 deletions(-) rename src/app/components/{mno-apps/mno-app.coffee => mno-products/mno-product.coffee} (88%) rename src/app/components/{mno-apps/mno-app.html => mno-products/mno-product.html} (98%) diff --git a/src/app/components/mno-products/mno-product-listing.coffee b/src/app/components/mno-products/mno-product-listing.coffee index 5c0e715c..5edfc509 100644 --- a/src/app/components/mno-products/mno-product-listing.coffee +++ b/src/app/components/mno-products/mno-product-listing.coffee @@ -21,14 +21,9 @@ angular.module 'mnoEnterpriseAngular' vm.nbProductsToCompare = 0 vm.productState = if vm.publicPage then "public.product" else "home.marketplace.product" vm.displayAll = {label: "", active: 'active'} - vm.appOrProduct = (product) -> - if product.app_id - "({appId: '#{product.app_id}', productNid: '#{product.nid}'})" - else - "({productId: '#{product.id}', productNid: '#{product.nid}'})" - vm.productRef = (product) -> - vm.productState + vm.appOrProduct(product) vm.selectedPublicCategory = vm.displayAll + vm.productRef = (product) -> + vm.productState + "({productId: '#{product.id}'})" vm.initialize() #==================================== diff --git a/src/app/components/mno-apps/mno-app.coffee b/src/app/components/mno-products/mno-product.coffee similarity index 88% rename from src/app/components/mno-apps/mno-app.coffee rename to src/app/components/mno-products/mno-product.coffee index b34d5fde..3e447a10 100644 --- a/src/app/components/mno-apps/mno-app.coffee +++ b/src/app/components/mno-products/mno-product.coffee @@ -1,6 +1,6 @@ angular.module 'mnoEnterpriseAngular' - .controller('mnoApp',($q, $scope, $stateParams, $state, $sce, $window, $uibModal, $anchorScroll, - $location, isPublic, parentState, toastr, MnoeMarketplace, MnoeOrganizations, MnoeCurrentUser, MnoeAppInstances, MnoConfirm, MnoeConfig, ProvisioningHelper) -> + .controller('mnoProduct',($q, $scope, $stateParams, $state, $sce, $window, $uibModal, $anchorScroll, + $location, isPublic, parentState, toastr, MnoeMarketplace, MnoeOrganizations, MnoeCurrentUser, MnoConfirm, MnoeConfig, ProvisioningHelper) -> vm = this #==================================== @@ -13,7 +13,7 @@ angular.module 'mnoEnterpriseAngular' vm.app = {} vm.searchWord = "" # The already installed app instance of the app, if any - vm.appInstance = null + vm.productInstalled = null # An already installed app, conflicting with the app because it contains a common subcategory # that is not multi instantiable, if any vm.conflictingApp = null @@ -37,44 +37,57 @@ angular.module 'mnoEnterpriseAngular' vm.pricedPlan = ProvisioningHelper.pricedPlan - getPricingPlans = (app) -> - if vm.isPriceShown - plans = vm.app.pricing_plans - currency = MnoeConfig.marketplaceCurrency() - vm.pricing_plans = plans[currency] || plans.AUD || plans.default - # Public initialization - app only, without considering reviews/org - MnoeMarketplace.getApps().then( - (response) -> - apps = response.apps + # MnoeMarketplace.getApps().then( + # (response) -> + # apps = response.apps + # + # # App to be displayed + # appId = $stateParams.appId + # vm.app = _.findWhere(apps, { nid: appId }) + # vm.app ||= _.findWhere(apps, { id: appId }) + # + # $state.go(parentState) unless vm.app? + # vm.isLoading = false + # ) - # App to be displayed - appId = $stateParams.appId - vm.app = _.findWhere(apps, { nid: appId }) - vm.app ||= _.findWhere(apps, { id: appId }) + #==================================== + # Pricings + #==================================== + # Return true if the plan has a dollar value + vm.pricedPlan = ProvisioningHelper.pricedPlan - # Init Pricing Plans - getPricingPlans(vm.app) + pricingPlans = (pricingPlans, currency) -> + _.map(pricingPlans, (pricingPlan) -> + return pricingPlan unless vm.pricedPlan(pricingPlan) + # If its a pricedPlan, only show prices of appropriate currency. + pricingPlans.prices = _.filter(pricingPlans.prices, (price) -> + price.currency == curency + ) - $state.go(parentState) unless vm.app? - vm.isLoading = false + pricingPlan ) #==================================== # Scope Management #==================================== - vm.initialize = (app, appInstance, product) -> + + vm.initialize = (product) -> # Variables initialization vm.userId = MnoeCurrentUser.user.id vm.adminRole = MnoeCurrentUser.user.admin_role # Init current app and app instance - vm.app = app - vm.appInstance = appInstance + vm.product = product + vm.productInstalled = !_.isEmpty(product.productInstances) # Is the product externally provisioned vm.isExternallyProvisioned = (vm.isProvisioningEnabled && product?.externally_provisioned) + # Init pricing plans + currency = MnoeConfig.marketplaceCurrency() + vm.pricing_plan = + # Get the user role in this organization MnoeOrganizations.get().then((response) -> vm.user_role = response.current_user.role) # Init initials reviews if enabled @@ -443,30 +456,10 @@ angular.module 'mnoEnterpriseAngular' if val? vm.isLoading = true - productPromise = if MnoeConfig.isProvisioningEnabled() then MnoeMarketplace.getProducts() else $q.resolve() - - # Retrieve the apps and if any the current app instance - $q.all( - marketplace: MnoeMarketplace.getApps(), - appInstances: MnoeAppInstances.getAppInstances(), - products: productPromise - ).then( + # Retrieve the product and if any the current product instance + MnoeMarketplace.getProduct($stateParams.productId).then( (response) -> - apps = response.marketplace.apps - appInstances = response.appInstances - products = response.products?.products - - # App to be displayed - appId = $stateParams.appId - app = _.findWhere(apps, { nid: appId }) - app ||= _.findWhere(apps, { id: appId }) - - $state.go(parentState) unless app? - - # Find if we already have it - appInstance = _.find(appInstances, { app_nid: app.nid }) - product = _.find(products, { nid: app.nid }) - vm.initialize(app, appInstance, product) + vm.initialize(response) ) return diff --git a/src/app/components/mno-apps/mno-app.html b/src/app/components/mno-products/mno-product.html similarity index 98% rename from src/app/components/mno-apps/mno-app.html rename to src/app/components/mno-products/mno-product.html index d2e8c731..866205ed 100644 --- a/src/app/components/mno-apps/mno-app.html +++ b/src/app/components/mno-products/mno-product.html @@ -137,13 +137,13 @@

{{ 'mno_enterprise.templates.dashboard.marketplace.show.price' | translate }
- + {{ 'mno_enterprise.templates.dashboard.marketplace.show.company_feedback' | translate }}: - + {{ 'mno_enterprise.templates.dashboard.marketplace.show.no_app_no_review' | translate }} @@ -292,7 +292,7 @@

{{ 'mno_enterprise.templates.dashboard.marketplace.show.price' | translate }

- + {{'mno_enterprise.templates.dashboard.marketplace.show.answer_q' | translate}} {{'mno_enterprise.templates.dashboard.marketplace.show.edit_q' | translate}} diff --git a/src/app/index.route.coffee b/src/app/index.route.coffee index 8a553c80..88d0e726 100644 --- a/src/app/index.route.coffee +++ b/src/app/index.route.coffee @@ -23,7 +23,7 @@ angular.module 'mnoEnterpriseAngular' .state 'public.product', data: pageTitle: "Product Preview" - url: '/product/?productId?appId' + url: '/product/:productId' templateUrl: 'app/components/mno-product/mno-product.html' controller: 'mnoProduct' controllerAs: 'vm' @@ -147,7 +147,7 @@ angular.module 'mnoEnterpriseAngular' .state 'home.marketplace.product', data: pageTitle:'Marketplace' - url: '^/marketplace/?productNid?appId?productId' + url: '^/marketplace/:productId' views: '@home': templateUrl: 'app/components/mno-products/mno-product.html', controller: 'mnoProduct' diff --git a/src/app/views/public/public.less b/src/app/views/public/public.less index bd06e331..9b07e989 100644 --- a/src/app/views/public/public.less +++ b/src/app/views/public/public.less @@ -139,6 +139,7 @@ } } + .show-content { .well { background-color: @public-marketplace-show-sections-bg-color; @@ -212,6 +213,7 @@ .marketplace-product-card { @landing-marketplace-product-card(); background-color: @landing-marketplace-tile-bg-color; + } .local-marketplace-list { display: flex; From 1f376709d9d0a5c50eee74680052ccca9f82b56c Mon Sep 17 00:00:00 2001 From: Isaac Seessel Date: Fri, 20 Apr 2018 13:17:58 -0400 Subject: [PATCH 7/9] [MNOE-1034]Move transform products to mnoe --- .../mnoe-api/marketplace.svc.coffee | 30 ++----------------- 1 file changed, 3 insertions(+), 27 deletions(-) diff --git a/src/app/components/mnoe-api/marketplace.svc.coffee b/src/app/components/mnoe-api/marketplace.svc.coffee index a81019ba..a29bba42 100644 --- a/src/app/components/mnoe-api/marketplace.svc.coffee +++ b/src/app/components/mnoe-api/marketplace.svc.coffee @@ -9,21 +9,6 @@ angular.module 'mnoEnterpriseAngular' .service 'MnoeMarketplace', ($log, MnoeApiSvc, MnoeOrganizations, MnoeFullApiSvc) -> _self = @ - _transform_products = (products) -> - _.map(products, (product) -> - # Transforms the values_attributes ([name: 'Some string', data: 'Its value']) - # to attributes (vm.product.some_string) - _.each(product.values_attributes, (v) -> - try - product[_.snakeCase(v.name)] = JSON.parse(v.data) - catch - product[_.snakeCase(v.name)] = v.data - ) - product.screenshots = _.map(product.assets_attributes, (a) -> a.url) - - product - ) - # Using this syntax will not trigger the data extraction in MnoeApiSvc # as the /marketplace payload isn't encapsulated in "{ marketplace: categories {...}, apps {...} }" marketplacePromises = [] @@ -31,11 +16,7 @@ angular.module 'mnoEnterpriseAngular' params = {organization_id: MnoeOrganizations.selectedId} paramsKey = JSON.stringify(params) return marketplacePromises[paramsKey] if marketplacePromises[paramsKey]? - marketplacePromises[paramsKey] = MnoeApiSvc.oneUrl('/marketplace').get(params).then( - (response) -> - response.products = _transform_products(response.products) - response - ) + marketplacePromises[paramsKey] = MnoeApiSvc.oneUrl('/marketplace').get(params) productsPromise = [] @getProducts = -> @@ -44,8 +25,7 @@ angular.module 'mnoEnterpriseAngular' return productsPromise[paramsKey] if productsPromise[paramsKey]? productsPromise[paramsKey] = MnoeApiSvc.oneUrl('/products').get(params).then( (response) -> - response.products = _transform_products(response.products) - response.plain() + response.plain().products ) # Find a product using its id or nid @@ -56,11 +36,7 @@ angular.module 'mnoEnterpriseAngular' ) @getProduct = (productId) -> - MnoeApiSvc.one('/products', productId).get().then( - (response) -> - _transform_products([response]) - response - ) + MnoeApiSvc.one('/products', productId).get() @getReview = (appId, reviewId) -> MnoeApiSvc.one('marketplace', appId).one('app_reviews', parseInt(reviewId)).get() From e20593f156f1662d173487cc16decfd9cb63e120 Mon Sep 17 00:00:00 2001 From: Isaac Seessel Date: Fri, 20 Apr 2018 15:30:05 -0400 Subject: [PATCH 8/9] [MNOE-1034] Setup page for product pricings --- .../mno-products/mno-product-listing.html | 2 +- .../mno-products/mno-product.coffee | 16 ++++++++----- .../components/mno-products/mno-product.html | 24 ++++++++----------- .../mnoe-api/marketplace.svc.coffee | 3 +-- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/src/app/components/mno-products/mno-product-listing.html b/src/app/components/mno-products/mno-product-listing.html index 13f030f4..76fd4b04 100644 --- a/src/app/components/mno-products/mno-product-listing.html +++ b/src/app/components/mno-products/mno-product-listing.html @@ -9,7 +9,7 @@
-
+
diff --git a/src/app/components/mno-products/mno-product.coffee b/src/app/components/mno-products/mno-product.coffee index 3e447a10..d83d5d02 100644 --- a/src/app/components/mno-products/mno-product.coffee +++ b/src/app/components/mno-products/mno-product.coffee @@ -57,17 +57,20 @@ angular.module 'mnoEnterpriseAngular' # Return true if the plan has a dollar value vm.pricedPlan = ProvisioningHelper.pricedPlan - pricingPlans = (pricingPlans, currency) -> - _.map(pricingPlans, (pricingPlan) -> + vm.pricingPlans = () -> + _.map(vm.product.pricing_plans, (pricingPlan) -> return pricingPlan unless vm.pricedPlan(pricingPlan) # If its a pricedPlan, only show prices of appropriate currency. - pricingPlans.prices = _.filter(pricingPlans.prices, (price) -> - price.currency == curency + pricingPlan.prices = _.filter(pricingPlan.prices, (price) -> + price.currency == vm.currency ) pricingPlan ) + vm.showNoPricingFound = (plan) -> + _.isEmpty(plan.prices) && vm.pricedPlan(plan) + #==================================== # Scope Management #==================================== @@ -85,8 +88,9 @@ angular.module 'mnoEnterpriseAngular' vm.isExternallyProvisioned = (vm.isProvisioningEnabled && product?.externally_provisioned) # Init pricing plans - currency = MnoeConfig.marketplaceCurrency() - vm.pricing_plan = + vm.currency = MnoeConfig.marketplaceCurrency() + vm.pricing_plans = vm.pricingPlans() + # Get the user role in this organization MnoeOrganizations.get().then((response) -> vm.user_role = response.current_user.role) diff --git a/src/app/components/mno-products/mno-product.html b/src/app/components/mno-products/mno-product.html index 866205ed..0007cf4d 100644 --- a/src/app/components/mno-products/mno-product.html +++ b/src/app/components/mno-products/mno-product.html @@ -110,21 +110,17 @@

{{vm.app.name}}

{{ 'mno_enterprise.templates.dashboard.marketplace.show.price' | translate }}

    -
  • - {{ 'mno_enterprise.templates.dashboard.marketplace.show.free_trial_duration' | translate }}: {{vm.app.free_trial_duration}} {{vm.app.free_trial_unit}} +
  • + {{ 'mno_enterprise.templates.dashboard.marketplace.show.free_trial_duration' | translate }}: {{vm.product.free_trial_duration}} {{vm.product.free_trial_unit}}
  • -
  • - {{plan.name}}: {{plan.description}} -
    -
    - {{plan.currency}} - {{plan.price.value}} - {{plan.price}} - {{plan.factor}} -
    -
    - {{ 'mno_enterprise.templates.dashboard.marketplace.show.pricing.payg' | translate }} -
    +
  • + {{plan.name}}: {{plan.description}}
    + {{ 'mno_enterprise.templates.dashboard.marketplace.show.no_pricing_found' | translate }} + + {{price.currency}} {{price.price_cents / 100}} + / {{plan.per_unit}} / {{plan.per_duration}} + + {{'mno_enterprise.templates.dashboard.marketplace.show.pricing.payg' | translate}}
diff --git a/src/app/components/mnoe-api/marketplace.svc.coffee b/src/app/components/mnoe-api/marketplace.svc.coffee index a29bba42..8816771b 100644 --- a/src/app/components/mnoe-api/marketplace.svc.coffee +++ b/src/app/components/mnoe-api/marketplace.svc.coffee @@ -1,7 +1,6 @@ # Service for the listing of Apps on the Markeplace # MnoeMarketplace.getList() -# .getApps() # => GET /mnoe/jpi/v1/marketplace # Return the list off apps and categories # {categories: [], apps: []} @@ -36,7 +35,7 @@ angular.module 'mnoEnterpriseAngular' ) @getProduct = (productId) -> - MnoeApiSvc.one('/products', productId).get() + MnoeApiSvc.one('/products', productId).get().then((response) -> response.plain()) @getReview = (appId, reviewId) -> MnoeApiSvc.one('marketplace', appId).one('app_reviews', parseInt(reviewId)).get() From 45f22c446c4c81b4a21ed42c014e8cfed6a1f588 Mon Sep 17 00:00:00 2001 From: Isaac Seessel Date: Mon, 23 Apr 2018 12:02:04 -0400 Subject: [PATCH 9/9] [MNOE-1034] Change product attributes --- .../components/mno-products/mno-product.html | 32 +++++-------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/src/app/components/mno-products/mno-product.html b/src/app/components/mno-products/mno-product.html index 0007cf4d..e1b0e918 100644 --- a/src/app/components/mno-products/mno-product.html +++ b/src/app/components/mno-products/mno-product.html @@ -8,10 +8,10 @@
- +
-

{{vm.app.name}}

+

{{vm.product.name}}

@@ -50,26 +50,10 @@

{{vm.app.name}}

-
-
-
    -
  • - {{ 'mno_enterprise.templates.dashboard.marketplace.show.tag_responsive' | translate }} -
  • -
  • - {{ 'mno_enterprise.templates.dashboard.marketplace.show.tag_star' | translate }} -
  • -
  • - {{ 'mno_enterprise.templates.dashboard.marketplace.show.tag_connec' | translate }} -
  • -
-
-
-
    -
  • +
  • {{benefit}}
  • @@ -100,7 +84,7 @@

    {{vm.app.name}}

    -
    +
    @@ -113,7 +97,7 @@

    {{ 'mno_enterprise.templates.dashboard.marketplace.show.price' | translate }
  • {{ 'mno_enterprise.templates.dashboard.marketplace.show.free_trial_duration' | translate }}: {{vm.product.free_trial_duration}} {{vm.product.free_trial_unit}}
  • -
  • +
  • {{plan.name}}: {{plan.description}}
    {{ 'mno_enterprise.templates.dashboard.marketplace.show.no_pricing_found' | translate }} @@ -123,7 +107,7 @@

    {{ 'mno_enterprise.templates.dashboard.marketplace.show.price' | translate } {{'mno_enterprise.templates.dashboard.marketplace.show.pricing.payg' | translate}}

-
+
@@ -158,7 +142,7 @@

{{ 'mno_enterprise.templates.dashboard.marketplace.show.price' | translate }

- + mno_enterprise.templates.dashboard.marketplace.show.no_review
@@ -266,7 +250,7 @@

{{ 'mno_enterprise.templates.dashboard.marketplace.show.price' | translate }

- + mno_enterprise.templates.dashboard.marketplace.show.question.no_question