Bläddra i källkod

Merge pull request #10336 from miguelvazq/HPCC-17970

HPCC-17970 Reschedule/Deschedule buttons enabling

Reviewed-By: Gordon Smith <gordon.smith@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 7 år sedan
förälder
incheckning
b95ce2e085

+ 6 - 0
esp/src/eclwatch/ESPWorkunit.js

@@ -243,6 +243,12 @@ define([
         isBlocked: function () {
             return this.StateID === 8;
         },
+        isAbleToDeschedule: function () {
+            return this.EventSchedule === 2;
+        },
+        isAbleToReschedule: function () {
+            return this.EventSchedule === 1;
+        },
         monitor: function (callback) {
             if (callback) {
                 callback(this);

+ 4 - 2
esp/src/eclwatch/WUDetailsWidget.js

@@ -539,6 +539,8 @@ define([
                 this.refreshActionState();
             } else if (name === "ActionEx") {
                 this.refreshActionState();
+            } else if (name === "EventSchedule") {
+                this.refreshActionState();
             } else if (name === "hasCompleted") {
                 this.checkIfComplete();
             } else if (name === "Scope" && newValue) {
@@ -569,8 +571,8 @@ define([
             registry.byId(this.id + "Recover").set("disabled", isArchived || !this.wu.isComplete() || this.wu.isDeleted());
             registry.byId(this.id + "Publish").set("disabled", isArchived || !this.wu.isComplete() || this.wu.isDeleted());
             registry.byId(this.id + "ZapReport").set("disabled", this.wu.isDeleted());
-            registry.byId(this.id + "Reschedule").set("disabled", !this.wu.isComplete() || this.wu.isFailed());
-            registry.byId(this.id + "Deschedule").set("disabled", this.wu.isComplete() || this.wu.isFailed());
+            registry.byId(this.id + "Reschedule").set("disabled", !this.wu.isAbleToReschedule());
+            registry.byId(this.id + "Deschedule").set("disabled", !this.wu.isAbleToDeschedule());
 
             registry.byId(this.id + "Jobname").set("readOnly", !this.wu.isComplete() || this.wu.isDeleted());
             registry.byId(this.id + "Description").set("readOnly", !this.wu.isComplete() || this.wu.isDeleted());

+ 1 - 18
esp/src/eclwatch/WUQueryWidget.js

@@ -366,15 +366,6 @@ define([
                 onClick: function () { context._onUnprotect(); }
             });
             pMenu.addChild(new MenuSeparator());
-            this.menuReschedule = this.addMenuItem(pMenu, {
-                label: this.i18n.Reschedule,
-                onClick: function () { context._onReschedule(); }
-            });
-            this.menuDeschedule = this.addMenuItem(pMenu, {
-                label: this.i18n.Deschedule,
-                onClick: function () { context._onDeschedule(); }
-            });
-            pMenu.addChild(new MenuSeparator());
             {
                 var pSubMenu = new Menu();
                 this.menuFilterOwner = this.addMenuItem(pSubMenu, {
@@ -516,8 +507,7 @@ define([
             var hasNotFailed = false;
             var hasCompleted = false;
             var hasNotCompleted = false;
-            var isScheduled = false;
-            var isNotScheduled = false;
+
             for (var i = 0; i < selection.length; ++i) {
                 hasSelection = true;
                 if (selection[i] && selection[i].Protected !== null) {
@@ -539,11 +529,6 @@ define([
                         hasNotCompleted = true;
                     }
                 }
-                if (selection[i].EventSchedule === 2) {
-                    isScheduled = true;
-                } else if (selection[i].EventSchedule === 1) {
-                    isNotScheduled = true;
-                }
             }
 
             registry.byId(this.id + "Open").set("disabled", !hasSelection);
@@ -552,8 +537,6 @@ define([
             registry.byId(this.id + "SetToFailed").set("disabled", !hasNotProtected);
             registry.byId(this.id + "Protect").set("disabled", !hasNotProtected);
             registry.byId(this.id + "Unprotect").set("disabled", !hasProtected);
-            registry.byId(this.id + "Reschedule").set("disabled", !isNotScheduled);
-            registry.byId(this.id + "Deschedule").set("disabled", !isScheduled);
 
             this.menuProtect.set("disabled", !hasNotProtected);
             this.menuUnprotect.set("disabled", !hasProtected);

+ 1 - 4
esp/src/eclwatch/templates/WUQueryWidget.html

@@ -14,9 +14,6 @@
                     <div id="${id}Protect" data-dojo-attach-event="onClick:_onProtect" data-dojo-type="dijit.form.Button">${i18n.Protect}</div>
                     <div id="${id}Unprotect" data-dojo-attach-event="onClick:_onUnprotect" data-dojo-type="dijit.form.Button">${i18n.Unprotect}</div>
                     <span data-dojo-type="dijit.ToolbarSeparator"></span>
-                    <div id="${id}Reschedule" data-dojo-attach-event="onClick:_onReschedule" data-dojo-type="dijit.form.Button">${i18n.Reschedule}</div>
-                    <div id="${id}Deschedule" data-dojo-attach-event="onClick:_onDeschedule" data-dojo-type="dijit.form.Button">${i18n.Deschedule}</div>
-                    <span data-dojo-type="dijit.ToolbarSeparator"></span>
                     <div id="${id}Filter" data-dojo-type="FilterDropDownWidget">
                         <p id="${id}ArchivedWarning" style="display:none">${i18n.ArchivedWarning}</p>
                         <input id="${id}Type" title="${i18n.ArchivedOnly}" name="Type" colspan="2" data-dojo-attach-event="onClick:_onFilterType" data-dojo-props="value:'archived workunits'" data-dojo-type="dijit.form.CheckBox" />
@@ -56,4 +53,4 @@
             </div>
         </div>
     </div>
-</div>
+</div>