routes.ts 9.7 KB

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