From 72ea467141f7291ea4e6a225c4d370c5dae22a6f Mon Sep 17 00:00:00 2001 From: vijayg10 <33152110+vijayg10@users.noreply.github.com> Date: Thu, 23 Sep 2021 10:47:07 -0700 Subject: [PATCH] Bugfix/stop button not working always (#121) * Added reset option to reset the test execution if Stop execution fails * Fixed alignment in condition builder * Aligned the condition builder to compy with allOf and oneOf syntax of openapi * Bumped up the version and postponed the audits --- audit-resolve.json | 24 ++++++++-------- package-lock.json | 2 +- package.json | 2 +- src/views/outbound/OutboundRequest.jsx | 22 +++++++++++++-- src/views/rules/BuilderTools.jsx | 28 +++++++++++++------ src/views/rules/ConditionBuilder.jsx | 38 ++++++++++++-------------- 6 files changed, 71 insertions(+), 45 deletions(-) diff --git a/audit-resolve.json b/audit-resolve.json index 29f4b99c..2d3fe832 100644 --- a/audit-resolve.json +++ b/audit-resolve.json @@ -150,7 +150,7 @@ }, "565|react-scripts>webpack>terser-webpack-plugin>cacache>ssri": { "decision": "postpone", - "madeAt": 1631622865889 + "madeAt": 1632415808487 }, "1665|socket.io-client>engine.io-client>xmlhttprequest-ssl": { "decision": "fix", @@ -23570,7 +23570,7 @@ }, "1693|react-scripts>postcss-safe-parser>postcss": { "decision": "postpone", - "madeAt": 1631622866821 + "madeAt": 1632415808983 }, "1693|react-scripts>css-loader>icss-utils>postcss": { "decision": "postpone", @@ -23886,7 +23886,7 @@ }, "1693|react-scripts>resolve-url-loader>postcss": { "decision": "postpone", - "madeAt": 1631622868182 + "madeAt": 1632415811063 }, "1746|socket.io-client>engine.io-client>xmlhttprequest-ssl": { "decision": "fix", @@ -24060,19 +24060,19 @@ }, "1747|react-scripts>react-dev-utils>browserslist": { "decision": "postpone", - "madeAt": 1631622868756 + "madeAt": 1632415811570 }, "1748|react-scripts>webpack-dev-server>ws": { "decision": "postpone", - "madeAt": 1631622867496 + "madeAt": 1632415809479 }, "1751|react-scripts>webpack>watchpack>watchpack-chokidar2>chokidar>glob-parent": { "decision": "postpone", - "madeAt": 1631622869397 + "madeAt": 1632415812110 }, "1751|react-scripts>webpack-dev-server>chokidar>glob-parent": { "decision": "postpone", - "madeAt": 1631622869397 + "madeAt": 1632415812110 }, "1754|react-scripts>@svgr/webpack>@svgr/plugin-svgo>svgo>css-select>css-what": { "decision": "ignore", @@ -24104,11 +24104,11 @@ }, "1770|react-scripts>terser-webpack-plugin>cacache>tar": { "decision": "postpone", - "madeAt": 1631622670424 + "madeAt": 1632415810097 }, "1771|react-scripts>terser-webpack-plugin>cacache>tar": { "decision": "postpone", - "madeAt": 1631622670424 + "madeAt": 1632415810097 }, "1776|react-scripts>webpack-dev-server>sockjs-client>eventsource>original>url-parse": { "decision": "fix", @@ -25280,15 +25280,15 @@ }, "1779|react-scripts>terser-webpack-plugin>cacache>tar": { "decision": "postpone", - "madeAt": 1631622670424 + "madeAt": 1632415810097 }, "1780|react-scripts>terser-webpack-plugin>cacache>tar": { "decision": "postpone", - "madeAt": 1631622670424 + "madeAt": 1632415810097 }, "1781|react-scripts>terser-webpack-plugin>cacache>tar": { "decision": "postpone", - "madeAt": 1631622670424 + "madeAt": 1632415810097 } }, "rules": {}, diff --git a/package-lock.json b/package-lock.json index f49ed551..d3743419 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "ml-testing-toolkit-ui", - "version": "13.5.1", + "version": "13.5.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8a95b355..aa3b4781 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ml-testing-toolkit-ui", - "version": "13.5.2", + "version": "13.5.3", "description": "Mojaloop Testing Toolkit Web User Interface", "main": "index.js", "repository": { diff --git a/src/views/outbound/OutboundRequest.jsx b/src/views/outbound/OutboundRequest.jsx index 7e5f0812..8a51de9c 100644 --- a/src/views/outbound/OutboundRequest.jsx +++ b/src/views/outbound/OutboundRequest.jsx @@ -144,7 +144,8 @@ class OutboundRequest extends React.Component { tempReorderedTestCases: [], serverLogsVisible: true, testCaseEditorLogs: [], - environmentManagerVisible: false + environmentManagerVisible: false, + resetExecutionOptionEnabled: false }; } @@ -211,6 +212,9 @@ class OutboundRequest extends React.Component { } handleIncomingProgress = (progress) => { + if (!this.state.sendingOutboundRequestID) { + return null + } if (progress.status === 'FINISHED') { message.success({ content: 'Test case finished', key: 'outboundSendProgress', duration: 2 }); this.setState({ sendingOutboundRequestID: null, testReport: progress.totalResult }) @@ -295,6 +299,7 @@ class OutboundRequest extends React.Component { // await axios.post(apiBaseUrl + "/api/outbound/template/" + outboundRequestID, template ? template : this.state.template, { headers: { 'Content-Type': 'application/json' } }) await axios.post(apiBaseUrl + "/api/outbound/template/" + traceId, convertedTemplate, { headers: { 'Content-Type': 'application/json' } }) + this.state.resetExecutionOptionEnabled = false this.state.sendingOutboundRequestID = traceId this.state.lastOutgoingRequestID = traceId this.state.testCaseEditorLogs = [] @@ -322,9 +327,20 @@ class OutboundRequest extends React.Component { await axios.delete(apiBaseUrl + "/api/outbound/template/" + outboundRequestID) } + handleResetExecution = async () => { + message.error({ content: 'Execution has been reset', key: 'outboundSendProgress', duration: 2 }); + message.error({ content: 'Execution has been reset', key: 'outboundStopProgress', duration: 2 }); + this.setState({ sendingOutboundRequestID: null, resetExecutionOptionEnabled: false }) + } + handleSendStopClick = () => { if (this.state.sendingOutboundRequestID) { - this.handleStopExecution(this.state.sendingOutboundRequestID) + if (this.state.resetExecutionOptionEnabled) { + this.handleResetExecution(this.state.sendingOutboundRequestID) + } else { + this.handleStopExecution(this.state.sendingOutboundRequestID) + this.setState({ resetExecutionOptionEnabled: true }) + } } else { this.handleSendTemplate() } @@ -987,7 +1003,7 @@ class OutboundRequest extends React.Component { danger onClick={this.handleSendStopClick} > - {this.state.sendingOutboundRequestID ? 'Stop' : 'Run'} + {this.state.sendingOutboundRequestID ? (this.state.resetExecutionOptionEnabled ? 'Reset' : 'Stop') : 'Run'} - - - - + + )