Skip to content

Commit

Permalink
HPCC-30429 Fix WsECL display for 'Create Workunit' option
Browse files Browse the repository at this point in the history
The 'Create Workunit' option should not be available for a
queriesOnly roxie.

Signed-off-by: wangkx <[email protected]>
  • Loading branch information
wangkx committed Oct 11, 2023
1 parent a799031 commit c2370d4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
23 changes: 20 additions & 3 deletions esp/services/ws_ecl/ws_ecl_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1568,12 +1568,17 @@ int CWsEclBinding::getGenForm(IEspContext &context, CHttpRequest* request, CHttp
xform->setParameter("useTextareaForStringArray", "1");

#ifdef _CONTAINERIZED
bool isRoxie = wsecl->connMap.getValue(wuinfo.qsetname) != nullptr;
#else
VStringBuffer xpath("queues[@name='%s']", wuinfo.qsetname.get());
IPropertyTree *queue = getComponentConfigSP()->queryPropTree(xpath.str());
if (queue && strieq(queue->queryProp("@type"), "roxie"))
xform->setParameter("includeRoxieOptions", queue->getPropBool("@queriesOnly") ? "2" : "3");
else
xform->setParameter("includeRoxieOptions", "0");
#else
Owned<IConstWUClusterInfo> clusterInfo = getTargetClusterInfo(wuinfo.qsetname);
bool isRoxie = clusterInfo && (clusterInfo->getPlatform() == RoxieCluster);
#endif
xform->setParameter("includeRoxieOptions", isRoxie ? "1" : "0");
#endif

// set the prop noDefaultValue param
IProperties* props = context.queryRequestParameters();
Expand Down Expand Up @@ -2134,8 +2139,18 @@ void CWsEclBinding::sendRoxieRequest(const char *target, StringBuffer &req, Stri
}
}

static void checkForceCreateWorkunit(IEspContext &context, bool forceCreateWorkunit)
{
bool statsToWorkunit = context.queryRequestParameters()->getPropBool("@statsToWorkunit", false);
bool summaryStats = context.queryRequestParameters()->getPropBool("@summaryStats", false);
if (forceCreateWorkunit && (statsToWorkunit || summaryStats))
throw makeStringException(-1, "Both 'Save stats to workunit' and 'Get summary stats' are not supported for the 'Create Workunit' option");
}

int CWsEclBinding::onSubmitQueryOutput(IEspContext &context, CHttpRequest* request, CHttpResponse* response, WsEclWuInfo &wsinfo, const char *format, bool forceCreateWorkunit)
{
checkForceCreateWorkunit(context, forceCreateWorkunit);

StringBuffer status;
StringBuffer output;

Expand Down Expand Up @@ -2200,6 +2215,8 @@ int CWsEclBinding::onSubmitQueryOutput(IEspContext &context, CHttpRequest* reque

int CWsEclBinding::onSubmitQueryOutputView(IEspContext &context, CHttpRequest* request, CHttpResponse* response, WsEclWuInfo &wsinfo, bool forceCreateWorkunit)
{
checkForceCreateWorkunit(context, forceCreateWorkunit);

IConstWorkUnit *wu = wsinfo.ensureWorkUnit();

StringBuffer soapmsg;
Expand Down
12 changes: 11 additions & 1 deletion esp/xslt/wsecl3_form.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ function switchInputForm()
</span>
</td>
</tr>
<xsl:if test="$includeRoxieOptions=1">
<xsl:if test="$includeRoxieOptions=1 or $includeRoxieOptions=2">
<tr>
<td class='input' align='left'>
<span>
Expand Down Expand Up @@ -339,6 +339,16 @@ function switchInputForm()
<option value="QUERY">Call Query</option>
<option value="WORKUNIT">Create Workunit</option>
</select>&nbsp;
</xsl:if>
<xsl:if test="$includeRoxieOptions=2">
<select id="job_type">
<option value="QUERY">Call Query</option>
</select>&nbsp;
</xsl:if>
<xsl:if test="$includeRoxieOptions=3">
<select id="job_type">
<option value="WORKUNIT">Create Workunit</option>
</select>&nbsp;
</xsl:if>
<select id="submit_type" name="submit_type">
<xsl:for-each select="/FormInfo/CustomViews/Result">
Expand Down

0 comments on commit c2370d4

Please sign in to comment.