Преглед на файлове

ECLPlayground: Warnings not displaying.

If a WU has warnings and results (no errors) the warning tab would not be displayed.
Moved renamed WUResult.js to WsWorkunits.js and added WUQuery call.

Fixes gh-2283

Signed-off-by: Gordon Smith <gordon.smith@lexisnexis.com>
Gordon Smith преди 13 години
родител
ревизия
a5ff872bf3
променени са 4 файла, в които са добавени 103 реда и са изтрити 40 реда
  1. 9 6
      esp/files/ECLPlayground.js
  2. 3 3
      esp/files/scripts/ESPResult.js
  3. 34 27
      esp/files/scripts/ResultsControl.js
  4. 57 4
      esp/files/scripts/WUResultStore.js

+ 9 - 6
esp/files/ECLPlayground.js

@@ -158,20 +158,16 @@ define([
 					wu.getInfo({
 						onGetExceptions: displayExceptions,
 						onGetResults: displayResults,
-						onGetGraphs: displayGraphs
+						onGetGraphs: displayGraphs,
+						onGetAll: displayAll
 					});
 				}
 			},
 
 			displayExceptions = function (exceptions) {
-				if (exceptions.length) {
-					editorControl.setErrors(wu.exceptions);
-					resultsControl.addExceptionTab(wu.exceptions);
-				}
 			},
 
 			displayResults = function (results) {
-				resultsControl.refreshResults(wu);
 			},
 
 			displayGraphs = function (graphs) {
@@ -182,6 +178,13 @@ define([
 				}
 			},
 
+			displayAll = function (workunit) {
+				if (wu.exceptions.length) {
+					editorControl.setErrors(wu.exceptions);
+				}
+				resultsControl.refresh(wu);
+			},
+
 			doSubmit = function (evt) {
 				resetPage();
 				wu = new Workunit({

+ 3 - 3
esp/files/scripts/ESPResult.js

@@ -17,16 +17,16 @@
 define([
 	"dojo/_base/declare",
 	"dojo/data/ObjectStore",
-	"hpcc/WUResultStore",
+	"hpcc/WsWorkunits",
 	"hpcc/ESPBase"
-], function (declare, ObjectStore, WUResultStore, ESPBase) {
+], function (declare, ObjectStore, WsWorkunits, ESPBase) {
 	return declare(ESPBase, {
 		store: null,
 		Total: "-1",
 
 		constructor: function (args) {
 			declare.safeMixin(this, args);
-			this.store = new WUResultStore({
+			this.store = new WsWorkunits.WUResult({
 				wuid: this.wuid,
 				sequence: this.Sequence,
 				isComplete: this.isComplete()

+ 34 - 27
esp/files/scripts/ResultsControl.js

@@ -113,13 +113,18 @@ define([
 			return this.addTab(result.getName(), paneID);
 		},
 
-		refreshResults: function (wu) {
+		refresh: function (wu) {
 			if (this.workunit != wu) {
 				this.clear();
 				this.workunit = wu;
 			}
-			for (var i = 0; i < this.workunit.results.length; ++i) {
-				var result = this.workunit.results[i];
+			this.addExceptionTab(this.workunit.exceptions);
+			this.addResultsTab(this.workunit.results);
+		},
+
+		addResultsTab: function (results) {
+			for (var i = 0; i < results.length; ++i) {
+				var result = results[i];
 				if (result.Sequence in this.sequenceResultStoreMap) {
 					this.sequenceResultStoreMap[result.Sequence].isComplete = result.isComplete();
 				} else {
@@ -132,32 +137,34 @@ define([
 		},
 
 		addExceptionTab: function (exceptions) {
-			var resultNode = this.addTab("Error/Warning(s)");
-			store = new Memory({ data: exceptions });
-			dataStore = new ObjectStore({ objectStore: store });
+			if (exceptions.length) {
+				var resultNode = this.addTab("Error/Warning(s)");
+				store = new Memory({ data: exceptions });
+				dataStore = new ObjectStore({ objectStore: store });
 
-			grid = new DataGrid({
-				store: dataStore,
-				query: { id: "*" },
-				structure: [
-					{ name: "Severity", field: "Severity" },
-					{ name: "Line", field: "LineNo" },
-					{ name: "Column", field: "Column" },
-					{ name: "Code", field: "Code" },
-					{ name: "Message", field: "Message", width: "auto" }
-					]
-			});
-			grid.placeAt(resultNode.containerNode, "last");
-			grid.startup();
+				grid = new DataGrid({
+					store: dataStore,
+					query: { id: "*" },
+					structure: [
+						{ name: "Severity", field: "Severity" },
+						{ name: "Line", field: "LineNo" },
+						{ name: "Column", field: "Column" },
+						{ name: "Code", field: "Code" },
+						{ name: "Message", field: "Message", width: "auto" }
+						]
+				});
+				grid.placeAt(resultNode.containerNode, "last");
+				grid.startup();
 
-			var context = this;
-			grid.on("RowClick", function (evt) {
-				var idx = evt.rowIndex;
-				var item = this.getItem(idx);
-				var line = parseInt(this.store.getValue(item, "LineNo"), 10);
-				var col = parseInt(this.store.getValue(item, "Column"), 10);
-				context.onErrorClick(line, col);
-			}, true);
+				var context = this;
+				grid.on("RowClick", function (evt) {
+					var idx = evt.rowIndex;
+					var item = this.getItem(idx);
+					var line = parseInt(this.store.getValue(item, "LineNo"), 10);
+					var col = parseInt(this.store.getValue(item, "Column"), 10);
+					context.onErrorClick(line, col);
+				}, true);
+			}
 		}
 	});
 });

+ 57 - 4
esp/files/scripts/WUResultStore.js

@@ -16,13 +16,60 @@
 ############################################################################## */
 define([
 	"dojo/_base/declare",
-	"dojo/_base/xhr",
 	"dojo/_base/lang",
+	"dojo/_base/xhr",
 	"dojo/_base/Deferred",
 	"dojo/store/util/QueryResults",
 	"hpcc/ESPBase"
-], function (declare, xhr, lang, Deferred, QueryResults, ESPBase) {
-	return declare(ESPBase, {
+], function (declare, lang, xhr, Deferred, QueryResults, ESPBase) {
+	var WUQuery = declare(ESPBase, {
+		idProperty: "Wuid",
+
+		constructor: function (options) {
+			declare.safeMixin(this, options);
+		},
+
+		getIdentity: function (object) {
+			return object[this.idProperty];
+		},
+
+		query: function (query, options) {
+			var request = {};
+			lang.mixin(request, options.query);
+			if (options.start)
+				request['PageStartFrom'] = options.start;
+			if (options.count)
+				request['Count'] = options.count;
+			if (options.sort) {
+				request['Sortby'] = options.sort[0].attribute;
+				request['Descending'] = options.sort[0].descending;
+			}
+			request['rawxml_'] = "1";
+
+			var results = xhr.get({
+				url: this.getBaseURL("WsWorkunits") + "/WUQuery",
+				handleAs: "xml",
+				content: request
+			});
+
+			var context = this;
+			var parsedResults = results.then(function (domXml) {
+				data = context.getValues(domXml, "ECLWorkunit");
+				data.total = context.getValue(domXml, "NumWUs");
+				return data;
+			});
+
+			lang.mixin(parsedResults, {
+				total: Deferred.when(parsedResults, function (data) {
+					return data.total;
+				})
+			});
+	
+			return QueryResults(parsedResults);
+		}
+	});
+
+	var WUResult =  declare(ESPBase, {
 		idProperty: "myInjectedRowNum",
 		wuid: "",
 		sequence: 0,
@@ -47,7 +94,7 @@ define([
 				request['rawxml_'] = "1";
 
 				var results = xhr.post({
-					url: this.getBaseURL() + "/WUResult",
+					url: this.getBaseURL("WsWorkunits") + "/WUResult",
 					handleAs: "xml",
 					content: request,
 					load: function(domXml) {
@@ -80,4 +127,10 @@ define([
 			return QueryResults(retVal);
 		}
 	});
+
+	return {
+		WUQuery: WUQuery,
+		WUResult: WUResult
+	};
 });
+