partkeepr

fork of partkeepr
git clone https://git.e1e0.net/partkeepr.git
Log | Files | Refs | Submodules | README | LICENSE

commit 0cce9954b8fc3154694533b68e33fb9eedb595c3
parent e758a96fa6c7746121b7bafcdaa52d639c87e803
Author: Felicitus <felicitus@felicitus.org>
Date:   Sat, 28 Nov 2015 15:03:38 +0100

Added warnings to the test runner

Diffstat:
Mweb/setup/js/SetupTests/AbstractTest.js | 10+++++-----
Mweb/setup/js/TestResultPanel.js | 43+++++++++++++++++++++++++++++++++++++++----
2 files changed, 44 insertions(+), 9 deletions(-)

diff --git a/web/setup/js/SetupTests/AbstractTest.js b/web/setup/js/SetupTests/AbstractTest.js @@ -34,6 +34,7 @@ Ext.define('PartKeeprSetup.AbstractTest', { message: "", errors: [], + warnings: [], /** * Defines if a test should be skipped. No output will be generated. @@ -42,11 +43,6 @@ Ext.define('PartKeeprSetup.AbstractTest', { skip: false, /** - * Defines any warnings for the test. - */ - warnings: null, - - /** * Defines additional parameters which are to be sent with the request. The format is an object, * e.g. * { @@ -144,6 +140,10 @@ Ext.define('PartKeeprSetup.AbstractTest', { this.success = true; } + if (obj.warnings !== undefined && Ext.isArray(obj.warnings)) { + this.warnings = obj.warnings; + } + this.resultMessage = obj.message; if (this.callback) { diff --git a/web/setup/js/TestResultPanel.js b/web/setup/js/TestResultPanel.js @@ -22,6 +22,12 @@ Ext.define('PartKeeprSetup.TestResultPanel', { name: 'errors', type: 'string' }, { + name: 'warnings', + type: 'string' + }, { + name: 'noWarning', + type: 'boolean' + }, { name: 'waiting', type: 'boolean' } @@ -41,7 +47,12 @@ Ext.define('PartKeeprSetup.TestResultPanel', { } if (val) { - return '<span title="OK" style="vertical-align: top;" class="web-icon accept"></span>'; + if (record.get("warnings").length > 0) { + return '<span title="OK" style="vertical-align: top;" class="web-icon error"></span>'; + } else { + return '<span title="OK" style="vertical-align: top;" class="web-icon accept"></span>'; + } + } else { return '<span title="Error" style="vertical-align: top;" class="web-icon cancel"></span>'; } @@ -50,20 +61,35 @@ Ext.define('PartKeeprSetup.TestResultPanel', { flex: 2, dataIndex: 'message' }, { - flex: 0.5, + width: 130, xtype: 'widgetcolumn', dataIndex: 'success', widget: { hidden: true, xtype: 'button', defaultBindProperty: "hidden", - text: "Show details", + text: "Show Errors", handler: function (widgetColumn) { var record = widgetColumn.getWidgetRecord(); Ext.Msg.alert("Error Details", record.get("errors")); } } + },{ + width: 130, + xtype: 'widgetcolumn', + dataIndex: 'noWarning', + widget: { + hidden: true, + xtype: 'button', + defaultBindProperty: "hidden", + text: "Show Warnings", + handler: function (widgetColumn) + { + var record = widgetColumn.getWidgetRecord(); + Ext.Msg.alert("Warning Details", record.get("warnings")); + } + } } ], /** @@ -88,7 +114,8 @@ Ext.define('PartKeeprSetup.TestResultPanel', { this.store.add({ name: test.message, success: true, - waiting: true + waiting: true, + noWarning: true }); }, /** @@ -105,6 +132,14 @@ Ext.define('PartKeeprSetup.TestResultPanel', { rec.set("success", test.success); rec.set("message", test.resultMessage); rec.set("errors", test.errors.join("<br/>")); + + if (test.warnings.length > 0) { + rec.set("warnings", test.warnings.join("<br/>")); + rec.set("noWarning", false); + } else { + rec.set("noWarning", true); + } + rec.set("waiting", false); rec.commit(); }