Skip to content

Commit

Permalink
Add modal to confirm disconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
manu-d committed Feb 5, 2018
1 parent b1807d7 commit 716b4ee
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/app/views/apps/modals/app-settings-modal.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,25 @@ angular.module 'mnoEnterpriseAngular'
)

$scope.disconnect = ->
$scope.isDisconnecting = true
MnoeAppInstances.disconnect(app)
.then((response) ->
app.addon_organization.has_account_linked = false
app.addon_organization.sync_enabled = false
$uibModalInstance.close()
toastr.success("Your application has been disconnected")
modalOptions =
closeButtonText: 'mno_enterprise.templates.impac.dock.settings.disconnect.modal.cancel'
actionButtonText: 'mno_enterprise.templates.impac.dock.settings.disconnect.modal.action'
headerText: 'mno_enterprise.templates.impac.dock.settings.disconnect.modal.header'
headerTextExtraData: {appname: app.app_name}
bodyText: 'mno_enterprise.templates.impac.dock.settings.disconnect.modal.body'
bodyTextExtraData: {appname: app.app_name}

MnoConfirm.showModal(modalOptions).then(
->
$scope.isDisconnecting = false
)
MnoeAppInstances.disconnect(app)
.then((response) ->
app.addon_organization.has_account_linked = false
app.addon_organization.sync_enabled = false
$uibModalInstance.close()
toastr.success("Your application has been disconnected")
).finally(-> $scope.isDisconnecting = false)
)

$scope.sortableSyncsServerPipe = (tableState)->
$scope.syncs.sort = updateTableSort(tableState.sort, $scope.syncs.sort)
Expand Down
5 changes: 5 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,11 @@
"mno_enterprise.templates.impac.dock.settings.id_maps.type": "Type",
"mno_enterprise.templates.impac.dock.settings.id_maps.status": "Status",
"mno_enterprise.templates.impac.dock.settings.disconnect_app": "Disconnect",
"mno_enterprise.templates.impac.dock.settings.disconnect.modal.cancel": "Cancel",
"mno_enterprise.templates.impac.dock.settings.disconnect.modal.action": "Disconnect app",
"mno_enterprise.templates.impac.dock.settings.disconnect.modal.header": "Disconnect {appname}?",
"mno_enterprise.templates.impac.dock.settings.disconnect.modal.body": "Are you sure you want to disconnect {appname} and Maestrano?",
"mno_enterprise.templates.impac.dock.settings.disconnect.modal.success": "Your application has been disconnected",
"mno_enterprise.templates.impac.dock.add_more_apps": "Add more apps",
"mno_enterprise.templates.impac.dock.cancel": "Cancel",
"mno_enterprise.templates.impac.dock.do_not_have_apps": "It looks like you don't have any apps",
Expand Down

0 comments on commit 716b4ee

Please sign in to comment.