|
@@ -24,7 +24,6 @@ define([
|
|
|
"dojo/on",
|
|
|
|
|
|
"dijit/registry",
|
|
|
- "dijit/Dialog",
|
|
|
"dijit/Menu",
|
|
|
"dijit/MenuItem",
|
|
|
"dijit/MenuSeparator",
|
|
@@ -44,6 +43,7 @@ define([
|
|
|
"hpcc/ESPWorkunit",
|
|
|
"hpcc/WUDetailsWidget",
|
|
|
"hpcc/TargetSelectWidget",
|
|
|
+ "hpcc/FilterDropDownWidget",
|
|
|
|
|
|
"dojo/text!../templates/WUQueryWidget.html",
|
|
|
|
|
@@ -62,9 +62,9 @@ define([
|
|
|
"dojox/layout/TableContainer"
|
|
|
|
|
|
], function (declare, lang, arrayUtil, dom, domClass, domForm, date, on,
|
|
|
- registry, Dialog, Menu, MenuItem, MenuSeparator, PopupMenuItem,
|
|
|
+ registry, Menu, MenuItem, MenuSeparator, PopupMenuItem,
|
|
|
Grid, Keyboard, Selection, selector, ColumnResizer, DijitRegistry, Pagination,
|
|
|
- _TabContainerWidget, WsWorkunits, ESPUtil, ESPWorkunit, WUDetailsWidget, TargetSelectWidget,
|
|
|
+ _TabContainerWidget, WsWorkunits, ESPUtil, ESPWorkunit, WUDetailsWidget, TargetSelectWidget, FilterDropDownWidget,
|
|
|
template) {
|
|
|
return declare("WUQueryWidget", [_TabContainerWidget, ESPUtil.FormHelper], {
|
|
|
templateString: template,
|
|
@@ -72,14 +72,14 @@ define([
|
|
|
|
|
|
workunitsTab: null,
|
|
|
workunitsGrid: null,
|
|
|
+ filter: null,
|
|
|
clusterTargetSelect: null,
|
|
|
stateSelect: null,
|
|
|
|
|
|
- validateDialog: null,
|
|
|
-
|
|
|
postCreate: function (args) {
|
|
|
this.inherited(arguments);
|
|
|
this.workunitsTab = registry.byId(this.id + "_Workunits");
|
|
|
+ this.filter = registry.byId(this.id + "Filter");
|
|
|
this.clusterTargetSelect = registry.byId(this.id + "ClusterTargetSelect");
|
|
|
this.stateSelect = registry.byId(this.id + "StateSelect");
|
|
|
this.logicalFileSearchTypeSelect = registry.byId(this.id + "LogicalFileSearchType");
|
|
@@ -88,7 +88,6 @@ define([
|
|
|
startup: function (args) {
|
|
|
this.inherited(arguments);
|
|
|
this.initContextMenu();
|
|
|
- this.initFilter();
|
|
|
},
|
|
|
|
|
|
getTitle: function () {
|
|
@@ -150,20 +149,6 @@ define([
|
|
|
_onDeschedule: function (event) {
|
|
|
},
|
|
|
|
|
|
- _onFilterApply: function (event) {
|
|
|
- registry.byId(this.id + "FilterDropDown").closeDropDown();
|
|
|
- if (this.hasFilter()) {
|
|
|
- this.applyFilter();
|
|
|
- } else {
|
|
|
- this.validateDialog.show();
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- _onFilterClear: function (event) {
|
|
|
- this.clearFilter();
|
|
|
- this.applyFilter();
|
|
|
- },
|
|
|
-
|
|
|
_onRowDblClick: function (wuid) {
|
|
|
var wuTab = this.ensurePane(this.id + "_" + wuid, {
|
|
|
Wuid: wuid
|
|
@@ -207,24 +192,8 @@ define([
|
|
|
},
|
|
|
|
|
|
// Implementation ---
|
|
|
- clearFilter: function () {
|
|
|
- arrayUtil.forEach(registry.byId(this.id + "FilterForm").getDescendants(), function (item, idx) {
|
|
|
- item.set("value", null);
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
- hasFilter: function () {
|
|
|
- var filter = domForm.toObject(this.id + "FilterForm");
|
|
|
- for (var key in filter) {
|
|
|
- if (filter[key] != "") {
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- return false;
|
|
|
- },
|
|
|
-
|
|
|
getFilter: function () {
|
|
|
- var retVal = domForm.toObject(this.id + "FilterForm");
|
|
|
+ var retVal = this.filter.toObject();
|
|
|
lang.mixin(retVal, {
|
|
|
StartDate: this.getISOString("FromDate", "FromTime"),
|
|
|
EndDate: this.getISOString("ToDate", "ToTime")
|
|
@@ -240,10 +209,6 @@ define([
|
|
|
return retVal;
|
|
|
},
|
|
|
|
|
|
- applyFilter: function () {
|
|
|
- this.refreshGrid();
|
|
|
- },
|
|
|
-
|
|
|
// Implementation ---
|
|
|
init: function (params) {
|
|
|
if (this.inherited(arguments))
|
|
@@ -267,6 +232,14 @@ define([
|
|
|
|
|
|
this.initWorkunitsGrid();
|
|
|
this.selectChild(this.workunitsTab, true);
|
|
|
+
|
|
|
+ var context = this;
|
|
|
+ this.filter.on("clear", function (evt) {
|
|
|
+ context.refreshGrid();
|
|
|
+ });
|
|
|
+ this.filter.on("apply", function (evt) {
|
|
|
+ context.refreshGrid();
|
|
|
+ });
|
|
|
},
|
|
|
|
|
|
initTab: function () {
|
|
@@ -327,37 +300,38 @@ define([
|
|
|
var pSubMenu = new Menu();
|
|
|
this.menuFilterOwner = this.addMenuItem(pSubMenu, {
|
|
|
onClick: function (args) {
|
|
|
- context.clearFilter();
|
|
|
- registry.byId(context.id + "Owner").set("value", context.menuFilterOwner.get("hpcc_value"));
|
|
|
- context.applyFilter();
|
|
|
+ context.filter.clear();
|
|
|
+ context.filter.setValue(context.id + "Owner", context.menuFilterOwner.get("hpcc_value"));
|
|
|
+ context.refreshGrid();
|
|
|
}
|
|
|
});
|
|
|
this.menuFilterJobname = this.addMenuItem(pSubMenu, {
|
|
|
onClick: function (args) {
|
|
|
- context.clearFilter();
|
|
|
- registry.byId(context.id + "Jobname").set("value", context.menuFilterJobname.get("hpcc_value"));
|
|
|
- context.applyFilter();
|
|
|
+ context.filter.clear();
|
|
|
+ context.filter.setValue(context.id + "Jobname", context.menuFilterJobname.get("hpcc_value"));
|
|
|
+ context.refreshGrid();
|
|
|
}
|
|
|
});
|
|
|
this.menuFilterCluster = this.addMenuItem(pSubMenu, {
|
|
|
onClick: function (args) {
|
|
|
- context.clearFilter();
|
|
|
- registry.byId(context.id + "ClusterTargetSelect").set("value", context.menuFilterCluster.get("hpcc_value"));
|
|
|
- context.applyFilter();
|
|
|
+ context.filter.clear();
|
|
|
+ context.filter.setValue(context.id + "ClusterTargetSelect", context.menuFilterCluster.get("hpcc_value"));
|
|
|
+ context.refreshGrid();
|
|
|
}
|
|
|
});
|
|
|
this.menuFilterState = this.addMenuItem(pSubMenu, {
|
|
|
onClick: function (args) {
|
|
|
- context.clearFilter();
|
|
|
- registry.byId(context.id + "StateSelect").set("value", context.menuFilterState.get("hpcc_value"));
|
|
|
- context.applyFilter();
|
|
|
+ context.filter.clear();
|
|
|
+ context.filter.setValue(context.id + "StateSelect", context.menuFilterState.get("hpcc_value"));
|
|
|
+ context.refreshGrid();
|
|
|
}
|
|
|
});
|
|
|
pSubMenu.addChild(new MenuSeparator());
|
|
|
this.menuFilterClearFilter = this.addMenuItem(pSubMenu, {
|
|
|
label: "Clear",
|
|
|
onClick: function () {
|
|
|
- context._onFilterClear();
|
|
|
+ context.filter.clear();
|
|
|
+ context.refreshGrid();
|
|
|
}
|
|
|
});
|
|
|
pMenu.addChild(new PopupMenuItem({
|
|
@@ -446,13 +420,6 @@ define([
|
|
|
this.workunitsGrid.startup();
|
|
|
},
|
|
|
|
|
|
- initFilter: function () {
|
|
|
- this.validateDialog = new Dialog({
|
|
|
- title: "Filter",
|
|
|
- content: "No filter criteria specified."
|
|
|
- });
|
|
|
- },
|
|
|
-
|
|
|
refreshGrid: function (args) {
|
|
|
this.workunitsGrid.set("query", this.getFilter());
|
|
|
},
|
|
@@ -500,13 +467,6 @@ define([
|
|
|
|
|
|
this.menuProtect.set("disabled", !hasNotProtected);
|
|
|
this.menuUnprotect.set("disabled", !hasProtected);
|
|
|
-
|
|
|
- this.refreshFilterState();
|
|
|
- },
|
|
|
-
|
|
|
- refreshFilterState: function () {
|
|
|
- var hasFilter = this.hasFilter();
|
|
|
- dom.byId(this.id + "IconFilter").src = hasFilter ? "img/filter.png" : "img/noFilter.png";
|
|
|
},
|
|
|
|
|
|
ensurePane: function (id, params) {
|