routes.ts 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282
  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('/dashboard/import', {
  47. templateUrl: 'public/app/features/dashboard/partials/dashboardImport.html',
  48. controller : 'DashboardImportCtrl',
  49. controllerAs: 'ctrl',
  50. })
  51. .when('/datasources', {
  52. templateUrl: 'public/app/features/plugins/partials/ds_list.html',
  53. controller : 'DataSourcesCtrl',
  54. controllerAs: 'ctrl',
  55. })
  56. .when('/datasources/edit/:id', {
  57. templateUrl: 'public/app/features/plugins/partials/ds_edit.html',
  58. controller : 'DataSourceEditCtrl',
  59. controllerAs: 'ctrl',
  60. })
  61. .when('/datasources/new', {
  62. templateUrl: 'public/app/features/plugins/partials/ds_edit.html',
  63. controller : 'DataSourceEditCtrl',
  64. controllerAs: 'ctrl',
  65. })
  66. .when('/dashboards', {
  67. templateUrl: 'public/app/features/dashboard/partials/dashboard_list.html',
  68. controller : 'DashboardListCtrl',
  69. controllerAs: 'ctrl',
  70. })
  71. .when('/dashboards/folder/new', {
  72. templateUrl: 'public/app/features/dashboard/partials/create_folder.html',
  73. controller : 'CreateFolderCtrl',
  74. controllerAs: 'ctrl',
  75. })
  76. .when('/dashboards/folder/:folderId/:slug/permissions', {
  77. templateUrl: 'public/app/features/dashboard/partials/folder_permissions.html',
  78. controller : 'FolderPermissionsCtrl',
  79. controllerAs: 'ctrl',
  80. })
  81. .when('/dashboards/folder/:folderId/:slug/settings', {
  82. templateUrl: 'public/app/features/dashboard/partials/folder_settings.html',
  83. controller : 'FolderSettingsCtrl',
  84. controllerAs: 'ctrl',
  85. })
  86. .when('/dashboards/folder/:folderId/:slug', {
  87. templateUrl: 'public/app/features/dashboard/partials/folder_dashboards.html',
  88. controller : 'FolderDashboardsCtrl',
  89. controllerAs: 'ctrl',
  90. })
  91. .when('/org', {
  92. templateUrl: 'public/app/features/org/partials/orgDetails.html',
  93. controller : 'OrgDetailsCtrl',
  94. resolve: loadOrgBundle,
  95. })
  96. .when('/org/new', {
  97. templateUrl: 'public/app/features/org/partials/newOrg.html',
  98. controller : 'NewOrgCtrl',
  99. resolve: loadOrgBundle,
  100. })
  101. .when('/org/users', {
  102. templateUrl: 'public/app/features/org/partials/orgUsers.html',
  103. controller : 'OrgUsersCtrl',
  104. controllerAs: 'ctrl',
  105. resolve: loadOrgBundle,
  106. })
  107. .when('/org/users/invite', {
  108. templateUrl: 'public/app/features/org/partials/invite.html',
  109. controller : 'UserInviteCtrl',
  110. controllerAs: 'ctrl',
  111. resolve: loadOrgBundle,
  112. })
  113. .when('/org/apikeys', {
  114. templateUrl: 'public/app/features/org/partials/orgApiKeys.html',
  115. controller : 'OrgApiKeysCtrl',
  116. resolve: loadOrgBundle,
  117. })
  118. .when('/org/teams', {
  119. templateUrl: 'public/app/features/org/partials/teams.html',
  120. controller : 'TeamsCtrl',
  121. controllerAs: 'ctrl',
  122. resolve: loadOrgBundle,
  123. })
  124. .when('/org/teams/edit/:id', {
  125. templateUrl: 'public/app/features/org/partials/team_details.html',
  126. controller : 'TeamDetailsCtrl',
  127. controllerAs: 'ctrl',
  128. resolve: loadOrgBundle,
  129. })
  130. .when('/profile', {
  131. templateUrl: 'public/app/features/org/partials/profile.html',
  132. controller : 'ProfileCtrl',
  133. controllerAs: 'ctrl',
  134. resolve: loadOrgBundle,
  135. })
  136. .when('/profile/password', {
  137. templateUrl: 'public/app/features/org/partials/change_password.html',
  138. controller : 'ChangePasswordCtrl',
  139. resolve: loadOrgBundle,
  140. })
  141. .when('/profile/select-org', {
  142. templateUrl: 'public/app/features/org/partials/select_org.html',
  143. controller : 'SelectOrgCtrl',
  144. resolve: loadOrgBundle,
  145. })
  146. // ADMIN
  147. .when('/admin', {
  148. templateUrl: 'public/app/features/admin/partials/admin_home.html',
  149. controller : 'AdminHomeCtrl',
  150. controllerAs: 'ctrl',
  151. resolve: loadAdminBundle,
  152. })
  153. .when('/admin/settings', {
  154. templateUrl: 'public/app/features/admin/partials/settings.html',
  155. controller : 'AdminSettingsCtrl',
  156. controllerAs: 'ctrl',
  157. resolve: loadAdminBundle,
  158. })
  159. .when('/admin/users', {
  160. templateUrl: 'public/app/features/admin/partials/users.html',
  161. controller : 'AdminListUsersCtrl',
  162. controllerAs: 'ctrl',
  163. resolve: loadAdminBundle,
  164. })
  165. .when('/admin/users/create', {
  166. templateUrl: 'public/app/features/admin/partials/new_user.html',
  167. controller : 'AdminEditUserCtrl',
  168. resolve: loadAdminBundle,
  169. })
  170. .when('/admin/users/edit/:id', {
  171. templateUrl: 'public/app/features/admin/partials/edit_user.html',
  172. controller : 'AdminEditUserCtrl',
  173. resolve: loadAdminBundle,
  174. })
  175. .when('/admin/orgs', {
  176. templateUrl: 'public/app/features/admin/partials/orgs.html',
  177. controller : 'AdminListOrgsCtrl',
  178. controllerAs: 'ctrl',
  179. resolve: loadAdminBundle,
  180. })
  181. .when('/admin/orgs/edit/:id', {
  182. templateUrl: 'public/app/features/admin/partials/edit_org.html',
  183. controller : 'AdminEditOrgCtrl',
  184. controllerAs: 'ctrl',
  185. resolve: loadAdminBundle,
  186. })
  187. .when('/admin/stats', {
  188. templateUrl: 'public/app/features/admin/partials/stats.html',
  189. controller : 'AdminStatsCtrl',
  190. controllerAs: 'ctrl',
  191. resolve: loadAdminBundle,
  192. })
  193. // LOGIN / SIGNUP
  194. .when('/login', {
  195. templateUrl: 'public/app/partials/login.html',
  196. controller : 'LoginCtrl',
  197. pageClass: 'sidemenu-hidden',
  198. })
  199. .when('/invite/:code', {
  200. templateUrl: 'public/app/partials/signup_invited.html',
  201. controller : 'InvitedCtrl',
  202. pageClass: 'sidemenu-hidden',
  203. })
  204. .when('/signup', {
  205. templateUrl: 'public/app/partials/signup_step2.html',
  206. controller : 'SignUpCtrl',
  207. pageClass: 'sidemenu-hidden',
  208. })
  209. .when('/user/password/send-reset-email', {
  210. templateUrl: 'public/app/partials/reset_password.html',
  211. controller : 'ResetPasswordCtrl',
  212. pageClass: 'sidemenu-hidden',
  213. })
  214. .when('/user/password/reset', {
  215. templateUrl: 'public/app/partials/reset_password.html',
  216. controller : 'ResetPasswordCtrl',
  217. pageClass: 'sidemenu-hidden',
  218. })
  219. .when('/dashboard/snapshots', {
  220. templateUrl: 'public/app/features/snapshot/partials/snapshots.html',
  221. controller : 'SnapshotsCtrl',
  222. controllerAs: 'ctrl',
  223. })
  224. .when('/plugins', {
  225. templateUrl: 'public/app/features/plugins/partials/plugin_list.html',
  226. controller: 'PluginListCtrl',
  227. controllerAs: 'ctrl',
  228. })
  229. .when('/plugins/:pluginId/edit', {
  230. templateUrl: 'public/app/features/plugins/partials/plugin_edit.html',
  231. controller: 'PluginEditCtrl',
  232. controllerAs: 'ctrl',
  233. })
  234. .when('/plugins/:pluginId/page/:slug', {
  235. templateUrl: 'public/app/features/plugins/partials/plugin_page.html',
  236. controller: 'AppPageCtrl',
  237. controllerAs: 'ctrl',
  238. })
  239. .when('/styleguide/:page?', {
  240. controller: 'StyleGuideCtrl',
  241. controllerAs: 'ctrl',
  242. templateUrl: 'public/app/features/styleguide/styleguide.html',
  243. })
  244. .when('/alerting', {
  245. redirectTo: '/alerting/list'
  246. })
  247. .when('/alerting/list', {
  248. templateUrl: 'public/app/features/alerting/partials/alert_list.html',
  249. controller: 'AlertListCtrl',
  250. controllerAs: 'ctrl',
  251. resolve: loadAlertingBundle,
  252. })
  253. .when('/alerting/notifications', {
  254. templateUrl: 'public/app/features/alerting/partials/notifications_list.html',
  255. controller: 'AlertNotificationsListCtrl',
  256. controllerAs: 'ctrl',
  257. resolve: loadAlertingBundle,
  258. })
  259. .when('/alerting/notification/new', {
  260. templateUrl: 'public/app/features/alerting/partials/notification_edit.html',
  261. controller: 'AlertNotificationEditCtrl',
  262. controllerAs: 'ctrl',
  263. resolve: loadAlertingBundle,
  264. })
  265. .when('/alerting/notification/:id/edit', {
  266. templateUrl: 'public/app/features/alerting/partials/notification_edit.html',
  267. controller: 'AlertNotificationEditCtrl',
  268. controllerAs: 'ctrl',
  269. resolve: loadAlertingBundle,
  270. })
  271. .otherwise({
  272. templateUrl: 'public/app/partials/error.html',
  273. controller: 'ErrorCtrl'
  274. });
  275. }
  276. coreModule.config(setupAngularRoutes);