mno-enterprise-frontend 2.0.9 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/mno_enterprise/angular/app.js.coffee.erb +0 -120
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/maestrano-components.js.coffee +0 -11
- data/app/assets/javascripts/mno_enterprise/application.js +0 -2
- data/app/assets/javascripts/mno_enterprise/lib/xeditable.js +0 -0
- data/app/assets/stylesheets/mno_enterprise/main.less +0 -28
- data/app/views/layouts/mno_enterprise/_application_js.html.haml +0 -4
- data/app/views/layouts/mno_enterprise/_common_cdn_lib_js.html.haml +0 -5
- data/app/views/layouts/mno_enterprise/_header_files.html.haml +0 -3
- data/app/views/layouts/mno_enterprise/application.html.haml +1 -1
- data/app/views/mno_enterprise/provision/_provision_apps.html.haml +7 -8
- data/config/routes.rb +1 -10
- data/lib/mno_enterprise/frontend/engine.rb +12 -0
- data/lib/mno_enterprise/frontend/locales_generator.rb +57 -0
- data/lib/tasks/mnoe_admin_tasks.rake +67 -0
- data/lib/tasks/mnoe_frontend_tasks.rake +138 -0
- data/lib/tasks/mnoe_locales.rake +14 -0
- data/lib/tasks/templates/bower.json +10 -0
- data/spec/controllers/mno_enterprise/auth/confirmations_controller_spec.rb +2 -2
- data/spec/controllers/mno_enterprise/webhook/o_auth_controller_spec.rb +1 -1
- data/spec/lib/mno_enterprise/locales_generator_spec.rb +14 -0
- data/spec/lib/tasks/mnoe_locales_rake_spec.rb +25 -0
- metadata +35 -145
- data/app/assets/images/mno_enterprise/impac/close-widget-pink.png +0 -0
- data/app/assets/images/mno_enterprise/impac/close-widget.png +0 -0
- data/app/assets/javascripts/mno_enterprise/angular/controllers/maestrano-controllers.js.coffee +0 -4
- data/app/assets/javascripts/mno_enterprise/angular/controllers/modals/modals-ctrl.js.coffee +0 -62
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-account.js.coffee +0 -157
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-app-deletion-request.js.coffee +0 -62
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-apps-list.js.coffee +0 -127
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-components.js.coffee +0 -25
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-marketplace-app.js.coffee +0 -77
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-marketplace.js.coffee +0 -51
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-menu.js.coffee +0 -174
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/arrears.js.coffee +0 -70
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/billing.js.coffee +0 -48
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/credit-card.js.coffee +0 -142
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/index.js.coffee +0 -61
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/invoices.js.coffee +0 -42
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/members.js.coffee +0 -280
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/settings.js.coffee +0 -91
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/team-list.js.coffee +0 -179
- data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/teams.js.coffee +0 -268
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/file-model.js.coffee +0 -33
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-autostop-app.js.coffee +0 -123
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-currency-widget.js.coffee +0 -43
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-current-currency.js.coffee +0 -22
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-editable.js.coffee +0 -68
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-helptext.js.coffee +0 -38
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-match.js.coffee +0 -14
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-message-modal.js.coffee +0 -56
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-partner-code-popup.js.coffee +0 -74
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-partner-contact.js.coffee +0 -59
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-price-converter.js.coffee +0 -49
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-scroll-to.js.coffee +0 -14
- data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-typeahead.js.coffee +0 -89
- data/app/assets/javascripts/mno_enterprise/angular/directives/user-setup/components.js.coffee +0 -7
- data/app/assets/javascripts/mno_enterprise/angular/directives/user-setup/index.js.coffee +0 -256
- data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-app-by-category.js.coffee +0 -5
- data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-currency.js.coffee +0 -30
- data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-filters.js.coffee +0 -7
- data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-replace-underscore-with-space.js.coffee +0 -4
- data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-titleize.js.coffee +0 -7
- data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-truncate.js.coffee +0 -24
- data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/maestrano-app-instance.js.coffee +0 -15
- data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/maestrano-apps-document.js.coffee +0 -83
- data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/maestrano-user.js.coffee +0 -27
- data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/organization-svc.js.coffee +0 -318
- data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/team-svc.js.coffee +0 -180
- data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/tickets-svc.js.coffee +0 -109
- data/app/assets/javascripts/mno_enterprise/angular/services/impac-config.svc.js.coffee +0 -35
- data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-apps-list-helper.js.coffee +0 -337
- data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-current-currency.js.coffee +0 -7
- data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-current-user-svc.js.coffee +0 -99
- data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-exchange-rates.js.coffee +0 -102
- data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-miscellaneous.js.coffee.erb +0 -46
- data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-modal.js.coffee +0 -67
- data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-services.js.coffee +0 -21
- data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-shopping-cart.js.coffee +0 -361
- data/app/assets/javascripts/mno_enterprise/angular/services/marketplace-svc.js.coffee +0 -59
- data/app/assets/javascripts/mno_enterprise/lib/angular-really-click.js +0 -17
- data/app/assets/javascripts/ng-performance/ngPerformance.html +0 -109
- data/app/assets/javascripts/ng-performance/ngPerformance.js +0 -211
- data/app/assets/stylesheets/mno_enterprise/custom/impac-variables-override.less +0 -65
- data/app/assets/stylesheets/mno_enterprise/custom/utility/app-presentation.less +0 -77
- data/app/assets/stylesheets/mno_enterprise/custom/utility/banners.less +0 -145
- data/app/assets/stylesheets/mno_enterprise/custom/utility/carousel.less +0 -68
- data/app/assets/stylesheets/mno_enterprise/custom/utility/helptext.less +0 -40
- data/app/assets/stylesheets/mno_enterprise/custom/utility/miscellaneous.less +0 -134
- data/app/assets/stylesheets/mno_enterprise/custom/utility/testimonial.less +0 -118
- data/app/assets/stylesheets/mno_enterprise/custom/views/apps.less +0 -243
- data/app/assets/stylesheets/mno_enterprise/custom/views/myspace.less +0 -477
- data/app/assets/stylesheets/mno_enterprise/custom/views/pages/home.less +0 -57
- data/app/assets/stylesheets/mno_enterprise/custom/views/star.less +0 -18
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/bootstrap-wizard.less +0 -63
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/dashboard-marketplace.less +0 -187
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/dashboard-organization.less +0 -149
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/dashboard-teams.less +0 -119
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/support.less +0 -42
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/tickets.less +0 -80
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/mno-editable.less +0 -60
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/shopping-cart.less +0 -333
- data/app/assets/stylesheets/mno_enterprise/custom/views/templates/star-wizard.less +0 -49
- data/app/assets/stylesheets/mno_enterprise/custom/views/user-setup.less +0 -10
- data/app/assets/templates/mno_enterprise/dashboard/account.html +0 -131
- data/app/assets/templates/mno_enterprise/dashboard/app_deletion.html +0 -36
- data/app/assets/templates/mno_enterprise/dashboard/apps_list.html +0 -103
- data/app/assets/templates/mno_enterprise/dashboard/horizontal_menu.html +0 -85
- data/app/assets/templates/mno_enterprise/dashboard/marketplace/index.html +0 -60
- data/app/assets/templates/mno_enterprise/dashboard/marketplace/show.html +0 -133
- data/app/assets/templates/mno_enterprise/dashboard/menu.html +0 -161
- data/app/assets/templates/mno_enterprise/dashboard/organization/arrears.html +0 -37
- data/app/assets/templates/mno_enterprise/dashboard/organization/billing.html +0 -37
- data/app/assets/templates/mno_enterprise/dashboard/organization/credit-card.html +0 -156
- data/app/assets/templates/mno_enterprise/dashboard/organization/index.full.html +0 -181
- data/app/assets/templates/mno_enterprise/dashboard/organization/index.html +0 -173
- data/app/assets/templates/mno_enterprise/dashboard/organization/invoices.html +0 -27
- data/app/assets/templates/mno_enterprise/dashboard/organization/members.html +0 -288
- data/app/assets/templates/mno_enterprise/dashboard/organization/settings.html +0 -55
- data/app/assets/templates/mno_enterprise/dashboard/teams/index.html +0 -175
- data/app/assets/templates/mno_enterprise/dashboard/teams/member-add-modal.html +0 -60
- data/app/assets/templates/mno_enterprise/dashboard/teams/member-removal-modal.html +0 -35
- data/app/assets/templates/mno_enterprise/dashboard/teams/team-add-modal.html +0 -35
- data/app/assets/templates/mno_enterprise/dashboard/teams/team-delete-modal.html +0 -35
- data/app/assets/templates/mno_enterprise/dashboard/teams/team-list.html +0 -107
- data/app/assets/templates/mno_enterprise/default_template.html +0 -20
- data/app/assets/templates/mno_enterprise/maestrano-components/autostop_app.html +0 -42
- data/app/assets/templates/mno_enterprise/maestrano-components/currency_widget.html +0 -1
- data/app/assets/templates/mno_enterprise/maestrano-components/editable.html +0 -28
- data/app/assets/templates/mno_enterprise/maestrano-components/modal-messages/congratulations.html +0 -8
- data/app/assets/templates/mno_enterprise/maestrano-components/modal-messages/default.html +0 -1
- data/app/assets/templates/mno_enterprise/maestrano-components/modal-messages/information.html +0 -8
- data/app/assets/templates/mno_enterprise/maestrano-components/star_wizard.html +0 -254
- data/app/assets/templates/mno_enterprise/maestrano-components/upload_spreadsheet.html +0 -191
- data/app/assets/templates/mno_enterprise/modals/new-organization-reseller-req.html +0 -35
- data/app/assets/templates/mno_enterprise/modals/new-organization.html +0 -35
- data/app/assets/templates/mno_enterprise/user-setup/index.html +0 -312
- data/app/controllers/mno_enterprise/pages_controller.rb +0 -9
- data/app/controllers/mno_enterprise/user_setup_controller.rb +0 -11
- data/app/views/layouts/mno_enterprise/_impersonate_header.html.haml +0 -7
- data/app/views/layouts/mno_enterprise/application_dashboard.html.haml +0 -22
- data/app/views/mno_enterprise/pages/myspace.html.haml +0 -6
- data/app/views/mno_enterprise/user_setup/index.html.haml +0 -2
- data/config/initializers/ng-performance.rb +0 -3
- data/lib/assets/javascripts/impac-angular.js +0 -8719
- data/lib/assets/stylesheets/impac-angular.less +0 -2352
- data/lib/mno_enterprise/frontend/concerns/README.md +0 -6
- data/lib/mno_enterprise/frontend/concerns/controllers/pages_controller.rb +0 -25
- data/spec/controllers/mno_enterprise/pages_controller_spec.rb +0 -42
- data/spec/controllers/mno_enterprise/user_setup_controller_spec.rb +0 -33
- data/spec/routing/mno_enterprise/pages_controller_routing_spec.rb +0 -18
- data/spec/routing/mno_enterprise/user_setup_controller_routing_spec.rb +0 -11
@@ -1,180 +0,0 @@
|
|
1
|
-
angular.module('maestrano.services.dashboard.team-svc', []).factory('DhbTeamSvc', ['$http','$q','$window', ($http,$q,$window) ->
|
2
|
-
# Configuration
|
3
|
-
service = {}
|
4
|
-
service.routes = {
|
5
|
-
basePath: -> "/mnoe/jpi/v1/organizations/#{service.config.id}/teams"
|
6
|
-
loadPath: -> "#{service.routes.basePath()}"
|
7
|
-
createPath: -> "#{service.routes.basePath()}"
|
8
|
-
showPath: (id) -> "/mnoe/jpi/v1/teams/#{id}"
|
9
|
-
updatePath: (id) -> service.routes.showPath(id)
|
10
|
-
addMembersPath: (id) -> "#{service.routes.showPath(id)}/add_users"
|
11
|
-
removeMembersPath: (id) -> "#{service.routes.showPath(id)}/remove_users"
|
12
|
-
destroyPath: (id) -> service.routes.showPath(id)
|
13
|
-
}
|
14
|
-
|
15
|
-
service.defaultConfig = {
|
16
|
-
delay: 1000 * 60 * 2 # minutes - long polling delay
|
17
|
-
}
|
18
|
-
|
19
|
-
service.config = {
|
20
|
-
id: null, # The organization id to load
|
21
|
-
timerId: null, # The current timer id (used for long polling)
|
22
|
-
$q: null # The current service promise
|
23
|
-
}
|
24
|
-
|
25
|
-
service.data = []
|
26
|
-
|
27
|
-
#======================================
|
28
|
-
# Data Management
|
29
|
-
#======================================
|
30
|
-
# Return the id of the currently loaded/loading organization
|
31
|
-
service.getId = ->
|
32
|
-
service.config.id
|
33
|
-
|
34
|
-
# Configure the service
|
35
|
-
service.configure = (opts) ->
|
36
|
-
angular.copy(opts,service.config)
|
37
|
-
angular.extend(service.config,service.defaultConfig)
|
38
|
-
|
39
|
-
# Load the organization details
|
40
|
-
# Document structure
|
41
|
-
# :team(s)
|
42
|
-
# :id
|
43
|
-
# :name
|
44
|
-
# :users(array)
|
45
|
-
# [:id, :name, :surname]
|
46
|
-
# :app_instances(array)
|
47
|
-
# [:id, :name, :logo]
|
48
|
-
#
|
49
|
-
service.load = (force = false) ->
|
50
|
-
self = service
|
51
|
-
if !self.config.$q? || force
|
52
|
-
self.config.$q = $http.get(self.routes.loadPath()).then (success) ->
|
53
|
-
angular.copy(success.data.teams,self.data)
|
54
|
-
|
55
|
-
return self.config.$q
|
56
|
-
|
57
|
-
# Start data auto refresh for the service
|
58
|
-
service.startAutoRefresh = ->
|
59
|
-
self = service
|
60
|
-
unless self.config.timerId?
|
61
|
-
self.config.timerId = $window.setInterval((-> self.load(true)),self.config.delay)
|
62
|
-
|
63
|
-
# Stop data auto refresh for the service
|
64
|
-
service.stopAutoRefresh = ->
|
65
|
-
self = service
|
66
|
-
if self.config.timerId?
|
67
|
-
$window.clearInterval(self.config.timerId)
|
68
|
-
self.config.timerId = null
|
69
|
-
|
70
|
-
# Force the service to reload
|
71
|
-
service.reload = ->
|
72
|
-
self.stopAutoRefresh()
|
73
|
-
self.load(true).then(self.startAutoRefresh)
|
74
|
-
|
75
|
-
# Setup the service
|
76
|
-
# A full reload is only performed if the orga id
|
77
|
-
# passed in the configOpts is different from the one
|
78
|
-
# currently used
|
79
|
-
# To force a service reload, use the 'reload' function
|
80
|
-
service.setup = (configOpts = service.config)->
|
81
|
-
self = service
|
82
|
-
if configOpts.id != self.config.id
|
83
|
-
self.stopAutoRefresh()
|
84
|
-
self.configure(configOpts)
|
85
|
-
self.load(true).then(self.startAutoRefresh)
|
86
|
-
|
87
|
-
|
88
|
-
#======================================
|
89
|
-
# Team Management
|
90
|
-
#======================================
|
91
|
-
service.team = {}
|
92
|
-
|
93
|
-
# Create a new team
|
94
|
-
# opts = { name: "SomeName" }
|
95
|
-
service.team.create = (opts) ->
|
96
|
-
self = service
|
97
|
-
data = { team: opts }
|
98
|
-
q = $http.post(self.routes.createPath(),data).then (success)->
|
99
|
-
self.data.push(success.data.team)
|
100
|
-
success.data.team
|
101
|
-
|
102
|
-
return q
|
103
|
-
|
104
|
-
# Edit the details on a given organization
|
105
|
-
# opts = { name: "SomeName", app_instances: [{id: 3}] }
|
106
|
-
service.team.update = (teamId,opts) ->
|
107
|
-
self = service
|
108
|
-
data = { team: opts }
|
109
|
-
q = $http.put(self.routes.updatePath(teamId),data).then (success)->
|
110
|
-
team = _.find(self.data, (t) -> t.id == teamId)
|
111
|
-
angular.copy(success.data.team,team)
|
112
|
-
|
113
|
-
return q
|
114
|
-
|
115
|
-
# Destroy a team
|
116
|
-
service.team.destroy = (teamId) ->
|
117
|
-
self = service
|
118
|
-
q = $http.delete(self.routes.destroyPath(teamId)).then (success)->
|
119
|
-
team = _.find(self.data, (t) -> t.id == teamId)
|
120
|
-
idx = self.data.indexOf(team)
|
121
|
-
self.data.splice(idx,1)
|
122
|
-
team
|
123
|
-
|
124
|
-
#======================================
|
125
|
-
# Member Management
|
126
|
-
#======================================
|
127
|
-
service.members = {}
|
128
|
-
# Accept an array of user objects
|
129
|
-
# [{ id: 1 }]
|
130
|
-
# Or
|
131
|
-
# an array of user id
|
132
|
-
# Or
|
133
|
-
# (not yet implemented) a single email address
|
134
|
-
# Or
|
135
|
-
# (not yet implemented) a an array of email addresses
|
136
|
-
# Or
|
137
|
-
# (not yet implemented) a newline separated list of email addresses
|
138
|
-
service.members.add = (teamId, members) ->
|
139
|
-
self = service
|
140
|
-
baseList = members
|
141
|
-
|
142
|
-
finalList = []
|
143
|
-
_.each baseList, (e) ->
|
144
|
-
if angular.isObject(e)
|
145
|
-
finalList.push(e)
|
146
|
-
else
|
147
|
-
finalList.push({id: e})
|
148
|
-
|
149
|
-
data = { team: { users: finalList } }
|
150
|
-
q = $http.put(self.routes.addMembersPath(teamId), data).then (success)->
|
151
|
-
team = _.find(self.data, (t) -> t.id == teamId)
|
152
|
-
angular.copy(success.data.team.users,team.users)
|
153
|
-
|
154
|
-
return q
|
155
|
-
|
156
|
-
# Remove a member from an organization
|
157
|
-
# Accept an array of user objects
|
158
|
-
# [{ id: 1 }]
|
159
|
-
# Or
|
160
|
-
# an array of user id
|
161
|
-
service.members.remove = (teamId, members) ->
|
162
|
-
self = service
|
163
|
-
baseList = members
|
164
|
-
|
165
|
-
finalList = []
|
166
|
-
_.each baseList, (e) ->
|
167
|
-
if angular.isObject(e)
|
168
|
-
finalList.push(e)
|
169
|
-
else
|
170
|
-
finalList.push({id: e})
|
171
|
-
|
172
|
-
data = { team: { users: finalList } }
|
173
|
-
q = $http.put(self.routes.removeMembersPath(teamId),data).then (success)->
|
174
|
-
team = _.find(self.data, (t) -> t.id == teamId)
|
175
|
-
angular.copy(success.data.team.users,team.users)
|
176
|
-
|
177
|
-
return q
|
178
|
-
|
179
|
-
return service
|
180
|
-
])
|
@@ -1,109 +0,0 @@
|
|
1
|
-
angular.module('maestrano.services.dashboard.tickets-svc', []).factory('DhbTicketsSvc', ['$http','$q','$window', ($http,$q,$window) ->
|
2
|
-
# Configuration
|
3
|
-
service = {}
|
4
|
-
service.routes = {
|
5
|
-
basePath: -> "/mnoe/jpi/v1/dashboard/user"
|
6
|
-
loadPath: -> "#{service.routes.basePath()}/tickets"
|
7
|
-
createPath: -> "#{service.routes.basePath()}/tickets"
|
8
|
-
updatePath: (ticket) -> "#{service.routes.basePath()}/tickets/#{ticket.id}"
|
9
|
-
}
|
10
|
-
|
11
|
-
service.defaultConfig = {
|
12
|
-
delay: 2000 * 60 # seconds - long polling delay
|
13
|
-
}
|
14
|
-
|
15
|
-
service.config = {
|
16
|
-
bootstraped: false, # Hasn't been loaded at least once
|
17
|
-
timerId: null, # The current timer id (used for long polling)
|
18
|
-
$q: null # The current service promise
|
19
|
-
}
|
20
|
-
|
21
|
-
service.data = {}
|
22
|
-
|
23
|
-
#======================================
|
24
|
-
# Data Management
|
25
|
-
#======================================
|
26
|
-
# Return true if the service has been loaded at leaste once
|
27
|
-
service.isBootstraped = ->
|
28
|
-
service.config.bootstraped
|
29
|
-
|
30
|
-
# Configure the service
|
31
|
-
service.configure = (opts) ->
|
32
|
-
angular.copy(opts,service.config)
|
33
|
-
angular.extend(service.config,service.defaultConfig)
|
34
|
-
|
35
|
-
# Load the tickets details
|
36
|
-
service.load = (force = false) ->
|
37
|
-
self = service
|
38
|
-
if !self.config.$q? || force
|
39
|
-
self.config.$q = $http.get(self.routes.loadPath()).then (success) ->
|
40
|
-
angular.copy(success.data,self.data)
|
41
|
-
|
42
|
-
return self.config.$q
|
43
|
-
|
44
|
-
# Start data auto refresh for the service
|
45
|
-
service.startAutoRefresh = ->
|
46
|
-
self = service
|
47
|
-
unless self.config.timerId?
|
48
|
-
self.config.timerId = $window.setInterval((-> self.load(true)),self.config.delay)
|
49
|
-
|
50
|
-
# Stop data auto refresh for the service
|
51
|
-
service.stopAutoRefresh = ->
|
52
|
-
self = service
|
53
|
-
if self.config.timerId?
|
54
|
-
$window.clearInterval(self.config.timerId)
|
55
|
-
self.config.timerId = null
|
56
|
-
|
57
|
-
# Force the service to reload
|
58
|
-
service.reload = ->
|
59
|
-
self.stopAutoRefresh()
|
60
|
-
self.load(true).then(self.startAutoRefresh)
|
61
|
-
|
62
|
-
# Setup the service
|
63
|
-
# A full reload is only performed if the user id
|
64
|
-
# passed in the configOpts is different from the one
|
65
|
-
# currently used
|
66
|
-
# To force a service reload, use the 'reload' function
|
67
|
-
service.setup = (configOpts = service.config)->
|
68
|
-
self = service
|
69
|
-
self.stopAutoRefresh()
|
70
|
-
self.configure(configOpts)
|
71
|
-
self.load(true).then(self.startAutoRefresh)
|
72
|
-
|
73
|
-
service.createTicket = (opts) ->
|
74
|
-
self = service
|
75
|
-
data = opts
|
76
|
-
q = $http.post(self.routes.createPath(),data).then (success)->
|
77
|
-
ticket = success.data
|
78
|
-
self.data["ticket#{ticket.id}"] = ticket
|
79
|
-
return q
|
80
|
-
|
81
|
-
service.postComment = (ticket,model) ->
|
82
|
-
self = service
|
83
|
-
opts = { transformRequest: angular.identity, headers: {'Content-Type': undefined} }
|
84
|
-
data = new FormData()
|
85
|
-
data.append('comment',model.comment)
|
86
|
-
if model.attachment
|
87
|
-
data.append('attachment',model.attachment)
|
88
|
-
q = $http.put(self.routes.updatePath(ticket),data,opts).then (success) ->
|
89
|
-
self.data["ticket#{ticket.id}"].comments.push(success.data)
|
90
|
-
return q
|
91
|
-
|
92
|
-
|
93
|
-
#======================================
|
94
|
-
# Organization Management
|
95
|
-
#======================================
|
96
|
-
#service.organization = {}
|
97
|
-
|
98
|
-
# Edit the details on a given organization
|
99
|
-
# opts = { name: "SomeName", soa_enabled: true }
|
100
|
-
#service.organization.update = (opts) ->
|
101
|
-
#self = service
|
102
|
-
#data = { organization: opts }
|
103
|
-
#q = $http.put(self.routes.updatePath(),data).then (success)->
|
104
|
-
#angular.copy(success.data.organization,self.data.organization)
|
105
|
-
|
106
|
-
#return q
|
107
|
-
|
108
|
-
return service
|
109
|
-
])
|
@@ -1,35 +0,0 @@
|
|
1
|
-
angular
|
2
|
-
.module('maestrano.services.impac-config-svc', [])
|
3
|
-
.service('ImpacConfigSvc' , ($log, $q, CurrentUserSvc, DhbOrganizationSvc) ->
|
4
|
-
|
5
|
-
@getUserData = ->
|
6
|
-
deferred = $q.defer()
|
7
|
-
id = CurrentUserSvc.getUserData()
|
8
|
-
if id
|
9
|
-
deferred.resolve(id)
|
10
|
-
else
|
11
|
-
$log.error(err = {msg: "Unable to retrieve user data"})
|
12
|
-
deferred.reject(err)
|
13
|
-
|
14
|
-
return deferred.promise
|
15
|
-
|
16
|
-
@getOrganizations = ->
|
17
|
-
deferred = $q.defer()
|
18
|
-
|
19
|
-
DhbOrganizationSvc.load().then (success) ->
|
20
|
-
currentOrgId = DhbOrganizationSvc.getId()
|
21
|
-
|
22
|
-
CurrentUserSvc.getOrganizations().then (orgs) ->
|
23
|
-
userOrgs = orgs
|
24
|
-
currentOrgId ||= orgs[0].id if orgs.length > 0
|
25
|
-
|
26
|
-
if userOrgs && currentOrgId
|
27
|
-
deferred.resolve({organizations: userOrgs, currentOrgId: currentOrgId})
|
28
|
-
else
|
29
|
-
$log.error(err = {msg: "Unable to retrieve user organizations"})
|
30
|
-
deferred.reject(err)
|
31
|
-
|
32
|
-
return deferred.promise
|
33
|
-
|
34
|
-
return @
|
35
|
-
)
|
data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-apps-list-helper.js.coffee
DELETED
@@ -1,337 +0,0 @@
|
|
1
|
-
angular.module('maestrano.services.apps-list-helper', []).factory( 'AppsListHelper', [
|
2
|
-
'AssetPath','$window','MsgBus'
|
3
|
-
(AssetPath,$window,MsgBus) ->
|
4
|
-
|
5
|
-
service = {}
|
6
|
-
|
7
|
-
class AppsListHelperClass
|
8
|
-
constructor: (@controlType) ->
|
9
|
-
self = this
|
10
|
-
|
11
|
-
actionProgressClass: (instance) ->
|
12
|
-
realStatus = instance.status
|
13
|
-
realStatus = 'provisioning' if realStatus == 'staged'
|
14
|
-
realStatus = 'starting' if realStatus == 'restarting'
|
15
|
-
realStatus = 'terminated' unless realStatus
|
16
|
-
|
17
|
-
if realStatus == 'updating'
|
18
|
-
return "progress-mno-warning progress-striped active"
|
19
|
-
else if realStatus == 'running'
|
20
|
-
return "progress-mno-success"
|
21
|
-
else if realStatus == 'starting' || realStatus == 'provisioning'
|
22
|
-
return "progress-mno-success progress-striped active"
|
23
|
-
else if realStatus == 'terminating'
|
24
|
-
return "progress-mno-danger progress-striped active"
|
25
|
-
else if realStatus == 'terminated'
|
26
|
-
return "progress-mno-danger"
|
27
|
-
else if realStatus == 'stopping'
|
28
|
-
return "progress-mno-none progress-striped active"
|
29
|
-
else
|
30
|
-
# includes "stopping" and "stopped" state
|
31
|
-
return "progress-mno-none"
|
32
|
-
|
33
|
-
# Return the action progression in percent
|
34
|
-
# unit: specifies the unit that should be appended
|
35
|
-
# to the result. If null then the result is an integer.
|
36
|
-
# Eg. actionProgress(intance, '%') -> 95%
|
37
|
-
actionProgress: (instance, unit = null) ->
|
38
|
-
# Get out of there if the bar is not shown
|
39
|
-
if !this.isProgressBarShown(instance)
|
40
|
-
return 0
|
41
|
-
|
42
|
-
# Get the relevant status from an actionProgress
|
43
|
-
# point of view
|
44
|
-
realStatus = instance.status
|
45
|
-
realStatus = 'provisioning' if realStatus == 'staged'
|
46
|
-
realStatus = 'starting' if realStatus == 'restarting'
|
47
|
-
realStatus = 'terminated' unless realStatus
|
48
|
-
|
49
|
-
if (realStatus == 'stopped' || realStatus == 'running' || realStatus == 'terminated')
|
50
|
-
percent = 100
|
51
|
-
percent = "#{percent}#{unit}" if unit?
|
52
|
-
return percent
|
53
|
-
else if realStatus == 'updating'
|
54
|
-
percent = 70
|
55
|
-
percent = "#{percent}#{unit}" if unit?
|
56
|
-
return percent
|
57
|
-
|
58
|
-
# Get the maxDuration (seconds) and referenceField based on
|
59
|
-
# the action being performed
|
60
|
-
maxDuration = instance.durations[realStatus]
|
61
|
-
referenceField = {
|
62
|
-
'provisioning': 'createdAt',
|
63
|
-
'starting': 'startedAt',
|
64
|
-
'stopping': 'stoppedAt',
|
65
|
-
'terminating': 'terminatedAt'
|
66
|
-
}[realStatus]
|
67
|
-
|
68
|
-
# Get the action elapsed time in seconds
|
69
|
-
startTime = new Date(instance[referenceField])
|
70
|
-
endTime = new Date((new Date()).getTime() - $window.clientTimeOffset) #remove Client-Server time offset
|
71
|
-
elapsedTime = (endTime.getTime() - startTime.getTime()) / 1000
|
72
|
-
|
73
|
-
# Calculate the percentage
|
74
|
-
# Max value is 95% / Min value is 5%
|
75
|
-
percent = Math.round((elapsedTime / maxDuration)*100)
|
76
|
-
percent = Math.min(percent, 95)
|
77
|
-
percent = Math.max(percent, 5)
|
78
|
-
percent = "#{percent}#{unit}" if unit?
|
79
|
-
return percent
|
80
|
-
|
81
|
-
ownerLabelFor: (instance) ->
|
82
|
-
return {
|
83
|
-
'User': 'You',
|
84
|
-
'Organization': instance.ownerLabel
|
85
|
-
}[instance.ownerType]
|
86
|
-
|
87
|
-
isAppActionUrlEnabled: (instance) ->
|
88
|
-
return (instance && instance.status != 'terminating' && instance.status != 'terminated')
|
89
|
-
|
90
|
-
appActionUrl: (instance) ->
|
91
|
-
"/mnoe/launch/#{instance.uid}"
|
92
|
-
|
93
|
-
appLoaderPath: (instance) ->
|
94
|
-
if instance.status == 'running'
|
95
|
-
AssetPath['loaders/app_label_running.png']
|
96
|
-
else if instance.status == 'starting' || instance.status == 'staged' || instance.status == 'provisioning'
|
97
|
-
AssetPath['loaders/app_label_starting.gif']
|
98
|
-
else if instance.status == 'stopping'
|
99
|
-
AssetPath['loaders/app_label_stopping.gif']
|
100
|
-
else if instance.status == 'stopped'
|
101
|
-
AssetPath['loaders/app_label_stopped.png']
|
102
|
-
else if instance.status == 'terminating'
|
103
|
-
AssetPath['loaders/app_label_terminating.gif']
|
104
|
-
else if instance.status == 'terminated'
|
105
|
-
AssetPath['loaders/app_label_terminated.png']
|
106
|
-
else # upgrading/downgrading/updating etc.
|
107
|
-
AssetPath['loaders/app_label_stopping.gif']
|
108
|
-
|
109
|
-
appLoaderStatus: (instance) ->
|
110
|
-
if instance.status == 'running'
|
111
|
-
return '<span class="mgreen">online</span>'
|
112
|
-
else if instance.status == 'starting'
|
113
|
-
return '<span class="mgreen">loading</span>'
|
114
|
-
else if instance.status == 'staged' || instance.status == 'provisioning'
|
115
|
-
return '<span class="mgreen">preparing</span>'
|
116
|
-
else if instance.status == 'stopping'
|
117
|
-
return '<span class="text-warning">idling</span>'
|
118
|
-
else if instance.status == 'stopped'
|
119
|
-
return '<span class="mgrey">offline</span>'
|
120
|
-
else if instance.status == 'terminating'
|
121
|
-
return '<span class="mred">terminating</span>'
|
122
|
-
else if instance.status == 'terminated'
|
123
|
-
return '<span class="mred">terminated</span>'
|
124
|
-
else # upgrading/downgrading/updating etc.
|
125
|
-
return "<span class='text-warning'>#{instance.status}</span>"
|
126
|
-
|
127
|
-
isLaunchHidden: (instance) ->
|
128
|
-
instance.status == 'terminating' ||
|
129
|
-
instance.status == 'terminated' ||
|
130
|
-
this.isOauthConnectBtnShown(instance) ||
|
131
|
-
this.isNewOfficeApp(instance)
|
132
|
-
|
133
|
-
# Deprecated?
|
134
|
-
isStartShown: (instance) ->
|
135
|
-
if instance.stack? && instance.stack.match(/^(cloud|connector)$/i)
|
136
|
-
return false
|
137
|
-
else
|
138
|
-
(@controlType == 'ops' || @controlType == 'dashboard') &&
|
139
|
-
instance &&
|
140
|
-
instance.canStart &&
|
141
|
-
instance.status == 'stopped'
|
142
|
-
|
143
|
-
# Deprecated?
|
144
|
-
isStopShown: (instance) ->
|
145
|
-
if instance.stack? && instance.stack.match(/^(cloud|connector)$/i)
|
146
|
-
return false
|
147
|
-
else
|
148
|
-
(@controlType == 'ops' || @controlType == 'dashboard') &&
|
149
|
-
instance &&
|
150
|
-
instance.billingType == 'hourly' &&
|
151
|
-
instance.canStop &&
|
152
|
-
instance.status == 'running'
|
153
|
-
|
154
|
-
isTimerButtonShown: (instance) ->
|
155
|
-
this.isStopShown(instance) && instance.autostopAt?
|
156
|
-
|
157
|
-
isRestartShown: (instance) ->
|
158
|
-
if instance.stack? && instance.stack.match(/^(cloud|connector)$/i)
|
159
|
-
return false
|
160
|
-
else
|
161
|
-
(@controlType == 'manage' || @controlType == 'dashboard') &&
|
162
|
-
instance &&
|
163
|
-
instance.status == 'running'
|
164
|
-
|
165
|
-
isDeleteShown: (instance) ->
|
166
|
-
(@controlType == 'manage' || @controlType == 'dashboard') &&
|
167
|
-
instance &&
|
168
|
-
instance.canTerminate &&
|
169
|
-
(instance.status == 'stopped' ||
|
170
|
-
instance.status == 'running')
|
171
|
-
|
172
|
-
|
173
|
-
isTransferShown: (instance) ->
|
174
|
-
(@controlType == 'manage' || @controlType == 'dashboard') &&
|
175
|
-
instance &&
|
176
|
-
!instance.personal &&
|
177
|
-
instance.status != 'terminating' &&
|
178
|
-
instance.status != 'terminated' &&
|
179
|
-
instance.canTerminate
|
180
|
-
|
181
|
-
isProgressBarShown: (instance) ->
|
182
|
-
if @controlType == 'dashboard' then return true
|
183
|
-
else
|
184
|
-
@controlType == 'ops' &&
|
185
|
-
instance &&
|
186
|
-
(
|
187
|
-
instance.status == 'staged' ||
|
188
|
-
instance.status == 'provisioning' ||
|
189
|
-
instance.status == 'starting' ||
|
190
|
-
instance.status == 'restarting' ||
|
191
|
-
instance.status == 'stopping' ||
|
192
|
-
instance.status == 'terminating'
|
193
|
-
)
|
194
|
-
|
195
|
-
isChangeGradeShown: (instance) ->
|
196
|
-
if instance.stack? && instance.stack.match(/^(cloud|connector)$/i)
|
197
|
-
return false
|
198
|
-
else
|
199
|
-
(@controlType == 'manage' || @controlType == 'dashboard') &&
|
200
|
-
instance &&
|
201
|
-
instance.status != 'terminating' &&
|
202
|
-
instance.status != 'terminated' &&
|
203
|
-
(
|
204
|
-
!instance.appChangeRequest? ||
|
205
|
-
(instance.appChangeRequest &&
|
206
|
-
instance.appChangeRequest.status == 'performed'
|
207
|
-
)
|
208
|
-
)
|
209
|
-
|
210
|
-
isViewChangeGradeShown: (instance) ->
|
211
|
-
(@controlType == 'manage' || @controlType == 'dashboard') &&
|
212
|
-
instance.status != 'terminating' &&
|
213
|
-
instance.status != 'terminated' &&
|
214
|
-
instance.appChangeRequest &&
|
215
|
-
instance.appChangeRequest.status != 'cancelled'
|
216
|
-
|
217
|
-
classForViewChangeButton: (instance) ->
|
218
|
-
if instance.appChangeRequest
|
219
|
-
status = instance.appChangeRequest.status
|
220
|
-
return 'fbtn fbtn-mini fbtn-success' if status == 'performed'
|
221
|
-
return 'fbtn fbtn-mini fbtn-warning' if status == 'pending' || status == 'performing'
|
222
|
-
|
223
|
-
|
224
|
-
viewChangeGradeLabel: (instance) ->
|
225
|
-
if instance.appChangeRequest
|
226
|
-
status = instance.appChangeRequest.status
|
227
|
-
return 'Recent change' if status == 'performed'
|
228
|
-
return 'Change pending' if status == 'pending'
|
229
|
-
return 'Changing' if status == 'performing'
|
230
|
-
|
231
|
-
isChangeLoadingShown: (instance) ->
|
232
|
-
instance.appChangeRequest && instance.appChangeRequest.status == 'performing'
|
233
|
-
|
234
|
-
isManageActionsShown: (instance) ->
|
235
|
-
this.isChangeGradeShown(instance) ||
|
236
|
-
this.isRestartShown(instance) ||
|
237
|
-
this.isDeleteShown(instance)
|
238
|
-
|
239
|
-
openHelpText: (instance) ->
|
240
|
-
msg = "Open your app in a new tab"
|
241
|
-
if instance.ssoEnabled
|
242
|
-
msg += "<br><br><em>You will automatically be logged in via your maestrano account</em>"
|
243
|
-
else if instance.firstCredentials && instance.firstCredentials.login
|
244
|
-
msg += "<br><br>If this is the first time then use"
|
245
|
-
msg += "<br><b class=\"morange\">Login</b>: #{instance.firstCredentials.login}"
|
246
|
-
if instance.firstCredentials.password
|
247
|
-
msg += "<br><b class=\"morange\">Password</b>: #{instance.firstCredentials.password}"
|
248
|
-
else
|
249
|
-
msg += "<br><b class=\"morange\">Password</b>: <em>Leave blank</em>"
|
250
|
-
return msg
|
251
|
-
|
252
|
-
kcPath: (instance) ->
|
253
|
-
"/knowledge_center/apps/#{instance.appId}"
|
254
|
-
|
255
|
-
isOverlayRequired: (instance) ->
|
256
|
-
instance.stack == 'connector'
|
257
|
-
|
258
|
-
isQuickBooksConnectShown: (instance) ->
|
259
|
-
instance.stack == 'connector' && instance.app_nid == 'quickbooks' && !instance.oauth_keys_valid
|
260
|
-
|
261
|
-
isXeroConnectShown: (instance) ->
|
262
|
-
instance.stack == 'connector' && instance.app_nid == 'xero' && !instance.oauth_keys_valid
|
263
|
-
|
264
|
-
isMYOBConnectShown: (instance) ->
|
265
|
-
instance.stack == 'connector' && instance.app_nid == 'myob' && !instance.oauth_keys_valid
|
266
|
-
|
267
|
-
isOauthConnectBtnShown: (instance) ->
|
268
|
-
instance.app_nid != 'office-365' &&
|
269
|
-
instance.stack == 'connector' &&
|
270
|
-
!instance.oauth_keys_valid
|
271
|
-
|
272
|
-
connectToQuickBooks: (instance) ->
|
273
|
-
instance.status = 'updating'
|
274
|
-
intuit.ipp.anywhere.grantUrl = this.quickbooksGrantUrl(instance) + '?popup=true'
|
275
|
-
intuit.ipp.anywhere.controller.onConnectToIntuitClicked()
|
276
|
-
|
277
|
-
isDataSyncShown: (instance) ->
|
278
|
-
instance.stack == 'connector' && instance.oauth_keys_valid
|
279
|
-
|
280
|
-
isDataDisconnectShown: (instance) ->
|
281
|
-
instance.stack == 'connector' && instance.oauth_keys_valid
|
282
|
-
|
283
|
-
quickbooksGrantUrl: (instance) ->
|
284
|
-
arr = $window.location.href.split("/");
|
285
|
-
url = $window.location.protocol + '//' + arr[2]
|
286
|
-
url += this.dataSyncPath(instance)
|
287
|
-
return url
|
288
|
-
|
289
|
-
isMicrosoftSetupShown: (instance) ->
|
290
|
-
instance.stack == 'connector' && instance.appNid == 'office-365' && (moment(instance.createdAt) > moment().subtract({weeks:2}))
|
291
|
-
|
292
|
-
isNewOfficeApp: (instance) ->
|
293
|
-
newApp = (MsgBus.subscribe('params'))().new_app
|
294
|
-
instance.stack == 'connector' && instance.appNid == 'office-365' && newApp && (moment(instance.createdAt) > moment().subtract({minutes:5}))
|
295
|
-
|
296
|
-
microsoftTrialUrl: (instance) ->
|
297
|
-
return instance.microsoftTrialUrl
|
298
|
-
|
299
|
-
companyName: (instance) ->
|
300
|
-
if instance.stack == 'connector' && instance.oauth_keys_valid && instance.oauth_company_name
|
301
|
-
return instance.oauth_company_name
|
302
|
-
false
|
303
|
-
|
304
|
-
connectorVersion: (instance) ->
|
305
|
-
if instance.stack == 'connector' && instance.oauth_keys_valid && instance.connectorVersion
|
306
|
-
return capitalize(instance.connectorVersion)
|
307
|
-
false
|
308
|
-
|
309
|
-
dataSyncPath: (instance) ->
|
310
|
-
"/mnoe/webhook/oauth/#{instance.uid}/sync"
|
311
|
-
|
312
|
-
oAuthConnectPath: (instance)->
|
313
|
-
"/mnoe/webhook/oauth/#{instance.uid}/authorize"
|
314
|
-
|
315
|
-
dataDisconnectPath: (instance) ->
|
316
|
-
"/mnoe/webhook/oauth/#{instance.uid}/disconnect"
|
317
|
-
|
318
|
-
dataDisconnectClick: (instance) ->
|
319
|
-
$window.location.href = this.dataDisconnectPath(instance)
|
320
|
-
|
321
|
-
myobAccountRightConnectPath: (instance) ->
|
322
|
-
"/webhook/myob/#{instance.uid}/authorize?version=account_right"
|
323
|
-
|
324
|
-
myobEssentialsConnectPath: (instance) ->
|
325
|
-
"/webhook/myob/#{instance.uid}/authorize?version=essentials"
|
326
|
-
|
327
|
-
capitalize = (string) ->
|
328
|
-
string = string.replace("_", " ")
|
329
|
-
string.replace /\w\S*/g, (txt) ->
|
330
|
-
txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
|
331
|
-
|
332
|
-
service.new = (controlType = 'dashboard') ->
|
333
|
-
return new AppsListHelperClass(controlType)
|
334
|
-
|
335
|
-
return service
|
336
|
-
|
337
|
-
])
|