listdir.mako 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. ## Licensed to Cloudera, Inc. under one
  2. ## or more contributor license agreements. See the NOTICE file
  3. ## distributed with this work for additional information
  4. ## regarding copyright ownership. Cloudera, Inc. licenses this file
  5. ## to you under the Apache License, Version 2.0 (the
  6. ## "License"); you may not use this file except in compliance
  7. ## with the License. You may obtain a copy of the License at
  8. ##
  9. ## http://www.apache.org/licenses/LICENSE-2.0
  10. ##
  11. ## Unless required by applicable law or agreed to in writing, software
  12. ## distributed under the License is distributed on an "AS IS" BASIS,
  13. ## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. ## See the License for the specific language governing permissions and
  15. ## limitations under the License.
  16. <%!
  17. from django.template.defaultfilters import urlencode
  18. from desktop.views import commonheader, commonfooter
  19. from django.utils.translation import ugettext as _
  20. %>
  21. <%namespace name="actionbar" file="actionbar.mako" />
  22. <%namespace name="dir" file="listdir_components.mako" />
  23. <%namespace name="fb_components" file="fb_components.mako" />
  24. ${ commonheader(None, 'filebrowser', user) | n,unicode }
  25. ${ fb_components.menubar() }
  26. <style type="text/css">
  27. .tooltip.left {
  28. margin-left: -10px;
  29. }
  30. </style>
  31. <div class="container-fluid">
  32. <div class="card card-small">
  33. <div class="actionbar">
  34. <%actionbar:render>
  35. <%def name="search()">
  36. <input type="text" class="input-large search-query" placeholder="${_('Search for file name')}" data-bind="value: searchQuery">
  37. </%def>
  38. <%def name="actions()">
  39. <div class="btn-toolbar" style="display: inline; vertical-align: middle">
  40. <button class="btn fileToolbarBtn" title="${_('Rename')}" data-bind="visible: !inTrash(), click: renameFile, enable: selectedFiles().length == 1 && isCurrentDirSelected().length == 0"><i class="fa fa-font"></i> ${_('Rename')}</button>
  41. <button class="btn fileToolbarBtn" title="${_('Move')}" data-bind="click: move, enable: selectedFiles().length > 0 && isCurrentDirSelected().length == 0"><i class="fa fa-random"></i> ${_('Move')}</button>
  42. <button class="btn fileToolbarBtn" title="${_('Copy')}" data-bind="click: copy, enable: selectedFiles().length > 0 && isCurrentDirSelected().length == 0"><i class="fa fa-files-o"></i> ${_('Copy')}</button>
  43. %if is_fs_superuser:
  44. <div id="ch-dropdown" class="btn-group" style="vertical-align: middle">
  45. <button href="#" class="btn dropdown-toggle" title="${_('Chown / Chmod')}" data-toggle="dropdown" data-bind="visible: !inTrash(), enable: selectedFiles().length > 0">
  46. <i class="fa fa-user"></i> ${_('Chmod / Chown')}
  47. <span class="caret" style="line-height: 15px"></span>
  48. </button>
  49. <ul class="dropdown-menu" style="top: auto">
  50. <li><a href="#" title="${_('Change owner/group')}" data-bind="visible: !inTrash(), click: changeOwner, enable: selectedFiles().length > 0"><i class="fa fa-user"></i> ${_('Change owner / group')}</a></li>
  51. <li><a href="#" title="${_('Change permissions')}" data-bind="visible: !inTrash(), click: changePermissions, enable: selectedFiles().length > 0"><i class="fa fa-list-alt"></i> ${_('Change permissions')}</a></li>
  52. </ul>
  53. </div>
  54. %else:
  55. <button class="btn fileToolbarBtn" title="${_('Change permissions')}" data-bind="visible: !inTrash(), click: changePermissions, enable: selectedFiles().length > 0"><i class="fa fa-list-alt"></i> ${_('Change permissions')}</button>
  56. %endif
  57. <button class="btn fileToolbarBtn" title="${_('Download')}" data-bind="visible: !inTrash(), click: downloadFile, enable: selectedFiles().length == 1 && selectedFile().type == 'file'"><i class="fa fa-arrow-circle-o-down"></i> ${_('Download')}</button>
  58. <button class="btn fileToolbarBtn" title="${_('Restore from trash')}" data-bind="visible: inRestorableTrash(), click: restoreTrashSelected, enable: selectedFiles().length > 0 && isCurrentDirSelected().length == 0"><i class="fa fa-cloud-upload"></i> ${_('Restore')}</button>
  59. <!-- ko ifnot: inTrash -->
  60. <div id="delete-dropdown" class="btn-group" style="vertical-align: middle">
  61. <button id="trash-btn" class="btn toolbarBtn" data-bind="enable: selectedFiles().length > 0 && isCurrentDirSelected().length == 0, click: trashSelected"><i class="fa fa-times"></i> ${_('Move to trash')}</button>
  62. <button id="trash-btn-caret" class="btn toolbarBtn dropdown-toggle" data-toggle="dropdown" data-bind="enable: selectedFiles().length > 0 && isCurrentDirSelected().length == 0">
  63. <span class="caret"></span>
  64. </button>
  65. <ul class="dropdown-menu">
  66. <li><a href="#" class="delete-link" title="${_('Delete forever')}" data-bind="enable: selectedFiles().length > 0, click: deleteSelected"><i class="fa fa-bolt"></i> ${_('Delete forever')}</a></li>
  67. </ul>
  68. </div>
  69. <!-- /ko -->
  70. <button class="btn fileToolbarBtn" title="${_('Submit')}"
  71. data-bind="visible: selectedFiles().length == 1 && $.inArray(selectedFile().name, ['workflow.xml', 'coordinator.xml', 'bundle.xml']) > -1, click: submitSelected">
  72. <i class="fa fa-play"></i> ${_('Submit')}
  73. </button>
  74. </div>
  75. </%def>
  76. <%def name="creation()">
  77. <button class="btn fileToolbarBtn" title="${_('Empty trash')}" data-bind="visible: inTrash(), click: purgeTrash"><i class="fa fa-fire"></i> ${_('Empty trash')}</button>
  78. <div class="btn-toolbar" style="display: inline; vertical-align: middle">
  79. <div id="upload-dropdown" class="btn-group" style="vertical-align: middle">
  80. <a href="#" class="btn upload-link dropdown-toggle" title="${_('Upload')}" data-toggle="dropdown" data-bind="visible: !inTrash()">
  81. <i class="fa fa-arrow-circle-o-up"></i> ${_('Upload')}
  82. <span class="caret"></span>
  83. </a>
  84. <ul class="dropdown-menu">
  85. <li><a href="#" class="upload-link" title="${_('Files')}" data-bind="click: uploadFile"><i class="fa fa-file-o"></i> ${_('Files')}</a></li>
  86. <li><a href="#" class="upload-link" title="${_('Archive')}" data-bind="click: uploadArchive"><i class="fa fa-gift"></i> ${_('Zip/Tgz file')}</a></li>
  87. </ul>
  88. </div>
  89. <div class="btn-group" style="vertical-align: middle">
  90. <a href="#" data-toggle="dropdown" class="btn dropdown-toggle" data-bind="visible: !inTrash()">
  91. <i class="fa fa-plus-circle"></i> ${_('New')}
  92. <span class="caret"></span>
  93. </a>
  94. <ul class="dropdown-menu pull-right" style="top: auto">
  95. <li><a href="#" class="create-file-link" title="${_('File')}"><i class="fa fa-file-o"></i> ${_('File')}</a></li>
  96. <li><a href="#" class="create-directory-link" title="${_('Directory')}"><i class="fa fa-folder"></i> ${_('Directory')}</a></li>
  97. </ul>
  98. </div>
  99. </div>
  100. </%def>
  101. </%actionbar:render>
  102. </div>
  103. <div class="actionbarGhost hide"></div>
  104. <div class="scrollable">
  105. <div class="alert alert-warn" data-bind="visible: inTrash">
  106. ${ _("This is Hadoop trash. Files will be under a checkpoint, or timestamp named, directory.") }
  107. </div>
  108. % if breadcrumbs:
  109. ${fb_components.breadcrumbs(path, breadcrumbs, True)}
  110. %endif
  111. <div style="padding-left: 6px">
  112. ${dir.list_table_browser(files, path_enc, current_request_path, cwd_set)}
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. ${ commonfooter(messages) | n,unicode }