2 * Copyright © 2016-2018 European Support Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13 * or implied. See the License for the specific language governing
14 * permissions and limitations under the License.
16 import isEqual from 'lodash/isEqual.js';
17 import React from 'react';
18 import PropTypes from 'prop-types';
19 import { catalogItemTypes } from './onboardingCatalog/OnboardingCatalogConstants.js';
20 import { filterCatalogItemsByType } from './onboardingCatalog/OnboardingCatalogUtils.js';
21 import CatalogList from './CatalogList.jsx';
22 import CatalogItemDetails from './CatalogItemDetails.jsx';
24 function renderCatalogItems({
33 const filteredValue = filter[activeTabName];
34 const filteredItems = items.length
35 ? filterCatalogItemsByType({ items, filter: filteredValue })
37 return filteredItems.map(item => (
40 catalogItemData={item}
41 catalogItemTypeClass={type}
43 onSelect={() => onSelect(item, users)}
48 class DetailsCatalogView extends React.Component {
50 VLMList: PropTypes.array,
51 VSPList: PropTypes.array,
52 onSelectVLM: PropTypes.func.isRequired,
53 onSelectVSP: PropTypes.func.isRequired,
54 onAddVLM: PropTypes.func,
55 onAddVSP: PropTypes.func,
56 filter: PropTypes.object.isRequired,
57 activeTabName: PropTypes.string
60 shouldComponentUpdate(nextProps) {
62 isEqual(nextProps.VLMList, this.props.VLMList) &&
63 isEqual(nextProps.VSPList, this.props.VSPList) &&
64 isEqual(nextProps.users, this.props.users) &&
65 isEqual(nextProps.filter, this.props.filter);
82 <CatalogList onAddVLM={onAddVLM} onAddVSP={onAddVSP}>
85 type: catalogItemTypes.LICENSE_MODEL,
87 onSelect: onSelectVLM,
94 type: catalogItemTypes.SOFTWARE_PRODUCT,
96 onSelect: onSelectVSP,
105 export default DetailsCatalogView;