mno-enterprise-frontend 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (313) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +1 -0
  3. data/Rakefile +12 -0
  4. data/app/assets/images/favicon.ico +0 -0
  5. data/app/assets/images/mno_enterprise/impac/close-widget-pink.png +0 -0
  6. data/app/assets/images/mno_enterprise/impac/close-widget.png +0 -0
  7. data/app/assets/images/mno_enterprise/loader-32x32-bg-inverse.gif +0 -0
  8. data/app/assets/images/mno_enterprise/loader-32x32-bg-main.gif +0 -0
  9. data/app/assets/images/mno_enterprise/maestrano/logo-whitebg.png +0 -0
  10. data/app/assets/javascripts/mno_enterprise/angular/app.js.coffee.erb +173 -0
  11. data/app/assets/javascripts/mno_enterprise/angular/controllers/maestrano-controllers.js.coffee +4 -0
  12. data/app/assets/javascripts/mno_enterprise/angular/controllers/modals/modals-ctrl.js.coffee +62 -0
  13. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-account.js.coffee +157 -0
  14. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-app-deletion-request.js.coffee +62 -0
  15. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-apps-list.js.coffee +127 -0
  16. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-components.js.coffee +25 -0
  17. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-marketplace-app.js.coffee +77 -0
  18. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-marketplace.js.coffee +51 -0
  19. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/dashboard-menu.js.coffee +174 -0
  20. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/arrears.js.coffee +70 -0
  21. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/billing.js.coffee +48 -0
  22. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/credit-card.js.coffee +142 -0
  23. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/index.js.coffee +61 -0
  24. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/invoices.js.coffee +42 -0
  25. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/members.js.coffee +280 -0
  26. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/settings.js.coffee +91 -0
  27. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/team-list.js.coffee +179 -0
  28. data/app/assets/javascripts/mno_enterprise/angular/directives/dashboard/organization/teams.js.coffee +268 -0
  29. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/file-model.js.coffee +33 -0
  30. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/maestrano-components.js.coffee +22 -0
  31. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-autostop-app.js.coffee +123 -0
  32. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-compile.js.coffee +18 -0
  33. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-currency-widget.js.coffee +43 -0
  34. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-current-currency.js.coffee +22 -0
  35. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-editable.js.coffee +68 -0
  36. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-flash-msg.js.coffee +40 -0
  37. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-helptext.js.coffee +38 -0
  38. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-loading-lounge.js.coffee +184 -0
  39. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-match.js.coffee +14 -0
  40. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-message-modal.js.coffee +56 -0
  41. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-notification-widget.js.coffee +192 -0
  42. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-partner-code-popup.js.coffee +74 -0
  43. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-partner-contact.js.coffee +59 -0
  44. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-password-strength.js.coffee +154 -0
  45. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-password.js.coffee +40 -0
  46. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-price-converter.js.coffee +49 -0
  47. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-scroll-to.js.coffee +14 -0
  48. data/app/assets/javascripts/mno_enterprise/angular/directives/maestrano-components/mno-typeahead.js.coffee +89 -0
  49. data/app/assets/javascripts/mno_enterprise/angular/directives/user-setup/components.js.coffee +7 -0
  50. data/app/assets/javascripts/mno_enterprise/angular/directives/user-setup/index.js.coffee +256 -0
  51. data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-app-by-category.js.coffee +5 -0
  52. data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-currency.js.coffee +30 -0
  53. data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-filters.js.coffee +7 -0
  54. data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-replace-underscore-with-space.js.coffee +4 -0
  55. data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-titleize.js.coffee +7 -0
  56. data/app/assets/javascripts/mno_enterprise/angular/filters/maestrano-truncate.js.coffee +24 -0
  57. data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/maestrano-app-instance.js.coffee +15 -0
  58. data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/maestrano-apps-document.js.coffee +83 -0
  59. data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/maestrano-user.js.coffee +27 -0
  60. data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/organization-svc.js.coffee +318 -0
  61. data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/team-svc.js.coffee +180 -0
  62. data/app/assets/javascripts/mno_enterprise/angular/services/dashboard/tickets-svc.js.coffee +109 -0
  63. data/app/assets/javascripts/mno_enterprise/angular/services/impac-config.svc.js.coffee +35 -0
  64. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-apps-list-helper.js.coffee +337 -0
  65. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-assets.js.coffee.erb +21 -0
  66. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-current-currency.js.coffee +7 -0
  67. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-current-user-svc.js.coffee +99 -0
  68. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-exchange-rates.js.coffee +102 -0
  69. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-message-svc.js.coffee +71 -0
  70. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-miscellaneous.js.coffee.erb +46 -0
  71. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-modal.js.coffee +67 -0
  72. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-msg-bus.js.coffee +50 -0
  73. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-services.js.coffee +21 -0
  74. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-shopping-cart.js.coffee +361 -0
  75. data/app/assets/javascripts/mno_enterprise/angular/services/maestrano-utilities.js.coffee +61 -0
  76. data/app/assets/javascripts/mno_enterprise/angular/services/marketplace-svc.js.coffee +59 -0
  77. data/app/assets/javascripts/mno_enterprise/application.js +17 -0
  78. data/app/assets/javascripts/mno_enterprise/application_lib.js +14 -0
  79. data/app/assets/javascripts/mno_enterprise/lib/angular-really-click.js +17 -0
  80. data/app/assets/javascripts/mno_enterprise/lib/sortable.js +315 -0
  81. data/app/assets/javascripts/mno_enterprise/lib/ui-bootstrap-tpls-0.13.4.js +5836 -0
  82. data/app/assets/javascripts/mno_enterprise/lib/xeditable.js +1588 -0
  83. data/app/assets/javascripts/mno_enterprise/twitter/bootstrap.js +12 -0
  84. data/app/assets/javascripts/mno_enterprise/twitter/bootstrap/affix.js +162 -0
  85. data/app/assets/javascripts/mno_enterprise/twitter/bootstrap/alert.js +94 -0
  86. data/app/assets/javascripts/mno_enterprise/twitter/bootstrap/button.js +116 -0
  87. data/app/assets/javascripts/mno_enterprise/twitter/bootstrap/carousel.js +237 -0
  88. data/app/assets/javascripts/mno_enterprise/twitter/bootstrap/collapse.js +211 -0
  89. data/app/assets/javascripts/mno_enterprise/twitter/bootstrap/dropdown.js +161 -0
  90. data/app/assets/javascripts/mno_enterprise/twitter/bootstrap/modal.js +324 -0
  91. data/app/assets/javascripts/mno_enterprise/twitter/bootstrap/popover.js +113 -0
  92. data/app/assets/javascripts/mno_enterprise/twitter/bootstrap/scrollspy.js +175 -0
  93. data/app/assets/javascripts/mno_enterprise/twitter/bootstrap/tab.js +153 -0
  94. data/app/assets/javascripts/mno_enterprise/twitter/bootstrap/tooltip.js +472 -0
  95. data/app/assets/javascripts/mno_enterprise/twitter/bootstrap/transition.js +59 -0
  96. data/app/assets/javascripts/ng-performance/ngPerformance.html +109 -0
  97. data/app/assets/javascripts/ng-performance/ngPerformance.js +211 -0
  98. data/app/assets/stylesheets/mno_enterprise/application.css +13 -0
  99. data/app/assets/stylesheets/mno_enterprise/custom/accordion.less +90 -0
  100. data/app/assets/stylesheets/mno_enterprise/custom/alert.less +30 -0
  101. data/app/assets/stylesheets/mno_enterprise/custom/angular-animate.less +42 -0
  102. data/app/assets/stylesheets/mno_enterprise/custom/angular-material.less +56 -0
  103. data/app/assets/stylesheets/mno_enterprise/custom/bootstrap-on-juice.less +22 -0
  104. data/app/assets/stylesheets/mno_enterprise/custom/button.less +84 -0
  105. data/app/assets/stylesheets/mno_enterprise/custom/footer.less +44 -0
  106. data/app/assets/stylesheets/mno_enterprise/custom/form.less +191 -0
  107. data/app/assets/stylesheets/mno_enterprise/custom/header.less +281 -0
  108. data/app/assets/stylesheets/mno_enterprise/custom/impac-variables-override.less +65 -0
  109. data/app/assets/stylesheets/mno_enterprise/custom/modal.less +183 -0
  110. data/app/assets/stylesheets/mno_enterprise/custom/utilities.less +729 -0
  111. data/app/assets/stylesheets/mno_enterprise/custom/utility/app-presentation.less +77 -0
  112. data/app/assets/stylesheets/mno_enterprise/custom/utility/banners.less +145 -0
  113. data/app/assets/stylesheets/mno_enterprise/custom/utility/carousel.less +68 -0
  114. data/app/assets/stylesheets/mno_enterprise/custom/utility/helptext.less +40 -0
  115. data/app/assets/stylesheets/mno_enterprise/custom/utility/miscellaneous.less +134 -0
  116. data/app/assets/stylesheets/mno_enterprise/custom/utility/progress-bar.less +55 -0
  117. data/app/assets/stylesheets/mno_enterprise/custom/utility/step.less +101 -0
  118. data/app/assets/stylesheets/mno_enterprise/custom/utility/tabset.less +87 -0
  119. data/app/assets/stylesheets/mno_enterprise/custom/utility/testimonial.less +118 -0
  120. data/app/assets/stylesheets/mno_enterprise/custom/utility/text.less +23 -0
  121. data/app/assets/stylesheets/mno_enterprise/custom/views/apps.less +243 -0
  122. data/app/assets/stylesheets/mno_enterprise/custom/views/myspace.less +477 -0
  123. data/app/assets/stylesheets/mno_enterprise/custom/views/pages/confirmation_lounge.less +31 -0
  124. data/app/assets/stylesheets/mno_enterprise/custom/views/pages/home.less +57 -0
  125. data/app/assets/stylesheets/mno_enterprise/custom/views/pages/oauth-config-page.less +6 -0
  126. data/app/assets/stylesheets/mno_enterprise/custom/views/registration.less +84 -0
  127. data/app/assets/stylesheets/mno_enterprise/custom/views/star.less +18 -0
  128. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/bootstrap-wizard.less +63 -0
  129. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/dashboard-marketplace.less +187 -0
  130. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/dashboard-organization.less +149 -0
  131. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/dashboard-teams.less +119 -0
  132. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/support.less +42 -0
  133. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/dashboard/tickets.less +80 -0
  134. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/mno-editable.less +60 -0
  135. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/notification-widget.less +49 -0
  136. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/password-strength.less +28 -0
  137. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/shopping-cart.less +333 -0
  138. data/app/assets/stylesheets/mno_enterprise/custom/views/templates/star-wizard.less +49 -0
  139. data/app/assets/stylesheets/mno_enterprise/custom/views/user-setup.less +10 -0
  140. data/app/assets/stylesheets/mno_enterprise/custom/xeditable.less +40 -0
  141. data/app/assets/stylesheets/mno_enterprise/font-awesome/font-awesome-regular.less +13 -0
  142. data/app/assets/stylesheets/mno_enterprise/font-awesome/font-awesome-sprockets.less +13 -0
  143. data/app/assets/stylesheets/mno_enterprise/font-awesome/font-awesome.less +16 -0
  144. data/app/assets/stylesheets/mno_enterprise/font-awesome/fonts/FontAwesome.otf +0 -0
  145. data/app/assets/stylesheets/mno_enterprise/font-awesome/fonts/fontawesome-webfont.eot +0 -0
  146. data/app/assets/stylesheets/mno_enterprise/font-awesome/fonts/fontawesome-webfont.svg +640 -0
  147. data/app/assets/stylesheets/mno_enterprise/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
  148. data/app/assets/stylesheets/mno_enterprise/font-awesome/fonts/fontawesome-webfont.woff +0 -0
  149. data/app/assets/stylesheets/mno_enterprise/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
  150. data/app/assets/stylesheets/mno_enterprise/font-awesome/framework/animated.less +34 -0
  151. data/app/assets/stylesheets/mno_enterprise/font-awesome/framework/bordered-pulled.less +25 -0
  152. data/app/assets/stylesheets/mno_enterprise/font-awesome/framework/core.less +12 -0
  153. data/app/assets/stylesheets/mno_enterprise/font-awesome/framework/extras.less +2 -0
  154. data/app/assets/stylesheets/mno_enterprise/font-awesome/framework/fixed-width.less +6 -0
  155. data/app/assets/stylesheets/mno_enterprise/font-awesome/framework/icons.less +677 -0
  156. data/app/assets/stylesheets/mno_enterprise/font-awesome/framework/larger.less +13 -0
  157. data/app/assets/stylesheets/mno_enterprise/font-awesome/framework/list.less +19 -0
  158. data/app/assets/stylesheets/mno_enterprise/font-awesome/framework/mixins.less +26 -0
  159. data/app/assets/stylesheets/mno_enterprise/font-awesome/framework/rotated-flipped.less +20 -0
  160. data/app/assets/stylesheets/mno_enterprise/font-awesome/framework/stacked.less +20 -0
  161. data/app/assets/stylesheets/mno_enterprise/font-awesome/framework/variables.less +687 -0
  162. data/app/assets/stylesheets/mno_enterprise/main.less +132 -0
  163. data/app/assets/stylesheets/mno_enterprise/mixins.less +75 -0
  164. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/alerts.less +73 -0
  165. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/badges.less +65 -0
  166. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/bootstrap.less +50 -0
  167. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/breadcrumbs.less +26 -0
  168. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/button-groups.less +243 -0
  169. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/buttons.less +160 -0
  170. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/carousel.less +269 -0
  171. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/close.less +34 -0
  172. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/code.less +69 -0
  173. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/component-animations.less +34 -0
  174. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/dropdowns.less +214 -0
  175. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/forms.less +566 -0
  176. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/glyphicons.less +301 -0
  177. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/grid.less +84 -0
  178. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/input-groups.less +166 -0
  179. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/jumbotron.less +50 -0
  180. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/labels.less +64 -0
  181. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/list-group.less +124 -0
  182. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/media.less +61 -0
  183. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins.less +39 -0
  184. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/alerts.less +14 -0
  185. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/background-variant.less +8 -0
  186. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/border-radius.less +18 -0
  187. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/buttons.less +52 -0
  188. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/center-block.less +7 -0
  189. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/clearfix.less +22 -0
  190. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/forms.less +85 -0
  191. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/gradients.less +59 -0
  192. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/grid-framework.less +91 -0
  193. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/grid.less +122 -0
  194. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/hide-text.less +21 -0
  195. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/image.less +33 -0
  196. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/labels.less +12 -0
  197. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/list-group.less +29 -0
  198. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/nav-divider.less +10 -0
  199. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/nav-vertical-align.less +9 -0
  200. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/opacity.less +8 -0
  201. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/pagination.less +23 -0
  202. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/panels.less +24 -0
  203. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/progress-bar.less +10 -0
  204. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/reset-filter.less +8 -0
  205. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/resize.less +6 -0
  206. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/responsive-visibility.less +15 -0
  207. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/size.less +10 -0
  208. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/tab-focus.less +9 -0
  209. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/table-row.less +28 -0
  210. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/text-emphasis.less +8 -0
  211. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/text-overflow.less +8 -0
  212. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/mixins/vendor-prefixes.less +227 -0
  213. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/modals.less +148 -0
  214. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/navbar.less +661 -0
  215. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/navs.less +244 -0
  216. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/normalize.less +427 -0
  217. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/pager.less +54 -0
  218. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/pagination.less +88 -0
  219. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/panels.less +265 -0
  220. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/popovers.less +135 -0
  221. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/print.less +107 -0
  222. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/progress-bars.less +87 -0
  223. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/responsive-embed.less +35 -0
  224. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/responsive-utilities.less +194 -0
  225. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/scaffolding.less +150 -0
  226. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/tables.less +234 -0
  227. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/theme.less +273 -0
  228. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/thumbnails.less +36 -0
  229. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/tooltip.less +103 -0
  230. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/type.less +302 -0
  231. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/utilities.less +56 -0
  232. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/variables.less +857 -0
  233. data/app/assets/stylesheets/mno_enterprise/twitter-bootstrap/wells.less +29 -0
  234. data/app/assets/stylesheets/mno_enterprise/variables.less +226 -0
  235. data/app/assets/templates/mno_enterprise/dashboard/account.html +131 -0
  236. data/app/assets/templates/mno_enterprise/dashboard/app_deletion.html +36 -0
  237. data/app/assets/templates/mno_enterprise/dashboard/apps_list.html +103 -0
  238. data/app/assets/templates/mno_enterprise/dashboard/horizontal_menu.html +85 -0
  239. data/app/assets/templates/mno_enterprise/dashboard/marketplace/index.html +60 -0
  240. data/app/assets/templates/mno_enterprise/dashboard/marketplace/show.html +133 -0
  241. data/app/assets/templates/mno_enterprise/dashboard/menu.html +161 -0
  242. data/app/assets/templates/mno_enterprise/dashboard/organization/arrears.html +37 -0
  243. data/app/assets/templates/mno_enterprise/dashboard/organization/billing.html +37 -0
  244. data/app/assets/templates/mno_enterprise/dashboard/organization/credit-card.html +156 -0
  245. data/app/assets/templates/mno_enterprise/dashboard/organization/index.full.html +181 -0
  246. data/app/assets/templates/mno_enterprise/dashboard/organization/index.html +173 -0
  247. data/app/assets/templates/mno_enterprise/dashboard/organization/invoices.html +27 -0
  248. data/app/assets/templates/mno_enterprise/dashboard/organization/members.html +288 -0
  249. data/app/assets/templates/mno_enterprise/dashboard/organization/settings.html +55 -0
  250. data/app/assets/templates/mno_enterprise/dashboard/teams/index.html +175 -0
  251. data/app/assets/templates/mno_enterprise/dashboard/teams/member-add-modal.html +60 -0
  252. data/app/assets/templates/mno_enterprise/dashboard/teams/member-removal-modal.html +35 -0
  253. data/app/assets/templates/mno_enterprise/dashboard/teams/team-add-modal.html +35 -0
  254. data/app/assets/templates/mno_enterprise/dashboard/teams/team-delete-modal.html +35 -0
  255. data/app/assets/templates/mno_enterprise/dashboard/teams/team-list.html +107 -0
  256. data/app/assets/templates/mno_enterprise/default_template.html +20 -0
  257. data/app/assets/templates/mno_enterprise/maestrano-components/autostop_app.html +42 -0
  258. data/app/assets/templates/mno_enterprise/maestrano-components/currency_widget.html +1 -0
  259. data/app/assets/templates/mno_enterprise/maestrano-components/editable.html +28 -0
  260. data/app/assets/templates/mno_enterprise/maestrano-components/loading_lounge.html +63 -0
  261. data/app/assets/templates/mno_enterprise/maestrano-components/modal-messages/congratulations.html +8 -0
  262. data/app/assets/templates/mno_enterprise/maestrano-components/modal-messages/default.html +1 -0
  263. data/app/assets/templates/mno_enterprise/maestrano-components/modal-messages/information.html +8 -0
  264. data/app/assets/templates/mno_enterprise/maestrano-components/notification-widget.html +31 -0
  265. data/app/assets/templates/mno_enterprise/maestrano-components/password.html +55 -0
  266. data/app/assets/templates/mno_enterprise/maestrano-components/star_wizard.html +254 -0
  267. data/app/assets/templates/mno_enterprise/maestrano-components/upload_spreadsheet.html +191 -0
  268. data/app/assets/templates/mno_enterprise/modals/new-organization-reseller-req.html +35 -0
  269. data/app/assets/templates/mno_enterprise/modals/new-organization.html +35 -0
  270. data/app/assets/templates/mno_enterprise/user-setup/index.html +312 -0
  271. data/app/controllers/mno_enterprise/invoices_controller.rb +22 -0
  272. data/app/controllers/mno_enterprise/pages_controller.rb +9 -0
  273. data/app/controllers/mno_enterprise/user_setup_controller.rb +11 -0
  274. data/app/views/layouts/mno_enterprise/_application_js.html.haml +17 -0
  275. data/app/views/layouts/mno_enterprise/_common_cdn_lib_js.html.haml +19 -0
  276. data/app/views/layouts/mno_enterprise/_footer_files.html.haml +5 -0
  277. data/app/views/layouts/mno_enterprise/_header_files.html.haml +31 -0
  278. data/app/views/layouts/mno_enterprise/_impersonate_header.html.haml +7 -0
  279. data/app/views/layouts/mno_enterprise/_public_page_header.html.haml +2 -0
  280. data/app/views/layouts/mno_enterprise/application.html.haml +18 -0
  281. data/app/views/layouts/mno_enterprise/application_dashboard.html.haml +22 -0
  282. data/app/views/layouts/mno_enterprise/third_party/_google_tag_container.html.haml +10 -0
  283. data/app/views/mno_enterprise/pages/app_access_unauthorized.html.haml +19 -0
  284. data/app/views/mno_enterprise/pages/app_logout.html.haml +18 -0
  285. data/app/views/mno_enterprise/pages/billing_details_required.html.haml +19 -0
  286. data/app/views/mno_enterprise/pages/loading.html.haml +3 -0
  287. data/app/views/mno_enterprise/pages/myspace.html.haml +6 -0
  288. data/app/views/mno_enterprise/provision/_provision_apps.html.haml +43 -0
  289. data/app/views/mno_enterprise/provision/_select_organization.html.haml +17 -0
  290. data/app/views/mno_enterprise/provision/new.html.haml +4 -0
  291. data/app/views/mno_enterprise/user_setup/index.html.haml +2 -0
  292. data/config/initializers/ng-annotate.rb +3 -0
  293. data/config/initializers/ng-performance.rb +3 -0
  294. data/config/routes.rb +19 -0
  295. data/lib/assets/javascripts/impac-angular.js +8719 -0
  296. data/lib/assets/stylesheets/impac-angular.less +2352 -0
  297. data/lib/mno-enterprise-frontend.rb +1 -0
  298. data/lib/mno_enterprise/frontend.rb +13 -0
  299. data/lib/mno_enterprise/frontend/assets_util.rb +47 -0
  300. data/lib/mno_enterprise/frontend/concerns/README.md +6 -0
  301. data/lib/mno_enterprise/frontend/concerns/controllers/pages_controller.rb +25 -0
  302. data/lib/mno_enterprise/frontend/engine.rb +13 -0
  303. data/spec/controllers/mno_enterprise/auth/confirmations_controller_spec.rb +84 -0
  304. data/spec/controllers/mno_enterprise/invoices_controller_spec.rb +34 -0
  305. data/spec/controllers/mno_enterprise/pages_controller_spec.rb +42 -0
  306. data/spec/controllers/mno_enterprise/user_setup_controller_spec.rb +33 -0
  307. data/spec/controllers/mno_enterprise/webhook/o_auth_controller_spec.rb +76 -0
  308. data/spec/rails_helper.rb +92 -0
  309. data/spec/routing/mno_enterprise/invoices_controller_routing_spec.rb +11 -0
  310. data/spec/routing/mno_enterprise/pages_controller_routing_spec.rb +18 -0
  311. data/spec/routing/mno_enterprise/user_setup_controller_routing_spec.rb +11 -0
  312. data/spec/spec_helper.rb +78 -0
  313. metadata +464 -0
@@ -0,0 +1,33 @@
1
+ module = angular.module('maestrano.components.file-model',[])
2
+
3
+ # Allows angular binding on <input type="file">
4
+ # Usage: <input type="file" file-model="someScopeObject.file">
5
+ module.directive("fileModel", [
6
+ '$parse', '$compile',
7
+ ($parse, $compile) ->
8
+ return {
9
+ restrict: 'A',
10
+ link: (scope, element, attrs) ->
11
+ model = $parse(attrs.fileModel)
12
+ modelSetter = model.assign
13
+
14
+ element.bind('change', ->
15
+ scope.$apply( ->
16
+ modelSetter(scope, element[0].files[0])
17
+ )
18
+ )
19
+
20
+ # The filelist on an <input type="file"> is read only
21
+ # which means we cannot clear the list of files attached to it
22
+ # --
23
+ # The watcher below detects when the file-model is set to null,
24
+ # undefined or '' and automatically replaces the input element
25
+ # by a new one (no filelist attached)
26
+ scope.$watch(model
27
+ , (value, oldValue)->
28
+ if !angular.equals(value,oldValue) && (!value? || value = '')
29
+ clone = $compile(element.clone())(scope)
30
+ element.replaceWith(clone)
31
+ )
32
+ }
33
+ ])
@@ -0,0 +1,22 @@
1
+ # This main module requires all the sub-modules that should compose it
2
+ # This pattern allows us to split a fat module in several files
3
+ maestranoComponents = angular.module('maestrano.components', [
4
+ 'maestrano.components.mno-match',
5
+ 'maestrano.components.mno-flash-msg',
6
+ 'maestrano.components.mno-helptext',
7
+ 'maestrano.components.mno-autostop-app',
8
+ 'maestrano.components.mno-notification-widget',
9
+ 'maestrano.components.mno-loading-lounge',
10
+ 'maestrano.components.mno-scroll-to',
11
+ 'maestrano.components.mno-currency-widget',
12
+ 'maestrano.components.file-model',
13
+ 'maestrano.components.mno-price-converter',
14
+ 'maestrano.components.mno-current-currency',
15
+ 'maestrano.components.mno-password-strength',
16
+ 'maestrano.components.mno-editable',
17
+ 'maestrano.components.mno-typeahead',
18
+ 'maestrano.components.mno-message-modal',
19
+ 'maestrano.components.mno-compile',
20
+ 'maestrano.components.mno-password',
21
+ ]
22
+ )
@@ -0,0 +1,123 @@
1
+ module = angular.module('maestrano.components.mno-autostop-app',['maestrano.assets'])
2
+
3
+ #============================================
4
+ # Component 'Select App'
5
+ #============================================
6
+ module.controller('MnoAutostopAppCtrl',[
7
+ '$scope', '$rootScope', '$window', 'MsgBus', 'Utilities','$modal', '$http'
8
+ ($scope, $rootScope, $window, MsgBus, Utilities, $modal, $http) ->
9
+ $scope.assetPath = $rootScope.assetPath
10
+ $scope.windowHeight = $window.innerHeight
11
+
12
+ #===================================
13
+ # Load Scope
14
+ #===================================
15
+ $scope.autostopModal = autostopModal = {}
16
+ $scope.currentAppBeingAsked = undefined
17
+
18
+
19
+ if angular.isArray($scope.mnoAutostopApp())
20
+ $scope.appQueue = appQueue = $scope.mnoAutostopApp
21
+ else if angular.isObject($scope.mnoAutostopApp())
22
+ $scope.appQueue = appQueue = (->[$scope.mnoAutostopApp()])
23
+ else
24
+ $scope.appQueue = appQueue = MsgBus.subscribe('autostopQueue')
25
+
26
+ #===================================
27
+ # Watch the queue and open modals
28
+ # successively until empty
29
+ #===================================
30
+ $scope.$watch(
31
+ () ->
32
+ if !autostopModal.isOpen
33
+ if $scope.currentAppBeingAsked != undefined
34
+ autostopModal.open($scope.currentAppBeingAsked)
35
+ else if appQueue().length > 0
36
+ $scope.currentAppBeingAsked = appQueue()[0]
37
+ ,(->))
38
+
39
+
40
+ #===================================
41
+ # AutostopModal
42
+ #===================================
43
+ # Open the autostopModal and reset the proceed action
44
+ autostopModal.open = (instance) ->
45
+ self = autostopModal
46
+ self.$instance = $modal.open(templateUrl: 'internal-autostop-modal.html', scope: $scope)
47
+ self.isOpen = true
48
+ self.instance = instance
49
+ self.defaultDuration = 1
50
+ self.model = {}
51
+ self.model.duration = self.defaultDuration
52
+ if instance.name
53
+ self.title = "Choose idle time for #{instance.name}"
54
+ else if instance.appName
55
+ self.title = "Choose idle time for #{instance.appName}"
56
+ else
57
+ self.title = "Choose idle time for this app"
58
+
59
+ self.proceed = () ->
60
+ self.inProgress = true
61
+
62
+ if self.model.duration != self.defaultDuration
63
+ $http.put("/app_instances/#{instance.id}/autostop", {duration: self.model.duration}).then(
64
+ (success) ->
65
+ self.close()
66
+ (error) ->
67
+ self.errors = Utilities.processRailsError(error)
68
+ self.inProgress = false
69
+ )
70
+ else
71
+ self.close()
72
+
73
+ autostopModal.availableDurations = () ->
74
+ self = autostopModal
75
+ return [1,2,3,4,5,6,8,10]
76
+
77
+
78
+ autostopModal.select = (duration) ->
79
+ self = autostopModal
80
+ self.model.duration = duration
81
+
82
+
83
+ autostopModal.classFor = (duration) ->
84
+ self = autostopModal
85
+ if duration == self.model.duration
86
+ return "selected"
87
+
88
+ autostopModal.proceedEnabled = () ->
89
+ return true
90
+
91
+ autostopModal.text = () ->
92
+ self = autostopModal
93
+ return "Your app will automatically be offlined after <b class=\"text-info\">#{self.model.duration} hour(s)</b> of inactivity."
94
+
95
+ # Close the transferModal and reset its values
96
+ autostopModal.close = () ->
97
+ self = autostopModal
98
+ self.$instance.close()
99
+ self.errors = []
100
+ $scope.currentAppBeingAsked = undefined
101
+ self.inProgress = false
102
+ self.model = {}
103
+ self.instance = {}
104
+ self.cancel = self.defaultProceed
105
+ self.isOpen = false
106
+ appQueue().shift()
107
+
108
+
109
+ # This is the default proceed method
110
+ autostopModal.defaultProceed = () ->
111
+ autostopModal.close()
112
+ ])
113
+
114
+ module.directive('mnoAutostopApp', ['TemplatePath', (TemplatePath) ->
115
+ return {
116
+ restrict: 'A',
117
+ scope: {
118
+ mnoAutostopApp: '&'
119
+ },
120
+ templateUrl: TemplatePath['mno_enterprise/maestrano-components/autostop_app.html'],
121
+ controller: 'MnoAutostopAppCtrl'
122
+ }
123
+ ])
@@ -0,0 +1,18 @@
1
+ module = angular.module('maestrano.components.mno-compile',[])
2
+
3
+ module.directive('compile', ['$compile', ($compile) ->
4
+ (scope, element, attrs) ->
5
+ scope.$watch ((scope) ->
6
+ # watch the 'compile' expression for changes
7
+ scope.$eval attrs.compile
8
+ ), (value) ->
9
+ # when the 'compile' expression changes
10
+ # assign it into the current DOM
11
+ element.html value
12
+
13
+ # compile the new DOM and link it to the current
14
+ # scope.
15
+ # NOTE: we only compile .childNodes so that
16
+ # we don't get into infinite loop compiling ourselves
17
+ return $compile(element.contents()) scope
18
+ ])
@@ -0,0 +1,43 @@
1
+ module = angular.module('maestrano.components.mno-currency-widget',['maestrano.assets'])
2
+
3
+ #============================================
4
+ # Component 'Currency Widget'
5
+ #============================================
6
+
7
+
8
+ module.controller('MnoCurrencyWidgetCtrl',['$scope', 'CurrentCurrency', ($scope, CurrentCurrency) ->
9
+
10
+
11
+ $scope.currencies = ["USD","AUD","CAD","CNY","EUR","GBP","HKD","INR","JPY","NZD","SGD","PHP"]
12
+ $scope.currentCurrency = CurrentCurrency.val
13
+
14
+ # Set the currency
15
+ $scope.setCurrency = (currency) ->
16
+ CurrentCurrency.val = currency
17
+
18
+ # Outject 'selectedCurrency' function in scope.
19
+ # 'selected-currency' is accessible via directive attribute
20
+ # and can be called by other element on the page that are
21
+ # not angular ready (haml pages)
22
+ $scope.selectedCurrency = ->
23
+ return CurrentCurrency.val
24
+
25
+ # Initialize current currency based on user location
26
+ curr = if window.currentVisitorCountryCode is "AU" then "AUD" else "USD"
27
+ $scope.setCurrency(curr)
28
+
29
+ ])
30
+
31
+ module.directive('mnoCurrencyWidget', ['TemplatePath', '$timeout', (TemplatePath, $timeout) ->
32
+ return {
33
+ link: (scope,element,attrs) ->
34
+ $timeout ->
35
+ $('select.select-picker').selectpicker()
36
+ ,1000
37
+ restrict: 'A',
38
+ scope:
39
+ selectedCurrency: '=?'
40
+ templateUrl: TemplatePath['mno_enterprise/maestrano-components/currency_widget.html'],
41
+ controller: 'MnoCurrencyWidgetCtrl',
42
+ }
43
+ ])
@@ -0,0 +1,22 @@
1
+ module = angular.module('maestrano.components.mno-current-currency',['maestrano.assets'])
2
+
3
+ #============================================
4
+ # Component 'Current Currency'
5
+ #============================================
6
+
7
+
8
+ module.controller('MnoCurrentCurrencyCtrl',['$scope', 'CurrentCurrency', ($scope, CurrentCurrency) ->
9
+
10
+ $scope.currentCurrency = ->
11
+ return CurrentCurrency.val
12
+
13
+ ])
14
+
15
+ module.directive('mnoCurrentCurrency', ['TemplatePath', (TemplatePath) ->
16
+ return {
17
+ restrict: 'A',
18
+ scope: {}
19
+ template: "<span>{{currentCurrency()}}</span>",
20
+ controller: 'MnoCurrentCurrencyCtrl',
21
+ }
22
+ ])
@@ -0,0 +1,68 @@
1
+ module = angular.module('maestrano.components.mno-editable',['maestrano.assets'])
2
+
3
+ #============================================
4
+ # Component
5
+ #============================================
6
+ module.controller('MnoEditableCtrl',[
7
+ '$scope','$http','$element',
8
+ ($scope, $http, $element) ->
9
+
10
+ $scope.model = { orig:$scope.initialValue, value:$scope.initialValue }
11
+
12
+ # Perform an ajax request to update the content element
13
+ $scope.updateField = () ->
14
+ route = "/mnoe/jpi/v1/admin/content/#{$scope.contentableId}"
15
+ data = {
16
+ contentable_type: $scope.contentableType
17
+ field_name: $scope.fieldName
18
+ value: $scope.model.value
19
+ }
20
+ $http.put(route,data).then(
21
+ (success) ->
22
+ $scope.model.orig = $scope.model.value
23
+ ,(error) ->
24
+ $scope.model.value = $scope.model.orig
25
+ )
26
+ return true
27
+
28
+ $scope.uploadImage = () ->
29
+ opts = { transformRequest: angular.identity, headers: {'Content-Type': undefined} }
30
+ route = "/mnoe/jpi/v1/admin/content/#{$scope.contentableId}/upload_image"
31
+ data = new FormData()
32
+ data.append('image',$scope.model.image)
33
+ data.append('contentable_type',$scope.contentableType)
34
+ data.append('field_name',$scope.fieldName)
35
+ $http.put(route,data,opts).then(
36
+ (success) ->
37
+ $scope.model.orig = success.data
38
+ )
39
+
40
+ ])
41
+
42
+ module.directive('mnoEditable', ['TemplatePath', (TemplatePath) ->
43
+ return {
44
+ restrict: 'A',
45
+ scope: {
46
+ contentableType:'@'
47
+ contentableId:'@'
48
+ fieldName:'@'
49
+ contentType:'@'
50
+ initialValue:'@'
51
+ customStyle:'@'
52
+ },
53
+ controller: 'MnoEditableCtrl'
54
+ templateUrl: TemplatePath['mno_enterprise/maestrano-components/editable.html'],
55
+ link: (scope, element, attrs) ->
56
+ scope.showForm = false
57
+ element.on("mouseenter", ->
58
+ scope.showForm = true
59
+ scope.$apply()
60
+ )
61
+
62
+ element.on("mouseleave", ->
63
+ scope.showForm = false
64
+ scope.$apply()
65
+ )
66
+
67
+ }
68
+ ])
@@ -0,0 +1,40 @@
1
+ module = angular.module('maestrano.components.mno-flash-msg',[])
2
+
3
+ #============================================
4
+ # Component 'Flash Msg'
5
+ #============================================
6
+ module.controller('MnoFlashMsgCtrl',[
7
+ '$scope', 'MsgBus',
8
+ ($scope, MsgBus) ->
9
+
10
+ # Message bus connection
11
+ $scope.errors = MsgBus.subscribe('errors')
12
+
13
+ # Only show the flash message if
14
+ # there are errors in the pipe
15
+ $scope.isFlashShown = () ->
16
+ $scope.errors().length > 0
17
+
18
+ # Empty the errors array in the MsgBus
19
+ $scope.closeFlash = () ->
20
+ MsgBus.publish('errors',[])
21
+
22
+ ])
23
+
24
+ module.directive('mnoFlashMsg', ['TemplatePath', (TemplatePath) ->
25
+ return {
26
+ restrict: 'A'
27
+ scope: {}
28
+ controller: 'MnoFlashMsgCtrl'
29
+ template: '
30
+ <div class="alert alert-error alert-top fade" ng-class="isFlashShown() && \'in\'">
31
+ <button class="close" ng-click="closeFlash()">&times;</button>
32
+ <strong>Snap! This action couldn\'t be performed.</strong>
33
+ <ul>
34
+ <li ng-repeat="error in errors()">
35
+ {{error}}
36
+ </li>
37
+ </ul>
38
+ </div>'
39
+ }
40
+ ])
@@ -0,0 +1,38 @@
1
+ module = angular.module('maestrano.components.mno-helptext',[])
2
+
3
+ module.directive("mnoHelptext", ['$window', ($window) ->
4
+ return {
5
+ restrict: 'A'
6
+ link: (scope, elem, attrs, ctrl) ->
7
+ delay = attrs.helptextDelay
8
+ scope.$watch(
9
+ () ->
10
+ attrs.mnoHelptext
11
+ ,() ->
12
+ $(elem).tooltip({
13
+ title: attrs.mnoHelptext,
14
+ html: true,
15
+ delay: {
16
+ show: (delay || 1000)
17
+ hide: 100
18
+ },
19
+ animation: false,
20
+ placement: () ->
21
+ if attrs.helptextPlacement
22
+ return attrs.helptextPlacement
23
+ else
24
+ # Calculate remaining space on bottom, right, left
25
+ remainingBottom = $($window).height() + $($window).scrollTop() - $(elem).offset().top - $(elem).height()
26
+ remainingLeft = $(elem).offset().left - $($window).scrollLeft()
27
+ remainingRight = $($window).width() - remainingLeft - $(elem).width()
28
+
29
+ # Adjust positioning based on remaining space
30
+ # Note that according to the rules below bottom is clearly preferred
31
+ position = (if remainingBottom < 200 then 'top' else 'bottom')
32
+ position = 'right' if remainingLeft < 50
33
+ position = 'left' if remainingRight < 50
34
+ return position
35
+ })
36
+ )
37
+ }
38
+ ])
@@ -0,0 +1,184 @@
1
+ module = angular.module('maestrano.components.mno-loading-lounge',['maestrano.assets'])
2
+
3
+ #============================================
4
+ # Component 'LoadingLounge'
5
+ # --
6
+ # Standalone component used on the app loading
7
+ # page
8
+ #============================================
9
+ module.controller('MnoLoadingLoungeCtrl',[
10
+ '$scope', '$http', 'AssetPath', 'Utilities', '$window', '$timeout'
11
+ ($scope, $http, AssetPath, Utilities, $window, $timeout) ->
12
+
13
+ #==========================
14
+ # Init
15
+ #==========================
16
+ $scope.assetPath = AssetPath
17
+ $scope.appInstance = appInstance = $scope.mnoLoadingLounge()
18
+ appInstanceId = $scope.mnoLoadingLounge().id
19
+
20
+ $scope.redirectionCounter = 5 #seconds
21
+ $scope.scheduler = null
22
+ $scope.redirectScheduler = null
23
+
24
+
25
+ #==========================
26
+ # Helpers
27
+ #==========================
28
+ currentStatus = $scope.currentStatus = () ->
29
+ if appInstance.id
30
+ if appInstance.errors && appInstance.errors.length > 0
31
+ 'errors'
32
+ else if appInstance.status in ['terminating','terminated']
33
+ 'terminated'
34
+ else if appInstance.status == 'running' && appInstance.is_online
35
+ 'online'
36
+ else if appInstance.status in ['provisioning','staged']
37
+ 'creating'
38
+ else if appInstance.status == 'updating' || (appInstance.status == 'running' && !appInstance.is_online)
39
+ 'updating'
40
+ else
41
+ # starting/stopping
42
+ # Note: If 'stopping' and no errors it means that a start has been
43
+ # successfully requested
44
+ 'loading'
45
+ else
46
+ 'not_found'
47
+
48
+ $scope.errorMessages = () ->
49
+ Utilities.processRailsError(appInstance.errors)
50
+
51
+ $scope.isProgressBarShown = () ->
52
+ currentStatus() == 'creating' || currentStatus() == 'loading'
53
+
54
+ # Return the action progression in percent
55
+ # unit
56
+ # Eg. $scope.progressBarPercent() -> 95%
57
+ $scope.progressBarPercent = () ->
58
+ # Get out of there if the bar is not shown
59
+ if !$scope.isProgressBarShown()
60
+ return 0
61
+
62
+ # Get the relevant status from an actionProgress
63
+ # point of view
64
+ realStatus = appInstance.status
65
+ realStatus = 'provisioning' if realStatus == 'staged'
66
+ realStatus = 'starting' if realStatus == 'restarting'
67
+
68
+ # Get the maxDuration (seconds) for the current action
69
+ # In case the app is stopping we consider that a start
70
+ # has been requested. Therefore we add the starting
71
+ # time on top of it
72
+ maxDuration = appInstance.durations[realStatus]
73
+ maxDuration += appInstance.durations['starting'] if realStatus == 'stopping'
74
+
75
+ # Get the referenceField based on
76
+ # the action being performed
77
+ referenceField = {
78
+ 'provisioning': 'created_at',
79
+ 'starting': 'started_at',
80
+ 'stopping': 'stopped_at',
81
+ }[realStatus]
82
+
83
+ # Get the action elapsed time in seconds
84
+ startTime = new Date(appInstance[referenceField])
85
+ endTime = new Date(appInstance.server_time)
86
+ elapsedTime = (endTime.getTime() - startTime.getTime()) / 1000
87
+
88
+ # Calculate the percentage
89
+ # Max value is 95% / Min value is 5%
90
+ # Cesar: test should prevent division by 0 and display of "Nan%"
91
+ if (maxDuration > 0)
92
+ percent = Math.round((elapsedTime / maxDuration)*100)
93
+ percent = Math.min(percent, 95)
94
+ percent = Math.max(percent, 5)
95
+ else
96
+ percent = 95
97
+
98
+ percent = "#{percent}%"
99
+ return percent
100
+
101
+ reloadAppInstance = (_appInstance)->
102
+ q = $http.get($window.location.pathname)
103
+ q.then(
104
+ (success) ->
105
+ angular.copy(success.data,_appInstance)
106
+ )
107
+ return q
108
+
109
+ $scope.startAutoRefresh = () ->
110
+ intervalMilliSec = 5 * 1000 # 15s
111
+ # Make sure we cancel any previous
112
+ # scheduler first
113
+ if $scope.scheduler?
114
+ $timeout.cancel($scope.scheduler)
115
+
116
+ # Configure the scheduler
117
+ $scope.scheduler = $timeout(->
118
+ reloadAppInstance(appInstance)
119
+ $scope.startAutoRefresh()
120
+ ,intervalMilliSec)
121
+
122
+ $scope.stopAutoRefresh = () ->
123
+ if $scope.scheduler?
124
+ $timeout.cancel($scope.scheduler)
125
+
126
+ $scope.redirectUrl = ->
127
+ "/mnoe/launch/#{appInstance.uid}"
128
+
129
+ $scope.performRedirection = () ->
130
+ # Then reload the page
131
+ window.location = $scope.redirectUrl()
132
+
133
+ $scope.startRedirectCountdown = () ->
134
+ intervalMilliSec = 1 * 1000
135
+ # Make sure we cancel any previous
136
+ # scheduler first
137
+ if $scope.redirectScheduler?
138
+ $timeout.cancel($scope.redirectScheduler)
139
+
140
+ # Configure the scheduler
141
+ $scope.redirectScheduler = $timeout(->
142
+ $scope.redirectionCounter -= 1
143
+ $scope.startRedirectCountdown() if $scope.redirectionCounter > 0
144
+ $scope.performRedirection() if $scope.redirectionCounter == 0
145
+ ,intervalMilliSec)
146
+
147
+
148
+ $scope.stopRedirectCountdown = () ->
149
+ if $scope.redirectScheduler?
150
+ $timeout.cancel($scope.redirectScheduler)
151
+ $scope.redirectionCounter = 5
152
+
153
+ #==========================
154
+ # Watchers
155
+ #==========================
156
+ # Watch status
157
+ $scope.$watch(
158
+ (-> currentStatus())
159
+ ,(status)->
160
+ # Enable appInstance refresh?
161
+ if status == 'loading' || status == 'creating' || status == 'updating'
162
+ $scope.startAutoRefresh() unless $scope.scheduler
163
+ else
164
+ $scope.stopAutoRefresh() if $scope.scheduler
165
+
166
+ # Enable redirection counter?
167
+ if status == 'online'
168
+ $scope.startRedirectCountdown() unless $scope.redirectScheduler
169
+ else
170
+ $scope.stopRedirectCountdown() if $scope.redirectScheduler
171
+ )
172
+
173
+ ])
174
+
175
+ module.directive('mnoLoadingLounge', ['TemplatePath', (TemplatePath) ->
176
+ return {
177
+ restrict: 'AE',
178
+ scope: {
179
+ mnoLoadingLounge: '&'
180
+ },
181
+ templateUrl: TemplatePath['mno_enterprise/maestrano-components/loading_lounge.html'],
182
+ controller: 'MnoLoadingLoungeCtrl'
183
+ }
184
+ ])