diff --git a/src/app/components/dashboard-company-selectbox/dashboard-company-selectbox.less b/src/app/components/dashboard-company-selectbox/dashboard-company-selectbox.less index 2fbfe600..7b97cca0 100644 --- a/src/app/components/dashboard-company-selectbox/dashboard-company-selectbox.less +++ b/src/app/components/dashboard-company-selectbox/dashboard-company-selectbox.less @@ -14,6 +14,10 @@ dashboard-company-selectbox { border-bottom: 1px solid @dashboard-cpy-select-border-color; z-index: 999; + @media (max-width: @screen-sm) { + border-radius: 0; + } + // Change company button .btn.switch-company { color: @dashboard-cpy-select-header-text-color; diff --git a/src/app/components/mnoe-api/organizations.svc.coffee b/src/app/components/mnoe-api/organizations.svc.coffee index 958b8843..7116f219 100644 --- a/src/app/components/mnoe-api/organizations.svc.coffee +++ b/src/app/components/mnoe-api/organizations.svc.coffee @@ -1,6 +1,6 @@ # Service for managing the users. angular.module 'mnoEnterpriseAngular' - .service 'MnoeOrganizations', ($state, $cookies, $log, $q, MnoeApiSvc, MnoeCurrentUser, toastr) -> + .service 'MnoeOrganizations', ($state, $cookies, $log, $q, MnoeApiSvc, MnoeCurrentUser) -> _self = @ organizationsApi = MnoeApiSvc.all('organizations') @@ -89,13 +89,9 @@ angular.module 'mnoEnterpriseAngular' @purchaseApp = (app, orgId = _self.selectedId) -> MnoeApiSvc.one('organizations', orgId).all('/app_instances').post({nid: app.nid}).then( (response) -> - toastr.success(app.name + " has been successfully added.") - # Change current organization if another one has been selected - organizationPromise = null _self.get(orgId) - (error) -> - toastr.error(app.name + " has not been added, please try again.") + response ) # Accept an array of invites diff --git a/src/app/components/theme-editor/theme-editor.html b/src/app/components/theme-editor/theme-editor.html index 44e8c353..c5a70ab5 100644 --- a/src/app/components/theme-editor/theme-editor.html +++ b/src/app/components/theme-editor/theme-editor.html @@ -7,7 +7,7 @@ -
+
@@ -49,7 +49,7 @@ -
+
diff --git a/src/app/stylesheets/variables.less b/src/app/stylesheets/variables.less index 47acf247..4c8a31df 100644 --- a/src/app/stylesheets/variables.less +++ b/src/app/stylesheets/variables.less @@ -152,7 +152,7 @@ @dashboard-account-tabs-text-color: @text-strong-color; @dashboard-account-panel-bg-color: @bg-inverse-color; @dashboard-account-panel-text-color: @text-strong-color; -@dashboard-account-inline-text-color-checked: @bg-inverse-color; +@dashboard-account-inline-text-color-checked: #33d375; @dashboard-account-inline-text-color-unchecked: @elem-cozy-color; /*-----------------------------------------------------------------------*/ diff --git a/src/app/views/apps/modals/app-deletion-modal.html b/src/app/views/apps/modals/app-deletion-modal.html index f754409d..0592473a 100644 --- a/src/app/views/apps/modals/app-deletion-modal.html +++ b/src/app/views/apps/modals/app-deletion-modal.html @@ -22,7 +22,7 @@
diff --git a/src/app/views/apps/modals/app-settings-modal.html b/src/app/views/apps/modals/app-settings-modal.html index 2807ae01..87ed030c 100755 --- a/src/app/views/apps/modals/app-settings-modal.html +++ b/src/app/views/apps/modals/app-settings-modal.html @@ -86,8 +86,8 @@

{{ 'mno_enterprise.templates.impac.dock.settings.confirm_app_deletion' | tra
-
diff --git a/src/app/views/company/settings/organization-settings.html b/src/app/views/company/settings/organization-settings.html index 69ae80d8..5e85a297 100644 --- a/src/app/views/company/settings/organization-settings.html +++ b/src/app/views/company/settings/organization-settings.html @@ -33,7 +33,7 @@ diff --git a/src/app/views/marketplace/marketplace-app.controller.coffee b/src/app/views/marketplace/marketplace-app.controller.coffee index e4e9f34e..39571203 100644 --- a/src/app/views/marketplace/marketplace-app.controller.coffee +++ b/src/app/views/marketplace/marketplace-app.controller.coffee @@ -2,8 +2,8 @@ # #============================================ angular.module 'mnoEnterpriseAngular' - .controller('DashboardMarketplaceAppCtrl', - ($q, $scope, $stateParams, $state, $sce, $window, MnoeMarketplace, $uibModal, MnoeOrganizations, MnoeCurrentUser, MnoeAppInstances, PRICING_CONFIG) -> + .controller('DashboardMarketplaceAppCtrl',($q, $scope, $stateParams, $state, $sce, $window, toastr, + MnoeMarketplace, $uibModal, MnoeOrganizations, MnoeCurrentUser, MnoeAppInstances, PRICING_CONFIG) -> vm = this @@ -17,6 +17,9 @@ angular.module 'mnoEnterpriseAngular' # An already installed app, conflicting with the app because it contains a common subcategory # that is not multi instantiable, if any vm.conflictingApp = null + # Enabling pricing + vm.isPriceShown = PRICING_CONFIG && PRICING_CONFIG.enabled + #==================================== # Scope Management #==================================== @@ -25,19 +28,15 @@ angular.module 'mnoEnterpriseAngular' vm.appInstance = appInstance vm.conflictingApp = conflictingApp vm.app.description = $sce.trustAsHtml(app.description) - vm.isLoading = false + plans = vm.app.pricing_plans currency = (PRICING_CONFIG && PRICING_CONFIG.currency) || 'AUD' vm.pricing_plans = plans[currency] || plans.AUD || plans.default # Get the user role in this organization - MnoeCurrentUser.get().then( - (response) -> - vm.user_role = _.find(response.organizations, {id: parseInt(MnoeOrganizations.selectedId)}).current_user_role - ) + MnoeOrganizations.get().then((response) -> vm.user_role = response.current_user.role) - vm.addApplication = -> - MnoeOrganizations.purchaseApp(vm.app, MnoeOrganizations.selectedId).then(-> $state.go('home.impac')) + vm.isLoading = false # Check that the testimonial is not empty vm.isTestimonialShown = (testimonial) -> @@ -62,18 +61,37 @@ angular.module 'mnoEnterpriseAngular' else "INSTALLABLE" - vm.provisionLink = () -> + vm.provisionApp = () -> + vm.isLoadingButton = true MnoeAppInstances.clearCache() # Get the authorization status for the current organization if MnoeOrganizations.role.atLeastPowerUser(vm.user_role) - vm.addApplication() + purchasePromise = MnoeOrganizations.purchaseApp(vm.app, MnoeOrganizations.selectedId) else # Open a modal to change the organization - vm.openChooseOrgaModal() + purchasePromise = openChooseOrgaModal().result + + purchasePromise.then( + -> + $state.go('home.impac') + toastr.success(vm.app.name + " has been successfully added.") + (error) -> + toastr.error(vm.app.name + " has not been added, please try again.") + MnoErrorsHandler.processServerError(error) + ).finally(-> vm.isLoadingButton = false) vm.launchAppInstance = -> $window.open("/mnoe/launch/#{vm.appInstance.uid}", '_blank') + openChooseOrgaModal = -> + $uibModal.open( + backdrop: 'static' + templateUrl: 'app/views/marketplace/modals/choose-orga-modal.html' + controller: 'MarketplaceChooseOrgaModalCtrl' + resolve: + app: vm.app + ) + #==================================== # App Connect modal #==================================== @@ -93,24 +111,9 @@ angular.module 'mnoEnterpriseAngular' templateUrl: modalInfo.template controller: modalInfo.controller resolve: - app: -> - vm.appInstance - ) - - #==================================== - # Choose App Modal - #==================================== - vm.openChooseOrgaModal = -> - $uibModal.open( - backdrop: 'static' - windowClass: 'inverse' - size: 'lg' - templateUrl: 'app/views/marketplace/modals/choose-orga-modal.html' - controller: 'MarketplaceChooseOrgaModalCtrl' + app: vm.appInstance ) - vm.isPriceShown = PRICING_CONFIG && PRICING_CONFIG.enabled - #==================================== # Cart Management #==================================== diff --git a/src/app/views/marketplace/marketplace-app.html b/src/app/views/marketplace/marketplace-app.html index d32994bc..e4eabf3a 100644 --- a/src/app/views/marketplace/marketplace-app.html +++ b/src/app/views/marketplace/marketplace-app.html @@ -43,7 +43,8 @@

{{vm.app.name}}

{{ 'mno_enterprise.templates.dashboard.marketplace.show.conflicting_app' | translate }} {{vm.conflictingApp.name}} - + +   {{ 'mno_enterprise.templates.dashboard.marketplace.show.start_app' | translate }} diff --git a/src/app/views/marketplace/modals/choose-orga-modal.coffee b/src/app/views/marketplace/modals/choose-orga-modal.coffee index 4edbcfdb..09c03b8e 100644 --- a/src/app/views/marketplace/modals/choose-orga-modal.coffee +++ b/src/app/views/marketplace/modals/choose-orga-modal.coffee @@ -1,5 +1,9 @@ angular.module 'mnoEnterpriseAngular' -.controller('MarketplaceChooseOrgaModalCtrl', ($scope, $uibModalInstance, MnoeOrganizations, MnoeCurrentUser) -> +.controller('MarketplaceChooseOrgaModalCtrl', ($scope, $uibModalInstance, MnoeOrganizations, MnoeCurrentUser, app) -> + + #==================================== + # Pre-Initialization + #==================================== # Initialize the main variables $scope.organizations = {} @@ -7,27 +11,16 @@ angular.module 'mnoEnterpriseAngular' $scope.authorized_organizations = {} # The organizations where the user can add apps $scope.hasAuthorizedOrganizations = false $scope.isLoading = true + $scope.app = app # Get the current organization id $scope.current_organization = { id: MnoeOrganizations.selectedId } - # Get the list of all the user organizations - MnoeCurrentUser.get().then( - (response) -> # Hash of organizations id -> {organization obj} - $scope.filterAuthorizedOrga(response.organizations) - $scope.hasAuthorizedOrganizations = !_.isEmpty($scope.authorized_organizations) - $scope.isLoading = false - ) - - # Filter the authorized organizations for this user - $scope.filterAuthorizedOrga = (organizations) -> - organizations.map( - (org) -> - $scope.organizations[org.id] = org - $scope.authorized_organizations[org.id] = org if MnoeOrganizations.role.atLeastPowerUser(org.current_user_role) - ) + #==================================== + # Scope Management + #==================================== # Check if the user is allowed to add apps to the given organization $scope.isUserAuthorized = (orgId) -> @@ -40,11 +33,38 @@ angular.module 'mnoEnterpriseAngular' # Add a new app instance to the current user organization $scope.addApplication = -> - MnoeOrganizations.purchaseApp($scope.app, $scope.current_organization.id).then(-> $state.go('home.impac')) + $scope.isLoading = true + MnoeOrganizations.purchaseApp($scope.app, $scope.current_organization.id).then( + (response) -> + $uibModalInstance.close(response) + ).finally(-> $scope.isLoading = false) # Close the current modal $scope.closeChooseOrgaModal = -> - $uibModalInstance.close() + $uibModalInstance.dismiss() + + #==================================== + # Private methods + #==================================== + + # Filter the authorized organizations for this user + filterAuthorizedOrga = (organizations) -> + _.forEach(organizations, (org) -> + $scope.organizations[org.id] = org + $scope.authorized_organizations[org.id] = org if MnoeOrganizations.role.atLeastPowerUser(org.current_user_role) + ) + + #==================================== + # Post-Initialization + #==================================== + + # Get the list of all the user organizations + MnoeCurrentUser.get().then( + (response) -> # Hash of organizations id -> {organization obj} + filterAuthorizedOrga(response.organizations) + $scope.hasAuthorizedOrganizations = !_.isEmpty($scope.authorized_organizations) + $scope.isLoading = false + ) return ) diff --git a/src/app/views/marketplace/modals/choose-orga-modal.html b/src/app/views/marketplace/modals/choose-orga-modal.html index f0467ef9..ba5bb470 100644 --- a/src/app/views/marketplace/modals/choose-orga-modal.html +++ b/src/app/views/marketplace/modals/choose-orga-modal.html @@ -2,54 +2,48 @@ + +