Skip to content

Commit

Permalink
Add previous next when linking account
Browse files Browse the repository at this point in the history
  • Loading branch information
manu-d committed Feb 5, 2018
1 parent 3b1f44b commit 0ecb52b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 14 deletions.
21 changes: 21 additions & 0 deletions src/app/components/connect-addon-modal/connect-addon-modal.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,27 @@ angular.module('mnoEnterpriseAngular').component('connectAddonModal', {
ctrl.isUpdating = false
)

ctrl.backClick = ->
switch ctrl.currentStep
when 1 then ctrl.disconnect()
when 2 then ctrl.unselectEntities()

ctrl.nextClick = ->
switch ctrl.currentStep
when 0 then ctrl.submitForm()
when 1 then ctrl.updateEntities()
when 2 then ctrl.synchronize(ctrl.historicalData)

ctrl.disconnect = ->
ctrl.isDisconnecting = true
MnoeAppInstances.disconnect(ctrl.app)
.then((response) ->
ctrl.app.addon_organization.has_account_linked = false
ctrl.app.addon_organization.sync_enabled = false
ctrl.currentStep = 0
ctrl.isDisconnecting = false
)

ctrl.synchronize = (historicalData) ->
MnoeAppInstances.sync(ctrl.app, historicalData)
ctrl.app.addon_organization.sync_enabled = true
Expand Down
26 changes: 14 additions & 12 deletions src/app/components/connect-addon-modal/connect-addon-modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,19 @@ <h4 class="text-center">{{"mno_enterprise.templates.components.addon_connect.syn
</div>

<div class="modal-footer">
<button class="btn btn-default" ng-click="$ctrl.close()">{{"mno_enterprise.webhook.o_auth.providers.cancel" | translate}}</button>
<button class="btn btn-success" ng-show="$ctrl.currentStep == 0" ng-disabled="$ctrl.isSubmitting" ng-click="$ctrl.submitForm()">
{{'mno_enterprise.templates.components.addon_connect.link_account.submit_form' | translate}}
<i class="fa fa-refresh fa-spin" ng-if="$ctrl.isSubmitting"></i>
</button>
<button class="btn btn-success" ng-show="$ctrl.currentStep == 1" ng-disabled="$ctrl.isUpdating" ng-click="$ctrl.updateEntities()">
{{'mno_enterprise.templates.components.addon_connect.entities.update_entities' | translate}}
<i class="fa fa-refresh fa-spin" ng-if="$ctrl.isUpdating"></i>
</button>
<button class="btn btn-success" ng-show="$ctrl.currentStep == 2" ng-click="$ctrl.synchronize(ctrl.historicalData)">
{{'mno_enterprise.templates.components.addon_connect.sync.start_sync' | translate}}
</button>
<div class="btn-toolbar">
<button class="btn btn-default" ng-click="$ctrl.close()">{{"mno_enterprise.webhook.o_auth.providers.cancel" | translate}}</button>
<div class="pull-right">
<button class="btn btn-warning" ng-if="$ctrl.currentStep != 0" ng-click="$ctrl.backClick()" ng-disabled="$ctrl.isDisconnecting">
<i class="fa fa-arrow-left"></i>
{{"mno_enterprise.templates.components.addon_connect.back" | translate"}}
</button>
<button class="btn btn-success" ng-click="$ctrl.nextClick()" ng-disabled="$ctrl.isSubmitting || $ctrl.isUpdating">
{{"mno_enterprise.templates.components.addon_connect.next" | translate"}}
<i class="fa fa-arrow-right"></i>
<i class="fa fa-refresh fa-spin" ng-if="$ctrl.isSubmitting || $ctrl.isUpdating"></i>
</button>
</div>
</div>
</div>
</div>
2 changes: 1 addition & 1 deletion src/app/views/apps/modals/app-settings-modal.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ angular.module 'mnoEnterpriseAngular'
template: htmlTemplate
}

$scope.loadIdMaps = (externalName, input = null) ->
$scope.loadIdMaps = (externalName = 'All', input = null) ->
$scope.idMaps.loading = true
$scope.idMaps.entityName = externalName
params = {
Expand Down
2 changes: 1 addition & 1 deletion src/app/views/apps/modals/app-settings-modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h4 class="text-center" style="margin-bottom: 20px; margin-top: 20px">{{ 'mno_en
</div>
</uib-tab>

<uib-tab index="1" heading="{{'mno_enterprise.templates.impac.dock.settings.id_maps.title' | translate}}" select="selectData()">
<uib-tab index="1" heading="{{'mno_enterprise.templates.impac.dock.settings.id_maps.title' | translate}}" select="selectData()" ng-click="loadIdMaps()">
<div>
<mno-sortable-table row-collection="idMaps.list" fields="mnoIdMapsTableFields" sub-headers="mnoIdMapsSubHeaders" is-loading="idMaps.loading" pipe="sortableIdMapsServerPipe"></mno-sortable-table>
<div class="pagination">
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -943,6 +943,8 @@
"mno_enterprise.templates.components.without_organisation.button": "Create an organisation",
"mno_enterprise.templates.components.without_organisation.logout": "Logout",
"mno_enterprise.templates.components.addon_connect.title": "Connect to {appname}",
"mno_enterprise.templates.components.addon_connect.back": "Back",
"mno_enterprise.templates.components.addon_connect.next": "Next",
"mno_enterprise.templates.components.addon_connect.link_account.title": "Link your account",
"mno_enterprise.templates.components.addon_connect.link_account.link": "Link your {appname} account to Maestrano to get your business in sync.",
"mno_enterprise.templates.components.addon_connect.link_account.submit_form": "Submit",
Expand Down

0 comments on commit 0ecb52b

Please sign in to comment.