routes.ts 9.3 KB

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