Переглянути джерело

HPCC-9177 Configmgr - Allow dashes in the name field

- Allows dashes in the name field of components
  and the the options field in the eclcc server

Signed-off-by: Gleb Aronsky <gleb.aronsky@lexisnexis.com>
Gleb Aronsky 12 роки тому
батько
коміт
4b2dfae57c

+ 2 - 8
esp/files/scripts/configmgr/configmgr.js

@@ -951,19 +951,13 @@ function handleConfigCellClickEvent(oArgs, caller, isComplex) {
         refreshConfirm = false;
     }
 
-    var regEx = new RegExp("^[a-zA-Z0-9_]+$");
-    var regEx2 = new RegExp("^[a-zA-Z0-9_-]+$");
+    var regEx = new RegExp("^[a-zA-Z0-9_-]+$");
 
-    if (attrName == 'name' && record.getData('compType') == 'EclCCServerProcess' && !regEx2.test(newValue))
+    if (attrName == 'name' && regEx.test(newValue) == false)
     {
       alert("Invalid character in component name. Only alpha-numerics, underscores, and dashes are allowed.");
       return false;
     }
-    else if (attrName == 'name' && !(record.getData('compType') == 'EclCCServerProcess') && !regEx.test(newValue))
-    {
-      alert("Invalid character in component name. Only alpha-numerics and underscores are allowed.");
-      return false;
-    }
     var xmlArgs = argsToXml(category, params, attrName, oldValue, newValue, recordIndex + 1, record.getData(column.key + '_onChange'));
     YAHOO.util.Connect.asyncRequest('POST', '/WsDeploy/SaveSetting', {
       success: function(o) {

+ 3 - 9
esp/services/WsDeploy/WsDeployService.cpp

@@ -980,15 +980,9 @@ bool CWsDeployFileInfo::navMenuEvent(IEspContext &context,
     return true;
 }//onNavMenuEvent
 
-bool CWsDeployFileInfo::isAlphaNumeric(const char *pstr, const char *pExprOverride) const
+bool CWsDeployFileInfo::isAlphaNumeric(const char *pstr) const
 {
-  StringBuffer regExpStr;
-
-  if (pExprOverride == NULL)
-      regExpStr.append("[A-Za-z0-9_]+");
-  else
-      regExpStr.append(pExprOverride);
-  RegExpr expr(regExpStr.str());
+  RegExpr expr("[A-Za-z0-9_-]+");
 
   return (expr.find(pstr) && expr.findlen(0) == strlen(pstr));
 }
@@ -1352,7 +1346,7 @@ bool CWsDeployFileInfo::saveSetting(IEspContext &context, IEspSaveSettingRequest
         {
           ensureUniqueName(pEnvRoot, pComp, pszNewValue);
 
-          if (strcmp(pszCompType, "EclCCServerProcess") ? isAlphaNumeric(pszNewValue) == false : isAlphaNumeric(pszNewValue, "[-A-Za-z0-9_]+") == false)
+          if (isAlphaNumeric(pszNewValue) == false)
           {
             throw MakeStringException(-1, "Invalid Character in name '%s'.", pszNewValue);
           }

+ 1 - 1
esp/services/WsDeploy/WsDeployService.hpp

@@ -462,7 +462,7 @@ public:
     virtual bool navMenuEvent(IEspContext &context, IEspNavMenuEventRequest &req, 
                                             IEspNavMenuEventResponse &resp);
     virtual bool displaySettings(IEspContext &context, IEspDisplaySettingsRequest &req, IEspDisplaySettingsResponse &resp);
-    virtual bool isAlphaNumeric(const char *pstr, const char *pExprOverride = NULL) const;
+    virtual bool isAlphaNumeric(const char *pstr) const;
     virtual bool saveSetting(IEspContext &context, IEspSaveSettingRequest &req, IEspSaveSettingResponse &resp);
     virtual bool getBuildSetInfo(IEspContext &context, IEspGetBuildSetInfoRequest &req, IEspGetBuildSetInfoResponse &resp);
     virtual bool getDeployableComps(IEspContext &context, IEspGetDeployableCompsRequest &req, IEspGetDeployableCompsResponse &resp);