routes.ts 7.2 KB

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