Przeglądaj źródła

Merge pull request #2601 from garonsky/issue-2387_give_hint_of_active_xml

Fix gh-2387 configmgr - Give indication of staged configuration

Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 13 lat temu
rodzic
commit
03b8fb1a48

+ 20 - 3
esp/files/scripts/configmgr/navtree.js

@@ -230,6 +230,7 @@ function invokeWizard() {
   }
   else {
     updateWizCtrls();
+    loadAndCheckFileNames('4');
     top.document.displayModeDialog1.show();
   }
 }
@@ -4564,9 +4565,25 @@ function loadAndCheckFileNames(value)
             for (var i = 0; i < files.length; i++) {
               if (files[i] !== '') {
                 var optn = document.createElement("OPTION");
-                optn.text = files[i];
-                optn.value = files[i];
-                element.options.add(optn);
+                if (files[i] == "<StagedConfiguration>")
+                {
+                  i++;
+                  optn.style.backgroundColor = "#004ADE";
+                  optn.style.color = "white";
+                  optn.title = "Currently Staged";
+
+                  optn.text = files[i];
+                  optn.value = files[i];
+                  element.options.add(optn);
+
+                  i++;
+                }
+                else
+                {
+                  optn.text = files[i];
+                  optn.value = files[i];
+                  element.options.add(optn);
+                }
               }
             }
           }

+ 21 - 1
esp/services/WsDeploy/WsDeployService.cpp

@@ -34,6 +34,7 @@
 #define STANDARD_CONFIG_SOURCEDIR CONFIG_DIR
 #define STANDARD_CONFIG_BUILDSETFILE "buildset.xml"
 #define STANDARD_CONFIG_CONFIGXML_DIR "/componentfiles/configxml/"
+#define STANDARD_CONFIG_STAGED_PATH "/etc/HPCCSystems/environment.xml"
 
 #define DEFAULT_DIRECTORIES "<Directories name=\""DIR_NAME"\">\
       <Category dir=\""EXEC_PREFIX"/log/[NAME]/[INST]\" name=\"log\"/>\
@@ -6330,6 +6331,10 @@ bool CWsDeployExCE::onGetValue(IEspContext &context, IEspGetValueRequest &req, I
   {
     sbMultiple.clear();
     Owned<IFile> pDir = createIFile(getSourceDir());
+
+    StringBuffer activeConfig_md5sum, config_md5sum;
+    md5_filesum(STANDARD_CONFIG_STAGED_PATH, activeConfig_md5sum);
+
     if (pDir->exists())
     {
       if (pDir->isDirectory())
@@ -6348,9 +6353,24 @@ bool CWsDeployExCE::onGetValue(IEspContext &context, IEspGetValueRequest &req, I
             try
             {
               Owned<IPropertyTree> pTree = createPTreeFromXMLFile(sb.str());
+              StringBuffer testFile;
+
+              testFile.clear().appendf("%s/%s",getSourceDir(),it->getName(name.clear()).str());
+              md5_filesum(testFile.str(),config_md5sum.clear());
 
               if (pTree && pTree->queryName() && !strcmp(XML_TAG_ENVIRONMENT, pTree->queryName()))
-                sbMultiple.append(it->getName(name.clear())).append(";");
+              {
+                if(strcmp(config_md5sum.str(),activeConfig_md5sum.str())==0)
+                {
+                  sbMultiple.append("<StagedConfiguration>").append(";");
+                  sbMultiple.append(it->getName(name.clear())).append(";");
+                  sbMultiple.append("</StagedConfiguration>").append(";");
+                }
+                else
+                {
+                  sbMultiple.append(it->getName(name.clear())).append(";");
+                }
+              }
             }
             catch(IException* e)
             {