瀏覽代碼

merged

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 13 年之前
父節點
當前提交
43e2aa2054

+ 2 - 2
dali/dfu/dfuutil.cpp

@@ -738,7 +738,7 @@ public:
     }
 
 
-    void removeSuper(const char *superfname, unsigned numtodelete, const char **subfiles, bool delsub, IUserDescriptor *user)
+    void removeSuper(const char *superfname, unsigned numtodelete, const char **subfiles, bool delsub, bool removesuperfile, IUserDescriptor *user)
     {
         Owned<IDistributedFileTransaction> transaction = createDistributedFileTransaction(user);
         // We need this here, since caching only happens with active transactions
@@ -788,7 +788,7 @@ public:
             transaction->commit();
         }
         // Delete superfile if empty
-        if (superfile->numSubFiles() == 0) {
+        if (removesuperfile && (superfile->numSubFiles() == 0)) {
             superfile.clear();
             // MORE - add file deletion to transaction
             queryDistributedFileDirectory().removeEntry(superfname);

+ 1 - 1
dali/dfu/dfuutil.hpp

@@ -34,7 +34,7 @@ interface IDfuFileCopier: extends IInterface
 interface IDFUhelper: extends IInterface
 {
     virtual void addSuper(const char *superfname, unsigned numtoadd=0, const char **subfiles=NULL, const char *before=NULL, IUserDescriptor *user=NULL) = 0;
-    virtual void removeSuper(const char *superfname, unsigned numtodelete=0, const char **subfiles=NULL, bool delsub=false, IUserDescriptor *user=NULL) = 0;
+    virtual void removeSuper(const char *superfname, unsigned numtodelete=0, const char **subfiles=NULL, bool delsub=false, bool removesuperfile=true, IUserDescriptor *user=NULL) = 0;
     virtual void listSubFiles(const char *superfname,StringAttrArray &out, IUserDescriptor *user=NULL) = 0;
     virtual StringBuffer &getFileXML(const char *lfn,StringBuffer &out, IUserDescriptor *user=NULL) = 0;
     virtual void addFileXML(const char *lfn,const StringBuffer &xml, IUserDescriptor *user=NULL) = 0;

+ 22 - 6
esp/eclwatch/ws_XSLT/dfu_file.xslt

@@ -45,6 +45,7 @@
                          {
                            document.getElementById('TopSelectAll').checked = select;
                            document.getElementById('BottomSelectAll').checked = select;
+                           document.getElementById('removeSuperfile').checked = select;
                            selectAll(select);
                          }
                          function onRowCheck(checked)
@@ -366,7 +367,7 @@
         <tr class="grey">
         <th>
         <xsl:if test="Item[2]">
-            <xsl:attribute name="name">selectAll1</xsl:attribute>
+            <xsl:attribute name="id">selectAll1</xsl:attribute>
             <input type="checkbox" id="TopSelectAll" title="Select or deselect all subfiles" onclick="selectAll0(this.checked)"/>
         </xsl:if>
         </th>
@@ -390,12 +391,27 @@
             </tr>
             </table>
         </xsl:if>
-        <table id="btnTable" style="margin:20 0 0 0">
-        <colgroup>
-            <col span="8" width="100"/>
-        </colgroup>
+        <table id="btnTable" style="margin:0 0 20 20">
+            <tr>
+                <td>
+                    <xsl:if test="Item[1]">
+                        <input type="checkbox" id="removeSuperfile" name="removeSuperfile" title="Remove Superfile when the file has no subfile" disabled="true">Remove Superfile</input>
+                    </xsl:if>
+                </td>
+            </tr>
+            <tr>
+                <td>
+                    <xsl:choose>
+                        <xsl:when test="Item[1]">
+                            <input type="submit" class="sbutton" id="deleteBtn" name="action" value="remove" disabled="true" onclick="return confirm('Are you sure you want to delete the following subfiles ?\n\n'+getSelected(document.forms['listitems']).substring(1,1000))"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <input type="button" class="sbutton" id="deleteBtn" value="Delete" onclick="submitaction('Delete','{../Name}@{../Cluster}')"/>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </td>
+            </tr>
         </table>
-        <input type="submit" class="sbutton" id="deleteBtn" name="action" value="remove" disabled="true" onclick="return confirm('Are you sure you want to delete the following subfiles ?\n\n'+getSelected(document.forms['listitems']).substring(1,1000))"/>
     </xsl:template>
 
     <xsl:template match="Item" mode="list">

+ 22 - 14
esp/files/scripts/multiselect.js

@@ -91,20 +91,28 @@ function selectAll(select)
 
 function checkSelectAllCheckBoxes(check)
 {
-   if(document.forms[0] != null)
-   {
-       //var all = document.forms[0].all;
-       //if (all) {
-           selectAllCell = document.getElementById("selectAll1");
-           if (selectAllCell && selectAllCell.children[0])
-               selectAllCell.children[0].checked = check;
-
-           selectAllCell = document.getElementById("selectAll2");
-           if (selectAllCell)
-               selectAllCell.children[0].checked = check;
-           selectAllCheckboxChecked = check;
-       //}
-   }
+    if(document.forms[0] === null)
+        return;
+
+    selectAllCell = document.getElementById("selectAll1");
+    if (selectAllCell && selectAllCell.children[0])
+        selectAllCell.children[0].checked = check;
+
+    selectAllCell = document.getElementById("selectAll2");
+    if (selectAllCell && selectAllCell.children[0])
+        selectAllCell.children[0].checked = check;
+
+    selectAllCheckboxChecked = check;
+
+    selectRemoveSuperfile = document.getElementById("removeSuperfile");
+    if (selectRemoveSuperfile)
+    {
+        selectRemoveSuperfile.checked = false; /*default: not delete superfile*/
+        if (check)
+            selectRemoveSuperfile.disabled = false; /*enable it only when all files are selected to delete*/
+        else
+            selectRemoveSuperfile.disabled = true;
+    }
 }
 
 

+ 1 - 0
esp/scm/ws_dfu.ecm

@@ -268,6 +268,7 @@ ESPrequest SuperfileActionRequest
     ESParray<string> subfiles;
     string before;
     bool delete;
+    bool removeSuperfile;
 };
 
 ESPresponse [exceptions_inline, nil_remove] SuperfileActionResponse

+ 1 - 1
esp/services/ws_dfu/ws_dfuService.cpp

@@ -3129,7 +3129,7 @@ bool CWsDfuEx::onSuperfileAction(IEspContext &context, IEspSuperfileActionReques
             }
             {
                 synchronized block(m_superfilemutex);
-                dfuhelper->removeSuper(req.getSuperfile(), num, ptrs, req.getDelete(), userdesc.get()); 
+                dfuhelper->removeSuper(req.getSuperfile(), num, ptrs, req.getDelete(), req.getRemoveSuperfile(), userdesc.get()); 
             }
         }