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 or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 import React from 'react';
17 import VendorItem from './VendorItem.jsx';
18 import CatalogList from '../CatalogList.jsx';
19 import CatalogItemDetails from '../CatalogItemDetails.jsx';
20 import { catalogItemTypes } from './OnboardingCatalogConstants.js';
21 import { filterCatalogItemsByType } from './OnboardingCatalogUtils.js';
27 licenseModelList = [],
28 vspOverlay: currentOverlay,
37 const showAddButtons = !isArchived;
38 const handeleSelectVSP = vsp => onSelectVSP(vsp, users);
39 const handleOnVspButtonClick = (hasVSP, vlm) =>
40 onVspOverlayChange(vlm.id === currentOverlay || !hasVSP ? null : vlm);
44 onAddVLM={showAddButtons ? onAddVLM : false}
45 onAddVSP={showAddButtons ? onAddVSP : false}>
46 {filterCatalogItemsByType({
47 items: licenseModelList,
48 filter: filter[activeTabName]
54 onSelectVSP={handeleSelectVSP}
55 shouldShowOverlay={currentOverlay === vlm.id}
56 onVSPButtonClick={handleOnVspButtonClick}
57 onVendorSelect={onVendorSelect}
66 const SoftwareProductListByVendor = ({
78 const handleAddVsp = !isArchived
79 ? () => onAddVSP(selectedVendor.id)
81 const handleOnSelect = () => onSelectVLM(selectedVendor, users);
85 onAddVSP={handleAddVsp}
88 onBack: () => onVendorSelect(false)
91 key={selectedVendor.id}
92 onSelect={handleOnSelect}
93 catalogItemTypeClass={catalogItemTypes.LICENSE_MODEL}
95 catalogItemData={selectedVendor}
97 {filterCatalogItemsByType({
98 items: selectedVendor.softwareProductList,
99 filter: filter[activeTabName]
103 catalogItemTypeClass={catalogItemTypes.SOFTWARE_PRODUCT}
104 onMigrate={onMigrate}
105 onSelect={() => onSelectVSP(vsp, users)}
106 catalogItemData={vsp}
114 class VendorCatalogView extends React.Component {
115 componentDidMount() {
116 const { onVendorSelect } = this.props;
117 onVendorSelect(false);
120 let { selectedVendor } = this.props;
121 return selectedVendor ? (
122 <SoftwareProductListByVendor {...this.props} />
124 <VendorList {...this.props} />
129 export default VendorCatalogView;