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.3KB

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