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.

152 lines
5.1 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <urban-filemanager>
  2. <div class="bucket-filemanager">
  3. <div class="file-table">
  4. <urban-filemanager-parent handleClick={ handleParentClick } if={ state.path.length > 0 }></urban-filemanager-parent>
  5. <template each={ file in state.files }>
  6. <div class="file-table__row">
  7. <div class="file-table__column file-table__column--select" onchange={ (event) => { handleMarked(event, file) } }>
  8. <input type="checkbox" value="true" />
  9. </div>
  10. <div if={ file.is_file } class="file-table__column file-table__column--filename">
  11. { file.filename }
  12. </div>
  13. <div if={ !file.is_file } class="file-table__column file-table__column--filename" onclick={ (event) => { handleDirectoryClick(event, file) } }>
  14. <svg class="icon fill-primary mr-2" aria-hidden="true">
  15. <use xlink:href="/symbol-defs.svg#icon-folder"></use>
  16. </svg>
  17. { file.filename }
  18. </div>
  19. <div if={ file.is_file } class="file-table__column file-table__column--size">
  20. <div class="file-table__inner has-text-right width-100">{ file.meta.size }</div>
  21. </div>
  22. <div if={ file.is_file } class="file-table__column file-table__column--date">
  23. <div class="file-table__inner has-text-right">{ file.meta.updated_at }</div>
  24. </div>
  25. <div class="file-table__column file-table__column--actions">
  26. <div class="file-table__inner has-text-right">
  27. <button type="button" disabled={ true } onclick={ (event) => { handlePreview(event, file) } }>
  28. <svg class="icon fill-success mr-1" aria-hidden="true">
  29. <use xlink:href="/symbol-defs.svg#icon-eye"></use>
  30. </svg>
  31. </button>
  32. <button type="button" onclick={ (event) => { handlePreview(event, file) } }>
  33. <svg class="icon fill-success mr-1" aria-hidden="true">
  34. <use xlink:href="/symbol-defs.svg#icon-download"></use>
  35. </svg>
  36. </button>
  37. <button type="button" onclick={ (event) => { handlePreview(event, file) } }>
  38. <svg class="icon fill-danger mr-1" aria-hidden="true">
  39. <use xlink:href="/symbol-defs.svg#icon-delete"></use>
  40. </svg>
  41. </button>
  42. <button type="button" onclick={ (event) => { handlePreview(event, file) } }>
  43. <svg class="icon fill-grey mr-1" aria-hidden="true">
  44. <use xlink:href="/symbol-defs.svg#icon-build"></use>
  45. </svg>
  46. </button>
  47. </div>
  48. </div>
  49. </div>
  50. </template>
  51. </div>
  52. </div>
  53. <script>
  54. import axios from 'axios'
  55. import File from './file.riot'
  56. import Directory from './directory.riot'
  57. import Parent from './parent.riot'
  58. import Actions from './actions.riot'
  59. riot.register('urban-filemanager-file', File)
  60. riot.register('urban-filemanager-directory', Directory)
  61. riot.register('urban-filemanager-parent', Parent)
  62. export default {
  63. state: {
  64. files: [
  65. ],
  66. path: [
  67. ]
  68. },
  69. /**
  70. *
  71. *
  72. * @param {[type]} props [description]
  73. * @param {[type]} state [description]
  74. *
  75. *
  76. */
  77. onBeforeMount(props, state) {
  78. state.files = props.files
  79. },
  80. /**
  81. *
  82. * @param {[type]} event [description]
  83. * @param {[type]} file [description]
  84. *
  85. */
  86. handlePreview(event, file) {
  87. console.log(file)
  88. },
  89. /**
  90. *
  91. *
  92. *
  93. */
  94. handleParentClick(event) {
  95. this.state.path.pop()
  96. this.files()
  97. },
  98. /**
  99. *
  100. *
  101. *
  102. */
  103. handleDirectoryClick(event, file) {
  104. this.state.path.push(file.filename)
  105. this.files()
  106. },
  107. /**
  108. *
  109. *
  110. *
  111. */
  112. files() {
  113. axios.get('/api/file/' + this.props.id, {
  114. params: {
  115. path: this.state.path.join('/')
  116. }
  117. }).then((response) => {
  118. this.state.files = response.data.files
  119. this.update()
  120. })
  121. },
  122. /**
  123. *
  124. *
  125. */
  126. handleMarked() {
  127. console.log('marked')
  128. },
  129. }
  130. </script>
  131. </urban-filemanager>