浏览代码

HPCC-9539 Expose SuperFile info from WsWorkunits::WUQueryDetails

control:getQueryXrefInfo now includes information on the SuperFiles
used by a query.  Operations has asked that it be exposed from
WsWorkunits::WUQueryDetails.

Signed-off-by: Anthony Fishbeck <Anthony.Fishbeck@lexisnexis.com>
Anthony Fishbeck 12 年之前
父节点
当前提交
ee814b398e

+ 36 - 0
esp/eclwatch/ws_XSLT/WUQueryDetails.xslt

@@ -256,6 +256,42 @@
                                 </td>
                             </tr>
                         </xsl:if>
+                      <xsl:if test="count(SuperFiles/SuperFile)">
+                        <tr>
+                          <th valign="top">SuperFiles<br/>
+                            <img src="/esp/files/img/expand.gif" alt=" >> "/>SubFiles:
+                            </th>
+                          <td>
+                            <table id="SuperFileTable">
+                              <xsl:for-each select="SuperFiles/SuperFile">
+                                <tr>
+                                  <td>
+                                    <a href="javascript:void(0)" onclick="DFUFileDetails('{.}');">
+                                      <xsl:value-of select="Name"/>
+                                    </a>
+                                  </td>
+                                </tr>
+                                <tr>
+                                  <td>
+                                    <table>
+                                      <xsl:for-each select="SubFiles/File">
+                                        <tr>
+                                          <td>
+                                            <img src="/esp/files/img/expand.gif" alt=" >> "/>
+                                            <a href="javascript:void(0)" onclick="DFUFileDetails('{.}');">
+                                              <xsl:value-of select="."/>
+                                            </a>
+                                          </td>
+                                        </tr>
+                                      </xsl:for-each>
+                                    </table>
+                                  </td>
+                                </tr>
+                              </xsl:for-each>
+                            </table>
+                          </td>
+                        </tr>
+                      </xsl:if>
                     </table>
                 </form>
                 <input id="deleteBtn" type="button" value="Delete" onclick="deleteQuery();"> </input>

+ 1 - 1
esp/eclwatch/ws_XSLT/WUQuerysetQueries.xslt

@@ -82,7 +82,7 @@
                     record = aliasDataTable.getRecord(selectedRows[0]);
                 else
                     record = queryDataTable.getRecord(selectedRows[0]);
-                document.location.href = "/WsWorkunits/WUQueryDetails?IncludeStateOnClusters=1&QueryId=" + record.getData('Id') + "&QuerySet=" + querySet;
+                document.location.href = "/WsWorkunits/WUQueryDetails?IncludeSuperFiles=1&IncludeStateOnClusters=1&QueryId=" + record.getData('Id') + "&QuerySet=" + querySet;
               }
 
               function deleteQueries() {

+ 11 - 2
esp/scm/ws_workunits.ecm

@@ -1198,7 +1198,14 @@ ESPrequest WUQueryDetailsRequest
 {
     string QueryId;
     string QuerySet;
-    bool   IncludeStateOnClusters(false);
+    bool IncludeStateOnClusters(false);
+    bool IncludeSuperFiles(false);
+};
+
+ESPStruct QuerySuperFile
+{
+    string Name;
+    ESParray<string, File> SubFiles;
 };
 
 ESPresponse [exceptions_inline] WUQueryDetailsResponse
@@ -1216,6 +1223,8 @@ ESPresponse [exceptions_inline] WUQueryDetailsResponse
     string Comment;
 
     ESParray<string> LogicalFiles;
+    [min_ver("1.44")] ESParray<ESPstruct QuerySuperFile, SuperFile> SuperFiles;
+
 };
 
 ESPrequest WUMultiQuerySetDetailsRequest
@@ -1341,7 +1350,7 @@ ESPresponse [exceptions_inline] WUQuerySetCopyQueryResponse
 };
 
 ESPservice [
-    version("1.42"), default_client_version("1.42"),
+    version("1.44"), default_client_version("1.44"),
     noforms,exceptions_inline("./smc_xslt/exceptions.xslt"),use_method_name] WsWorkunits
 {
     ESPmethod [resp_xsl_default("/esp/xslt/workunits.xslt")]     WUQuery(WUQueryRequest, WUQueryResponse);

+ 29 - 9
esp/services/ws_workunits/ws_workunitsQuerySets.cpp

@@ -925,9 +925,12 @@ bool CWsWorkunitsEx::onWUQueryDetails(IEspContext &context, IEspWUQueryDetailsRe
     resp.setComment(query->queryProp("@comment"));
 
     StringArray logicalFiles;
-    getQueryFiles(queryId, querySet, logicalFiles);
+    IArrayOf<IEspQuerySuperFile> superFiles;
+    getQueryFiles(queryId, querySet, logicalFiles, req.getIncludeSuperFiles() ? &superFiles : NULL);
     if (logicalFiles.length())
         resp.setLogicalFiles(logicalFiles);
+    if (superFiles.length())
+        resp.setSuperFiles(superFiles);
 
     double version = context.getClientVersion();
     if (version >= 1.42)
@@ -952,7 +955,7 @@ bool CWsWorkunitsEx::onWUQueryDetails(IEspContext &context, IEspWUQueryDetailsRe
     return true;
 }
 
-bool CWsWorkunitsEx::getQueryFiles(const char* query, const char* target, StringArray& logicalFiles)
+bool CWsWorkunitsEx::getQueryFiles(const char* query, const char* target, StringArray& logicalFiles, IArrayOf<IEspQuerySuperFile> *respSuperFiles)
 {
     try
     {
@@ -971,7 +974,11 @@ bool CWsWorkunitsEx::getQueryFiles(const char* query, const char* target, String
         if (!result)
             return false;
 
-        Owned<IPropertyTreeIterator> files = result->getElements("Endpoint/Queries/Query//File");
+        StringBuffer xpath("Endpoint/Queries/Query/");
+        if (!respSuperFiles)
+            xpath.append('/');
+        xpath.append("File");
+        Owned<IPropertyTreeIterator> files = result->getElements(xpath);
         ForEach (*files)
         {
             IPropertyTree &file = files->query();
@@ -980,13 +987,26 @@ bool CWsWorkunitsEx::getQueryFiles(const char* query, const char* target, String
                 logicalFiles.append(fileName);
         }
 
-        Owned<IPropertyTreeIterator> superFiles = result->getElements("Endpoint/Queries/Query/SuperFile");
-        ForEach (*superFiles)
+        if (respSuperFiles)
         {
-            IPropertyTree &file = superFiles->query();
-            const char* fileName = file.queryProp("@name");
-            if (fileName && *fileName)
-                logicalFiles.append(fileName);
+            Owned<IPropertyTreeIterator> superFiles = result->getElements("Endpoint/Queries/Query/SuperFile");
+            ForEach (*superFiles)
+            {
+                IPropertyTree &super = superFiles->query();
+                Owned<IEspQuerySuperFile> respSuperFile = createQuerySuperFile();
+                respSuperFile->setName(super.queryProp("@name"));
+                Owned<IPropertyTreeIterator> fileIter = super.getElements("File");
+                StringArray respSubFiles;
+                ForEach (*fileIter)
+                {
+                    IPropertyTree &fileItem = fileIter->query();
+                    const char* fileName = fileItem.queryProp("@name");
+                    if (fileName && *fileName)
+                        respSubFiles.append(fileName);
+                }
+                respSuperFile->setSubFiles(respSubFiles);
+                respSuperFiles->append(*respSuperFile.getClear());
+            }
         }
         return true;
     }

+ 1 - 1
esp/services/ws_workunits/ws_workunitsService.hpp

@@ -41,7 +41,7 @@ public:
     void deploySharedObject(IEspContext &context, IEspWUDeployWorkunitRequest & req, IEspWUDeployWorkunitResponse & resp, const char *dir, const char *xml=NULL);
     void deploySharedObject(IEspContext &context, StringBuffer &wuid, const char *filename, const char *cluster, const char *name, const MemoryBuffer &obj, const char *dir, const char *xml=NULL);
     void checkAndTrimWorkunit(const char* methodName, StringBuffer& input);
-    bool getQueryFiles(const char* query, const char* target, StringArray& logicalFiles);
+    bool getQueryFiles(const char* query, const char* target, StringArray& logicalFiles, IArrayOf<IEspQuerySuperFile> *superFiles);
 
     bool onWUQuery(IEspContext &context, IEspWUQueryRequest &req, IEspWUQueryResponse &resp);
     bool onWUPublishWorkunit(IEspContext &context, IEspWUPublishWorkunitRequest & req, IEspWUPublishWorkunitResponse & resp);