From 5cfe8490e3a20d25b76f03dbe9b8c8980e65159b Mon Sep 17 00:00:00 2001 From: Emmanuel Darnis Date: Tue, 19 Sep 2017 12:02:48 +0100 Subject: [PATCH 01/25] Add button to redirect to external app to create account --- .../dashboard-apps-dock/dashboard-apps-dock.coffee | 8 ++++++++ .../dashboard-apps-dock/dashboard-apps-dock.html | 3 +++ .../dashboard-apps-dock/dashboard-apps-dock.less | 2 ++ 3 files changed, 13 insertions(+) diff --git a/src/app/components/dashboard-apps-dock/dashboard-apps-dock.coffee b/src/app/components/dashboard-apps-dock/dashboard-apps-dock.coffee index 7cd2ff2d..2d9bacc8 100644 --- a/src/app/components/dashboard-apps-dock/dashboard-apps-dock.coffee +++ b/src/app/components/dashboard-apps-dock/dashboard-apps-dock.coffee @@ -37,6 +37,9 @@ DashboardAppsDockCtrl = ($scope, $cookies, $uibModal, $window, MnoeOrganizations instance.stack == 'connector' && !instance.oauth_keys_valid + $scope.helper.isCreateAccountShown = (instance) -> + instance.stack == 'cloud' && !instance.is_linked + $scope.helper.isNewOfficeApp = (instance) -> instance.stack == 'connector' && instance.appNid == 'office-365' && (moment(instance.createdAt) > moment().subtract({minutes:5})) @@ -55,6 +58,11 @@ DashboardAppsDockCtrl = ($scope, $cookies, $uibModal, $window, MnoeOrganizations $window.open("/mnoe/launch/#{app.uid}", '_blank') return true + $scope.redirectToExternal = (app, event) -> + $scope.setActiveApp(event, app.id) + $window.open(app.account_creation_link, '_blank') + return true + $scope.setActiveApp = (event, app) -> if $scope.isActiveApp(app) $scope.activeApp = null diff --git a/src/app/components/dashboard-apps-dock/dashboard-apps-dock.html b/src/app/components/dashboard-apps-dock/dashboard-apps-dock.html index 16b3ae84..de50c850 100644 --- a/src/app/components/dashboard-apps-dock/dashboard-apps-dock.html +++ b/src/app/components/dashboard-apps-dock/dashboard-apps-dock.html @@ -9,6 +9,9 @@
+ diff --git a/src/app/components/dashboard-apps-dock/dashboard-apps-dock.less b/src/app/components/dashboard-apps-dock/dashboard-apps-dock.less index acc11cd3..ff5fd05a 100755 --- a/src/app/components/dashboard-apps-dock/dashboard-apps-dock.less +++ b/src/app/components/dashboard-apps-dock/dashboard-apps-dock.less @@ -129,6 +129,8 @@ ul.dock { .menu-item { cursor: pointer; + white-space: nowrap; + &:hover { background-color: @mno-dock-sub-menu-hover; From 069ea8399d4f271c03ddbd3d355b24562cd53075 Mon Sep 17 00:00:00 2001 From: Emmanuel Darnis Date: Wed, 20 Sep 2017 14:56:48 +0100 Subject: [PATCH 02/25] Fetch setup form from mno enterprise --- .../dashboard-apps-dock.coffee | 30 ++++++++++++------- .../dashboard-apps-dock.html | 4 +-- .../mnoe-api/app-instances.svc.coffee | 3 ++ .../app-connect-modal-cloud.controller.coffee | 18 +++++++++++ .../apps/modals/app-connect-modal-cloud.html | 26 ++++++++++++++++ .../views/apps/modals/app-connect-modal.less | 4 +++ src/locales/en.json | 4 +++ 7 files changed, 76 insertions(+), 13 deletions(-) create mode 100644 src/app/views/apps/modals/app-connect-modal-cloud.controller.coffee create mode 100644 src/app/views/apps/modals/app-connect-modal-cloud.html diff --git a/src/app/components/dashboard-apps-dock/dashboard-apps-dock.coffee b/src/app/components/dashboard-apps-dock/dashboard-apps-dock.coffee index 2d9bacc8..7af38d89 100644 --- a/src/app/components/dashboard-apps-dock/dashboard-apps-dock.coffee +++ b/src/app/components/dashboard-apps-dock/dashboard-apps-dock.coffee @@ -33,9 +33,10 @@ DashboardAppsDockCtrl = ($scope, $cookies, $uibModal, $window, MnoeOrganizations $scope.helper.isNewOfficeApp(app) $scope.helper.isOauthConnectBtnShown = (instance) -> - instance.app_nid != 'office-365' && + (instance.app_nid != 'office-365' && instance.stack == 'connector' && - !instance.oauth_keys_valid + !instance.oauth_keys_valid) || + instance.stack == 'cloud' $scope.helper.isCreateAccountShown = (instance) -> instance.stack == 'cloud' && !instance.is_linked @@ -61,6 +62,7 @@ DashboardAppsDockCtrl = ($scope, $cookies, $uibModal, $window, MnoeOrganizations $scope.redirectToExternal = (app, event) -> $scope.setActiveApp(event, app.id) $window.open(app.account_creation_link, '_blank') + $scope.showConnectModal(app) return true $scope.setActiveApp = (event, app) -> @@ -95,16 +97,22 @@ DashboardAppsDockCtrl = ($scope, $cookies, $uibModal, $window, MnoeOrganizations # App Connect modal #==================================== $scope.showConnectModal = (app) -> - switch app.app_nid - when "xero" then modalInfo = { - template: "app/views/apps/modals/app-connect-modal-xero.html", - controller: 'DashboardAppConnectXeroModalCtrl' + if app.stack == 'cloud' + modalInfo = { + template: "app/views/apps/modals/app-connect-modal-cloud.html", + controller: 'DashboardAppConnectCloudModalCtrl' } - when "myob" then modalInfo = { - template: "app/views/apps/modals/app-connect-modal-myob.html", - controller: 'DashboardAppConnectMyobModalCtrl' - } - else $scope.helper.oAuthConnectPath(app) + else + switch app.app_nid + when "xero" then modalInfo = { + template: "app/views/apps/modals/app-connect-modal-xero.html", + controller: 'DashboardAppConnectXeroModalCtrl' + } + when "myob" then modalInfo = { + template: "app/views/apps/modals/app-connect-modal-myob.html", + controller: 'DashboardAppConnectMyobModalCtrl' + } + else $scope.helper.oAuthConnectPath(app) modalInstance = $uibModal.open( templateUrl: modalInfo.template diff --git a/src/app/components/dashboard-apps-dock/dashboard-apps-dock.html b/src/app/components/dashboard-apps-dock/dashboard-apps-dock.html index de50c850..a0dbfbc2 100644 --- a/src/app/components/dashboard-apps-dock/dashboard-apps-dock.html +++ b/src/app/components/dashboard-apps-dock/dashboard-apps-dock.html @@ -9,13 +9,13 @@
-