Browse Source

Merge remote-tracking branch 'origin/candidate-3.8.2' into candidate-3.8.x

Conflicts:
	version.cmake

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 13 years ago
parent
commit
e1a239a82d

+ 4 - 4
dali/base/dadfs.cpp

@@ -959,7 +959,7 @@ public:
     bool getProtectedInfo(const CDfsLogicalFileName &logicalname, StringArray &names, UnsignedArray &counts);
     bool getProtectedInfo(const CDfsLogicalFileName &logicalname, StringArray &names, UnsignedArray &counts);
     IDFProtectedIterator *lookupProtectedFiles(const char *owner=NULL,bool notsuper=false,bool superonly=false);
     IDFProtectedIterator *lookupProtectedFiles(const char *owner=NULL,bool notsuper=false,bool superonly=false);
 
 
-    static bool cannotRemove(CDfsLogicalFileName &name,StringBuffer &reason,bool ignoresub, unsigned timeoutms);
+    static bool cannotRemove(CDfsLogicalFileName &name,IUserDescriptor *user,StringBuffer &reason,bool ignoresub, unsigned timeoutms);
     void setFileProtect(CDfsLogicalFileName &dlfn, const char *owner, bool set, const INode *foreigndali=NULL,IUserDescriptor *user=NULL,unsigned foreigndalitimeout=FOREIGN_DALI_TIMEOUT);
     void setFileProtect(CDfsLogicalFileName &dlfn, const char *owner, bool set, const INode *foreigndali=NULL,IUserDescriptor *user=NULL,unsigned foreigndalitimeout=FOREIGN_DALI_TIMEOUT);
 
 
     unsigned setDefaultTimeout(unsigned timems)
     unsigned setDefaultTimeout(unsigned timems)
@@ -6642,10 +6642,10 @@ IDistributedSuperFile *CDistributedFileDirectory::createSuperFile(const char *_l
 }
 }
 
 
 // MORE - this should go when remove file gets into transactions
 // MORE - this should go when remove file gets into transactions
-bool CDistributedFileDirectory::cannotRemove(CDfsLogicalFileName &dlfn,StringBuffer &reason,bool ignoresub, unsigned timeoutms)
+bool CDistributedFileDirectory::cannotRemove(CDfsLogicalFileName &dlfn,IUserDescriptor *user,StringBuffer &reason,bool ignoresub, unsigned timeoutms)
 {
 {
     // This is a hack while we don't move remove out of dir
     // This is a hack while we don't move remove out of dir
-    Owned<IDistributedFile> file = queryDistributedFileDirectory().lookup(dlfn, NULL, false, NULL, 6*1000);
+    Owned<IDistributedFile> file = queryDistributedFileDirectory().lookup(dlfn, user, false, NULL, 6*1000);
     if (file.get())
     if (file.get())
         return !file->canRemove(reason, ignoresub);
         return !file->canRemove(reason, ignoresub);
     return false;
     return false;
@@ -6660,7 +6660,7 @@ bool CDistributedFileDirectory::doRemoveEntry(CDfsLogicalFileName &dlfn,IUserDes
     if (!checkLogicalName(dlfn,user,true,true,true,"remove"))
     if (!checkLogicalName(dlfn,user,true,true,true,"remove"))
         return false;
         return false;
     StringBuffer reason;
     StringBuffer reason;
-    if (cannotRemove(dlfn,reason,ignoresub,defaultTimeout)) {
+    if (cannotRemove(dlfn,user,reason,ignoresub,defaultTimeout)) {
 #ifdef EXTRA_LOGGING
 #ifdef EXTRA_LOGGING
         PROGLOG("CDistributedFileDirectory::doRemoveEntry(cannotRemove) %s",reason.str());
         PROGLOG("CDistributedFileDirectory::doRemoveEntry(cannotRemove) %s",reason.str());
 #endif
 #endif

+ 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);
         Owned<IDistributedFileTransaction> transaction = createDistributedFileTransaction(user);
         // We need this here, since caching only happens with active transactions
         // We need this here, since caching only happens with active transactions
@@ -788,7 +788,7 @@ public:
             transaction->commit();
             transaction->commit();
         }
         }
         // Delete superfile if empty
         // Delete superfile if empty
-        if (superfile->numSubFiles() == 0) {
+        if (removesuperfile && (superfile->numSubFiles() == 0)) {
             superfile.clear();
             superfile.clear();
             // MORE - add file deletion to transaction
             // MORE - add file deletion to transaction
             queryDistributedFileDirectory().removeEntry(superfname);
             queryDistributedFileDirectory().removeEntry(superfname);

+ 1 - 1
dali/dfu/dfuutil.hpp

@@ -34,7 +34,7 @@ interface IDfuFileCopier: extends IInterface
 interface IDFUhelper: 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 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 void listSubFiles(const char *superfname,StringAttrArray &out, IUserDescriptor *user=NULL) = 0;
     virtual StringBuffer &getFileXML(const char *lfn,StringBuffer &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;
     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('TopSelectAll').checked = select;
                            document.getElementById('BottomSelectAll').checked = select;
                            document.getElementById('BottomSelectAll').checked = select;
+                           document.getElementById('removeSuperfile').checked = select;
                            selectAll(select);
                            selectAll(select);
                          }
                          }
                          function onRowCheck(checked)
                          function onRowCheck(checked)
@@ -366,7 +367,7 @@
         <tr class="grey">
         <tr class="grey">
         <th>
         <th>
         <xsl:if test="Item[2]">
         <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)"/>
             <input type="checkbox" id="TopSelectAll" title="Select or deselect all subfiles" onclick="selectAll0(this.checked)"/>
         </xsl:if>
         </xsl:if>
         </th>
         </th>
@@ -390,12 +391,27 @@
             </tr>
             </tr>
             </table>
             </table>
         </xsl:if>
         </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>
         </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>
 
 
     <xsl:template match="Item" mode="list">
     <xsl:template match="Item" mode="list">

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

@@ -91,20 +91,28 @@ function selectAll(select)
 
 
 function checkSelectAllCheckBoxes(check)
 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;
     ESParray<string> subfiles;
     string before;
     string before;
     bool delete;
     bool delete;
+    bool removeSuperfile;
 };
 };
 
 
 ESPresponse [exceptions_inline, nil_remove] SuperfileActionResponse
 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);
                 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()); 
             }
             }
         }
         }