Sha256: 20260881c79c4c69781e77d92d5a2cc951d8d78e5e27eeab2af5f0de70544d7a

Contents?: true

Size: 1.95 KB

Versions: 10

Compression:

Stored size: 1.95 KB

Contents

module = angular.module('maestrano.dashboard.dashboard-app-deletion-request',['maestrano.assets'])

#============================================
#
#============================================
module.controller('DashboardAppDeletionRequestCtrl',[
  '$scope','$modal','DashboardAppInstance','DashboardAppsDocument','Utilities','AssetPath'
  ($scope, $modal, DashboardAppInstance, DashboardAppsDocument, Utilities, AssetPath) ->
    
    # Scope Initialization
    $scope.assetPath = AssetPath
    $scope.modal = { }
    
    init = ->
      $scope.data = DashboardAppsDocument.data["#{$scope.appId}"].plan
      $scope.sentence = "Please proceed to the deletion of my app and all data it contains"
      
      # Open modal
      $scope.$watch(( -> $scope.openModal), ->
        if $scope.openModal > 0 then $scope.modal.open()
      )
    
    $scope.modal.open = ->
      $scope.modal.errors = null
      $scope.modal.$instance = $modal.open(templateUrl:'internal-deletion-modal.html',scope:$scope, size:'lg')

    $scope.modal.close = ->
      $scope.modal.$instance.close()

    $scope.proceed = ->
      $scope.modal.loading = true
      DashboardAppInstance.terminate($scope.appId).then(
        (success) ->
          DashboardAppsDocument.reload()
          $scope.modal.loading = false
          $scope.modal.errors = null
          $scope.modal.close()
        ,(error) ->
          $scope.modal.loading = false
          $scope.modal.errors = Utilities.processRailsError(error)
      )
    
    
    $scope.$watch DashboardAppsDocument.getId, (val) ->
      $scope.loading = true
      if val?
        DashboardAppsDocument.load(val).then ->
          init()

])

module.directive('dashboardAppDeletionRequest', ['TemplatePath', (TemplatePath) ->
  return {
      restrict: 'A',
      scope: {
        appId:'@'
        openModal:'='
      },
      templateUrl: TemplatePath['mno_enterprise/dashboard/app_deletion.html'],
      controller: 'DashboardAppDeletionRequestCtrl'
    }
])

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mno-enterprise-frontend-2.0.9 app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-app-deletion-request.js.coffee
mno-enterprise-frontend-2.0.8 app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-app-deletion-request.js.coffee
mno-enterprise-frontend-2.0.7 app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-app-deletion-request.js.coffee
mno-enterprise-frontend-2.0.6 app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-app-deletion-request.js.coffee
mno-enterprise-frontend-2.0.5 app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-app-deletion-request.js.coffee
mno-enterprise-frontend-2.0.4 app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-app-deletion-request.js.coffee
mno-enterprise-frontend-2.0.3 app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-app-deletion-request.js.coffee
mno-enterprise-frontend-2.0.2 app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-app-deletion-request.js.coffee
mno-enterprise-frontend-2.0.1 app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-app-deletion-request.js.coffee
mno-enterprise-frontend-2.0.0 app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-app-deletion-request.js.coffee