routes.ts 7.2 KB

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