routes.ts 6.5 KB

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