Jelajahi Sumber

HUE-4396 [fb] Delete button should be 'delete forever' all the time

Enrico Berti 9 tahun lalu
induk
melakukan
b909a7f

+ 5 - 0
apps/filebrowser/src/filebrowser/templates/listdir.mako

@@ -90,6 +90,10 @@ ${ fb_components.menubar() }
           
           
           <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>
           <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>
           <!-- ko ifnot: inTrash -->
           <!-- ko ifnot: inTrash -->
+          <!-- ko if: $root.isS3 -->
+          <button class="btn fileToolbarBtn delete-link" title="${_('Delete forever')}" data-bind="enable: selectedFiles().length > 0, click: deleteSelected"><i class="fa fa-bolt"></i> ${_('Delete forever')}</button>
+          <!-- /ko -->
+          <!-- ko ifnot: $root.isS3 -->
           <div id="delete-dropdown" class="btn-group" style="vertical-align: middle">
           <div id="delete-dropdown" class="btn-group" style="vertical-align: middle">
             <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>
             <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>
             <button id="trash-btn-caret" class="btn toolbarBtn dropdown-toggle" data-toggle="dropdown" data-bind="enable: selectedFiles().length > 0 && isCurrentDirSelected().length == 0">
             <button id="trash-btn-caret" class="btn toolbarBtn dropdown-toggle" data-toggle="dropdown" data-bind="enable: selectedFiles().length > 0 && isCurrentDirSelected().length == 0">
@@ -100,6 +104,7 @@ ${ fb_components.menubar() }
             </ul>
             </ul>
           </div>
           </div>
           <!-- /ko -->
           <!-- /ko -->
+          <!-- /ko -->
           % if 'oozie' in apps:
           % if 'oozie' in apps:
           <button class="btn fileToolbarBtn" title="${_('Submit')}"
           <button class="btn fileToolbarBtn" title="${_('Submit')}"
             data-bind="visible: selectedFiles().length == 1 && $.inArray(selectedFile().name, ['workflow.xml', 'coordinator.xml', 'bundle.xml']) > -1, click: submitSelected">
             data-bind="visible: selectedFiles().length == 1 && $.inArray(selectedFile().name, ['workflow.xml', 'coordinator.xml', 'bundle.xml']) > -1, click: submitSelected">

+ 4 - 0
apps/filebrowser/src/filebrowser/templates/listdir_components.mako

@@ -950,6 +950,10 @@ from django.utils.translation import ugettext as _
         $(document).trigger('currPathLoaded', { path: path });
         $(document).trigger('currPathLoaded', { path: path });
       });
       });
 
 
+      self.isS3 = ko.pureComputed(function () {
+        return self.currentPath().toLowerCase().indexOf('s3://') == 0;
+      });
+
       self.inTrash = ko.computed(function() {
       self.inTrash = ko.computed(function() {
         return self.currentPath().match(/^\/user\/.+?\/\.Trash/);
         return self.currentPath().match(/^\/user\/.+?\/\.Trash/);
       });
       });