routes.ts 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. ///<reference path="../../headers/common.d.ts" />
  2. import './dashboard_loaders';
  3. import angular from 'angular';
  4. import coreModule from 'app/core/core_module';
  5. import {BundleLoader} from './bundle_loader';
  6. /** @ngInject **/
  7. function setupAngularRoutes($routeProvider, $locationProvider) {
  8. $locationProvider.html5Mode(true);
  9. var loadOrgBundle = new BundleLoader('app/features/org/all');
  10. var loadPluginsBundle = new BundleLoader('app/features/plugins/all');
  11. var loadAdminBundle = new BundleLoader('app/features/admin/admin');
  12. $routeProvider
  13. .when('/', {
  14. templateUrl: 'public/app/partials/dashboard.html',
  15. controller : 'LoadDashboardCtrl',
  16. reloadOnSearch: false,
  17. pageClass: 'page-dashboard',
  18. })
  19. .when('/dashboard/:type/:slug', {
  20. templateUrl: 'public/app/partials/dashboard.html',
  21. controller : 'LoadDashboardCtrl',
  22. reloadOnSearch: false,
  23. pageClass: 'page-dashboard',
  24. })
  25. .when('/dashboard-solo/:type/:slug', {
  26. templateUrl: 'public/app/features/panel/partials/soloPanel.html',
  27. controller : 'SoloPanelCtrl',
  28. pageClass: 'page-dashboard',
  29. })
  30. .when('/dashboard-import/:file', {
  31. templateUrl: 'public/app/partials/dashboard.html',
  32. controller : 'DashFromImportCtrl',
  33. reloadOnSearch: false,
  34. pageClass: 'page-dashboard',
  35. })
  36. .when('/dashboard/new', {
  37. templateUrl: 'public/app/partials/dashboard.html',
  38. controller : 'NewDashboardCtrl',
  39. reloadOnSearch: false,
  40. pageClass: 'page-dashboard',
  41. })
  42. .when('/import/dashboard', {
  43. templateUrl: 'public/app/features/dashboard/partials/import.html',
  44. controller : 'DashboardImportCtrl',
  45. })
  46. .when('/datasources', {
  47. templateUrl: 'public/app/features/plugins/partials/ds_list.html',
  48. controller : 'DataSourcesCtrl',
  49. controllerAs: 'ctrl',
  50. resolve: loadPluginsBundle,
  51. })
  52. .when('/datasources/edit/:id', {
  53. templateUrl: 'public/app/features/plugins/partials/ds_edit.html',
  54. controller : 'DataSourceEditCtrl',
  55. controllerAs: 'ctrl',
  56. resolve: loadPluginsBundle,
  57. })
  58. .when('/datasources/new', {
  59. templateUrl: 'public/app/features/plugins/partials/ds_edit.html',
  60. controller : 'DataSourceEditCtrl',
  61. controllerAs: 'ctrl',
  62. resolve: loadPluginsBundle,
  63. })
  64. .when('/org', {
  65. templateUrl: 'public/app/features/org/partials/orgDetails.html',
  66. controller : 'OrgDetailsCtrl',
  67. resolve: loadOrgBundle,
  68. })
  69. .when('/org/new', {
  70. templateUrl: 'public/app/features/org/partials/newOrg.html',
  71. controller : 'NewOrgCtrl',
  72. resolve: loadOrgBundle,
  73. })
  74. .when('/org/users', {
  75. templateUrl: 'public/app/features/org/partials/orgUsers.html',
  76. controller : 'OrgUsersCtrl',
  77. controllerAs: 'ctrl',
  78. resolve: loadOrgBundle,
  79. })
  80. .when('/org/apikeys', {
  81. templateUrl: 'public/app/features/org/partials/orgApiKeys.html',
  82. controller : 'OrgApiKeysCtrl',
  83. resolve: loadOrgBundle,
  84. })
  85. .when('/profile', {
  86. templateUrl: 'public/app/features/org/partials/profile.html',
  87. controller : 'ProfileCtrl',
  88. controllerAs: 'ctrl',
  89. resolve: loadOrgBundle,
  90. })
  91. .when('/profile/password', {
  92. templateUrl: 'public/app/features/org/partials/change_password.html',
  93. controller : 'ChangePasswordCtrl',
  94. resolve: loadOrgBundle,
  95. })
  96. .when('/profile/select-org', {
  97. templateUrl: 'public/app/features/org/partials/select_org.html',
  98. controller : 'SelectOrgCtrl',
  99. resolve: loadOrgBundle,
  100. })
  101. // ADMIN
  102. .when('/admin', {
  103. templateUrl: 'public/app/features/admin/partials/admin_home.html',
  104. controller : 'AdminHomeCtrl',
  105. resolve: loadAdminBundle,
  106. })
  107. .when('/admin/settings', {
  108. templateUrl: 'public/app/features/admin/partials/settings.html',
  109. controller : 'AdminSettingsCtrl',
  110. resolve: loadAdminBundle,
  111. })
  112. .when('/admin/users', {
  113. templateUrl: 'public/app/features/admin/partials/users.html',
  114. controller : 'AdminListUsersCtrl',
  115. resolve: loadAdminBundle,
  116. })
  117. .when('/admin/users/create', {
  118. templateUrl: 'public/app/features/admin/partials/new_user.html',
  119. controller : 'AdminEditUserCtrl',
  120. resolve: loadAdminBundle,
  121. })
  122. .when('/admin/users/edit/:id', {
  123. templateUrl: 'public/app/features/admin/partials/edit_user.html',
  124. controller : 'AdminEditUserCtrl',
  125. resolve: loadAdminBundle,
  126. })
  127. .when('/admin/orgs', {
  128. templateUrl: 'public/app/features/admin/partials/orgs.html',
  129. controller : 'AdminListOrgsCtrl',
  130. resolve: loadAdminBundle,
  131. })
  132. .when('/admin/orgs/edit/:id', {
  133. templateUrl: 'public/app/features/admin/partials/edit_org.html',
  134. controller : 'AdminEditOrgCtrl',
  135. resolve: loadAdminBundle,
  136. })
  137. .when('/admin/stats', {
  138. templateUrl: 'public/app/features/admin/partials/stats.html',
  139. controller : 'AdminStatsCtrl',
  140. controllerAs: 'ctrl',
  141. resolve: loadAdminBundle,
  142. })
  143. // LOGIN / SIGNUP
  144. .when('/login', {
  145. templateUrl: 'public/app/partials/login.html',
  146. controller : 'LoginCtrl',
  147. })
  148. .when('/invite/:code', {
  149. templateUrl: 'public/app/partials/signup_invited.html',
  150. controller : 'InvitedCtrl',
  151. })
  152. .when('/signup', {
  153. templateUrl: 'public/app/partials/signup_step2.html',
  154. controller : 'SignUpCtrl',
  155. })
  156. .when('/user/password/send-reset-email', {
  157. templateUrl: 'public/app/partials/reset_password.html',
  158. controller : 'ResetPasswordCtrl',
  159. })
  160. .when('/user/password/reset', {
  161. templateUrl: 'public/app/partials/reset_password.html',
  162. controller : 'ResetPasswordCtrl',
  163. })
  164. .when('/dashboard/snapshots', {
  165. templateUrl: 'public/app/features/snapshot/partials/snapshots.html',
  166. controller : 'SnapshotsCtrl',
  167. controllerAs: 'ctrl',
  168. })
  169. .when('/plugins', {
  170. templateUrl: 'public/app/features/plugins/partials/plugin_list.html',
  171. controller: 'PluginListCtrl',
  172. controllerAs: 'ctrl',
  173. resolve: loadPluginsBundle,
  174. })
  175. .when('/plugins/:pluginId/edit', {
  176. templateUrl: 'public/app/features/plugins/partials/plugin_edit.html',
  177. controller: 'PluginEditCtrl',
  178. controllerAs: 'ctrl',
  179. resolve: loadPluginsBundle,
  180. })
  181. .when('/plugins/:pluginId/page/:slug', {
  182. templateUrl: 'public/app/features/plugins/partials/plugin_page.html',
  183. controller: 'AppPageCtrl',
  184. controllerAs: 'ctrl',
  185. resolve: loadPluginsBundle,
  186. })
  187. .when('/global-alerts', {
  188. templateUrl: 'public/app/features/dashboard/partials/globalAlerts.html',
  189. })
  190. .when('/styleguide/:page?', {
  191. controller: 'StyleGuideCtrl',
  192. controllerAs: 'ctrl',
  193. templateUrl: 'public/app/features/styleguide/styleguide.html',
  194. })
  195. .otherwise({
  196. templateUrl: 'public/app/partials/error.html',
  197. controller: 'ErrorCtrl'
  198. });
  199. }
  200. coreModule.config(setupAngularRoutes);