Sfoglia il codice sorgente

HPCC-13532 Set reschedule flag based on WU state

The EventSchedule flag in ECL WUInfo response is used to
decide whether a Reschedule button should be shown on the
ECL WU Details page or not. Since the schedule is not
allowed for WUStateFailed, WUStateArchived, WUStateAborting,
WUStateAborted, and WUStateScheduled, the EventSchedule flag
should be set based on WU state.

This fix also removes the duplicated code in getWorkflow().

Signed-off-by: wangkx <kevin.wang@lexisnexis.com>
wangkx 10 anni fa
parent
commit
23b9163c5b
1 ha cambiato i file con 4 aggiunte e 15 eliminazioni
  1. 4 15
      esp/services/ws_workunits/ws_workunitsHelpers.cpp

+ 4 - 15
esp/services/ws_workunits/ws_workunitsHelpers.cpp

@@ -911,7 +911,10 @@ void WsWuInfo::getEventScheduleFlag(IEspECLWorkunit &info)
                 if (!wfevent)
                     continue;
 
-                if (!r->hasScheduleCount() || (r->queryScheduleCountRemaining() > 0))
+                if ((!r->hasScheduleCount() || (r->queryScheduleCountRemaining() > 0))
+                    && info.getState() && !strieq(info.getState(), "scheduled")
+                    && !strieq(info.getState(), "aborting") && !strieq(info.getState(), "aborted")
+                    && !strieq(info.getState(), "failed") && !strieq(info.getState(), "archived"))
                 {
                     info.setEventSchedule(1); //Can reschedule
                     break;
@@ -1287,11 +1290,8 @@ bool WsWuInfo::getClusterInfo(IEspECLWorkunit &info, unsigned flags)
 
 void WsWuInfo::getWorkflow(IEspECLWorkunit &info, unsigned flags)
 {
-    bool eventCountRemaining = false;
-    bool eventCountUnlimited = false;
     try
     {
-        info.setEventSchedule(0);
         unsigned workflowsCount = 0;
         IArrayOf<IConstECLWorkflow> workflows;
         Owned<IConstWorkflowItemIterator> it = cw->getWorkflowItems();
@@ -1316,18 +1316,12 @@ void WsWuInfo::getWorkflow(IEspECLWorkunit &info, unsigned flags)
                         }
                         if (r->hasScheduleCount())
                         {
-                            if (r->queryScheduleCountRemaining() > 0)
-                                eventCountRemaining = true;
                             if (flags & WUINFO_IncludeWorkflows)
                             {
                                 g->setCount(r->queryScheduleCount());
                                 g->setCountRemaining(r->queryScheduleCountRemaining());
                             }
                         }
-                        else
-                        {
-                            eventCountUnlimited = true;
-                        }
                         workflowsCount++;
                         if (flags & WUINFO_IncludeWorkflows)
                             workflows.append(*g.getLink());
@@ -1348,11 +1342,6 @@ void WsWuInfo::getWorkflow(IEspECLWorkunit &info, unsigned flags)
         info.setWorkflowsDesc(eMsg.str());
         e->Release();
     }
-
-    if (info.getState() && !stricmp(info.getState(), "wait"))
-        info.setEventSchedule(2); //Can deschedule
-    else if (eventCountUnlimited || eventCountRemaining)
-        info.setEventSchedule(1); //Can reschedule
 }
 
 IDistributedFile* WsWuInfo::getLogicalFileData(IEspContext& context, const char* logicalName, bool& showFileContent)