routes.ts 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  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('/dashboards/migrate', {
  43. templateUrl: 'public/app/features/dashboard/partials/migrate.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('/styleguide/:page?', {
  188. controller: 'StyleGuideCtrl',
  189. controllerAs: 'ctrl',
  190. templateUrl: 'public/app/features/styleguide/styleguide.html',
  191. })
  192. .when('/alerting', {
  193. templateUrl: 'public/app/features/alerting/partials/alert_list.html',
  194. controller: 'AlertListCtrl',
  195. controllerAs: 'ctrl',
  196. resolve: loadAlertingBundle,
  197. })
  198. .when('/alerting/notifications', {
  199. templateUrl: 'public/app/features/alerting/partials/notifications_list.html',
  200. controller: 'AlertNotificationsListCtrl',
  201. controllerAs: 'ctrl',
  202. resolve: loadAlertingBundle,
  203. })
  204. .when('/alerting/notification/new', {
  205. templateUrl: 'public/app/features/alerting/partials/notification_edit.html',
  206. controller: 'AlertNotificationEditCtrl',
  207. controllerAs: 'ctrl',
  208. resolve: loadAlertingBundle,
  209. })
  210. .when('/alerting/notification/:id/edit', {
  211. templateUrl: 'public/app/features/alerting/partials/notification_edit.html',
  212. controller: 'AlertNotificationEditCtrl',
  213. controllerAs: 'ctrl',
  214. resolve: loadAlertingBundle,
  215. })
  216. .when('/alerting/:alertId/states', {
  217. templateUrl: 'public/app/features/alerting/partials/alert_log.html',
  218. controller: 'AlertLogCtrl',
  219. controllerAs: 'ctrl',
  220. resolve: loadAlertingBundle,
  221. })
  222. .otherwise({
  223. templateUrl: 'public/app/partials/error.html',
  224. controller: 'ErrorCtrl'
  225. });
  226. }
  227. coreModule.config(setupAngularRoutes);