/**
* Copyright 2017 Red Hat Inc.
*
* 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 { connect } from 'react-redux';
import cx from 'classnames';
import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
import ImmutablePropTypes from 'react-immutable-proptypes';
import PropTypes from 'prop-types';
import React from 'react';
import { addActiveFilter } from '../../actions/FiltersActions';
import BlankSlate from '../ui/BlankSlate';
import { getCurrentPlanName } from '../../selectors/plans';
import { InlineLoader, Loader } from '../ui/Loader';
import ValidationsActions from '../../actions/ValidationsActions';
import ValidationsToolbar from './ValidationsToolbar';
import Validation from './Validation';
import ValidationDetail from './ValidationDetail';
import WorkflowExecutionsActions from '../../actions/WorkflowExecutionsActions';
import { getFilteredValidations } from '../../selectors/validations';
const messages = defineMessages({
loadingValidations: {
id: 'ValidationsList.loadingValidations',
defaultMessage: 'Loading Validations...'
},
noValidations: {
id: 'ValidationsList.noValidations',
defaultMessage: 'No Validations'
},
noValidationsMessage: {
id: 'ValidationsList.noValidationsMessage',
defaultMessage: 'There are no validations at this time.'
},
refresh: {
id: 'ValidationsList.refresh',
defaultMessage: 'Refresh'
},
validations: {
id: 'ValidationsList.validations',
defaultMessage: 'Validations'
}
});
class ValidationsList extends React.Component {
constructor() {
super();
this.state = {
showDetail: null
};
}
componentDidMount() {
this.props.fetchValidations();
}
refreshValidations() {
this.props.fetchValidations();
this.props.fetchWorkflowExecutions();
}
showValidationDetail(uuid) {
this.setState({ showDetail: uuid });
}
hideValidationDetail() {
this.setState({ showDetail: null });
}
rendervalidationDetail() {
if (this.state.showDetail) {
const validation = this.props.validations.get(this.state.showDetail);
return (