Selaa lähdekoodia

Merge pull request #6305 from afishbeck/configurableWsEclTargets

HPCC-11902 Allow targets shown in WsEcl to be restricted through config

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 11 vuotta sitten
vanhempi
commit
69d4e5ae0a

+ 10 - 3
esp/services/ws_ecl/ws_ecl_service.cpp

@@ -317,6 +317,10 @@ bool CWsEclService::init(const char * name, const char * type, IPropertyTree * c
     else
         workunitTimeout = WAIT_FOREVER;
 
+    Owned<IPropertyTreeIterator> cfgTargets = serviceTree->getElements("Targets/Target");
+    ForEach(*cfgTargets)
+        targets.append(cfgTargets->query().queryProp(NULL));
+
     IPropertyTree *vips = serviceTree->queryPropTree(xpath.str());
     Owned<IStringIterator> roxieTargets = getTargetClusters("RoxieCluster", NULL);
     ForEach(*roxieTargets)
@@ -403,12 +407,15 @@ void CWsEclBinding::getRootNavigationFolders(IEspContext &context, IPropertyTree
     data.addProp("@action", "NavMenuEvent");
     data.addProp("@appName", "WsECL 3.0");
 
-    Owned<IStringIterator> targets = getTargetClusters(NULL, NULL);
+    Owned<IStringIterator> envTargets = getTargetClusters(NULL, NULL);
 
     SCMStringBuffer target;
-    ForEach(*targets)
+    ForEach(*envTargets)
     {
-        VStringBuffer parms("queryset=%s", targets->str(target).str());
+        envTargets->str(target);
+        if (wsecl->targets.length() && !wsecl->targets.contains(target.str()))
+            continue;
+        VStringBuffer parms("queryset=%s", target.str());
         ensureNavDynFolder(data, target.str(), target.str(), parms.str(), NULL);
     }
 }

+ 1 - 0
esp/services/ws_ecl/ws_ecl_service.hpp

@@ -92,6 +92,7 @@ class CWsEclService : public CInterface,
 {
 public:
     MapStringToMyClass<ISmartSocketFactory> connMap;
+    StringArray targets;
     StringAttr auth_method;
     StringAttr portal_URL;
     unsigned roxieTimeout;

+ 5 - 0
initfiles/componentfiles/configxml/@temp/esp_service.xsl

@@ -942,6 +942,11 @@ xmlns:seisint="http://seisint.com"  xmlns:set="http://exslt.org/sets" exclude-re
                         </xsl:if>
                     </xsl:for-each>
                 </VIPS>
+                <Targets>
+                    <xsl:for-each select="Target">
+                        <Target><xsl:value-of select="@name"/></Target>
+                    </xsl:for-each>
+                </Targets>
             </xsl:when>
         </xsl:choose>
     </xsl:template>

+ 18 - 0
initfiles/componentfiles/configxml/esp_service_wsecl2.xsd

@@ -55,6 +55,24 @@
                 </xs:complexType>
               </xs:element>
             </xs:sequence>
+            <xs:sequence>
+              <xs:element name="Target" minOccurs="0" maxOccurs="unbounded">
+                <xs:annotation>
+                  <xs:appinfo>
+                    <title>Restrict To Target(s)</title>
+                  </xs:appinfo>
+                </xs:annotation>
+                <xs:complexType>
+                  <xs:attribute name="name" type="topologyClusterType" use="required">
+	                <xs:annotation>
+	                  <xs:appinfo>
+	                    <tooltip>WsEcl will only display specified targets, if none specified WsEcl will display all targets.</tooltip>
+	                  </xs:appinfo>
+	                </xs:annotation>
+                  </xs:attribute>
+                </xs:complexType>
+              </xs:element>
+            </xs:sequence>
             <xs:attribute name="build" type="buildType" use="required">
                 <xs:annotation>
                     <xs:appinfo>