/** * Copyright (c) 2019 Vodafone Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import React from 'react'; import PropTypes from 'prop-types'; import { Accordion } from 'onap-ui-react'; 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'; class SoftwareProductValidationResultsView extends React.Component { static propTypes = { softwareProductValidation: PropTypes.object, refreshValidationResults: PropTypes.func }; constructor(props) { super(props); this.state = { vspId: this.props.softwareProductId, 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 { flatTestsMap: vspTestsMap } = this.state; let title = vspTestsMap[result.testCaseName] ? vspTestsMap[result.testCaseName].split(/\r?\n/)[0] : i18n('Unknown'); return i18n( 'Scenario: {scenario} | Title: {title} | Test Case: {testCaseName} | Status: {status}', { scenario: result.scenario || i18n('Unknown'), status: result.status || i18n('Unknown'), testCaseName: result.testCaseName || i18n('Unknown'), title: title } ); } renderJSON(result, indexKey) { if (result.status === 'in-progress') { return this.renderInprogress(i18n('Test is In-progress'), indexKey); } else { return (