From 8b346842194edb8a9e8c4cd2764ae8ebbce988f0 Mon Sep 17 00:00:00 2001 From: atulpurohit Date: Tue, 5 Nov 2019 14:31:56 +0530 Subject: Refresh option in validation result page Issue-ID: SDC-2585 Co-authored-by: nikhil.soni@vodafone.com Signed-off-by: atulpurohit Change-Id: I78f1385d219837c300cb33aff82b7459f137babb Signed-off-by: atulpurohit --- .../SoftwareProductValidationResultsView.jsx | 413 ++++++++++++--------- 1 file changed, 239 insertions(+), 174 deletions(-) (limited to 'openecomp-ui/src/sdc-app/onboarding/softwareProduct/validationResults/SoftwareProductValidationResultsView.jsx') diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validationResults/SoftwareProductValidationResultsView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validationResults/SoftwareProductValidationResultsView.jsx index 2c2cccd711..c5da4f6ca1 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validationResults/SoftwareProductValidationResultsView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validationResults/SoftwareProductValidationResultsView.jsx @@ -20,64 +20,48 @@ import { SVGIcon } from 'onap-ui-react'; import GridSection from 'nfvo-components/grid/GridSection.jsx'; import GridItem from 'nfvo-components/grid/GridItem.jsx'; import i18n from 'nfvo-utils/i18n/i18n.js'; -import unCamelCasedString from 'nfvo-utils/unCamelCaseString.js'; - -const TestResultComponent = ({ tests }) => { - return ( -
- {tests.map((test, index) => { - let name = 'errorCircle'; - let color = 'warning'; - if ( - test.testResult && - test.testResult.toLowerCase() === 'pass' - ) { - color = 'positive'; - name = 'checkCircle'; - } else if ( - test.testResult && - test.testResult.toLowerCase() === 'fail' - ) { - name = 'exclamationTriangleFull'; - } - return ( -
  • - - - {test.testName + - ' | ' + - test.testResult + - ' | ' + - test.notes} - -
  • - ); - })} -
    - ); -}; class SoftwareProductValidationResultsView extends React.Component { static propTypes = { - softwareProductValidation: PropTypes.object + softwareProductValidation: PropTypes.object, + refreshValidationResults: PropTypes.func }; constructor(props) { super(props); this.state = { vspId: this.props.softwareProductId, - versionNumber: this.props.version.name + versionNumber: this.props.version.name, + refreshValidationResults: this.props.refreshValidationResults, + vspTestResults: this.props.vspTestResults, + flatTestsMap: {}, + generalInfo: {} }; } + componentDidMount() { + this.configBasicTestData(); + } + componentDidUpdate() { + this.updateTestResultToDisplay(); + } + + prepareDataForCheckboxes(children, ftm) { + for (var val of children) { + if (val.children) { + this.prepareDataForCheckboxes(val.children, ftm); + } else if (val.tests) { + for (var test of val.tests) { + ftm[test.testCaseName] = test.description; + } + } + } + return ftm; + } getTitle(result) { - let { vspTestsMap } = this.props.softwareProductValidation; + let { flatTestsMap: vspTestsMap } = this.state; let title = vspTestsMap[result.testCaseName] - ? vspTestsMap[result.testCaseName].title + ? vspTestsMap[result.testCaseName].split(/\r?\n/)[0] : i18n('Unknown'); return i18n( 'Scenario: {scenario} | Title: {title} | Test Case: {testCaseName} | Status: {status}', @@ -90,19 +74,36 @@ class SoftwareProductValidationResultsView extends React.Component { ); } - renderJSON(result) { + renderJSON(result, indexKey) { + if (result.status === 'in-progress') { + return this.renderInprogress(i18n('Test is In-progress'), indexKey); + } else { + return ( +
  • +