You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

router.js 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
  3. *
  4. * @author John Molakvoæ <skjnldsv@protonmail.com>
  5. * @author Julius Härtl <jus@bitgrid.net>
  6. *
  7. * @license GNU AGPL version 3 or any later version
  8. *
  9. * This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as
  11. * published by the Free Software Foundation, either version 3 of the
  12. * License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. */
  23. import Vue from 'vue'
  24. import Router from 'vue-router'
  25. // Dynamic loading
  26. const Users = () => import('./views/Users')
  27. const Apps = () => import('./views/Apps')
  28. Vue.use(Router)
  29. /*
  30. * This is the list of routes where the vuejs app will
  31. * take over php to provide data
  32. * You need to forward the php routing (routes.php) to
  33. * the settings-vue template, where the vue-router will
  34. * ensure the proper route.
  35. * ⚠️ Routes needs to match the php routes.
  36. */
  37. export default new Router({
  38. mode: 'history',
  39. // if index.php is in the url AND we got this far, then it's working:
  40. // let's keep using index.php in the url
  41. base: OC.generateUrl(''),
  42. linkActiveClass: 'active',
  43. routes: [
  44. {
  45. path: '/:index(index.php/)?settings/users',
  46. component: Users,
  47. props: true,
  48. name: 'users',
  49. children: [
  50. {
  51. path: ':selectedGroup(.*)',
  52. name: 'group',
  53. component: Users
  54. }
  55. ]
  56. },
  57. {
  58. path: '/:index(index.php/)?settings/apps',
  59. component: Apps,
  60. props: true,
  61. name: 'apps',
  62. children: [
  63. {
  64. path: ':category',
  65. name: 'apps-category',
  66. component: Apps,
  67. children: [
  68. {
  69. path: ':id',
  70. name: 'apps-details',
  71. component: Apps
  72. }
  73. ]
  74. }
  75. ]
  76. }
  77. ]
  78. })