routes.ts 9.7 KB

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