SharingList.vue 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <!--
  2. - @copyright Copyright (c) 2019 John Molakvoæ <skjnldsv@protonmail.com>
  3. -
  4. - @author John Molakvoæ <skjnldsv@protonmail.com>
  5. -
  6. - @license GNU AGPL version 3 or any later version
  7. -
  8. - This program is free software: you can redistribute it and/or modify
  9. - it under the terms of the GNU Affero General Public License as
  10. - published by the Free Software Foundation, either version 3 of the
  11. - License, or (at your option) any later version.
  12. -
  13. - This program is distributed in the hope that it will be useful,
  14. - but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. - GNU Affero General Public License for more details.
  17. -
  18. - You should have received a copy of the GNU Affero General Public License
  19. - along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. -
  21. -->
  22. <template>
  23. <ul class="sharing-sharee-list">
  24. <SharingEntry v-for="share in shares"
  25. :key="share.id"
  26. :file-info="fileInfo"
  27. :share="share"
  28. @remove:share="removeShare" />
  29. </ul>
  30. </template>
  31. <script>
  32. // eslint-disable-next-line no-unused-vars
  33. import Share from '../models/Share'
  34. import SharingEntry from '../components/SharingEntry'
  35. export default {
  36. name: 'SharingList',
  37. components: {
  38. SharingEntry
  39. },
  40. props: {
  41. fileInfo: {
  42. type: Object,
  43. default: () => {},
  44. required: true
  45. },
  46. shares: {
  47. type: Array,
  48. default: () => [],
  49. required: true
  50. }
  51. },
  52. computed: {
  53. hasShares() {
  54. return this.shares.length === 0
  55. }
  56. },
  57. methods: {
  58. /**
  59. * Remove a share from the shares list
  60. *
  61. * @param {Share} share the share to remove
  62. */
  63. removeShare(share) {
  64. const index = this.shares.findIndex(item => item === share)
  65. this.shares.splice(index, 1)
  66. }
  67. }
  68. }
  69. </script>