2 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
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 React from 'react';
17 import PropTypes from 'prop-types';
18 import i18n from 'nfvo-utils/i18n/i18n.js';
19 import {catalogItemTypes, migrationStatusMapper} from './onboardingCatalog/OnboardingCatalogConstants.js';
20 import {Tile, TileInfo, TileInfoLine} from 'sdc-ui/lib/react';
21 import {TooltipWrapper} from './onboardingCatalog/Tooltip.jsx';
23 const ITEM_TYPE_MAP = {
24 [catalogItemTypes.LICENSE_MODEL]: {
25 headerText: i18n('VLM'),
26 contentIconName: 'vlm',
29 [catalogItemTypes.SOFTWARE_PRODUCT]: {
30 headerText: i18n('VSP'),
31 contentIconName: 'vsp',
36 const CatalogItemDetails = ({catalogItemData, catalogItemTypeClass, onSelect, onMigrate}) => {
38 let {vendorName, name} = catalogItemData;
39 let {headerText, color, contentIconName} = ITEM_TYPE_MAP[catalogItemTypeClass];
41 let onClick = (e) => {
44 if (catalogItemData.isOldVersion && catalogItemData.isOldVersion === migrationStatusMapper.OLD_VERSION) {
45 onMigrate({softwareProduct: catalogItemData});
53 headerText={headerText}
55 iconName={contentIconName}
58 dataTestId={catalogItemTypeClass}>
59 <TileInfo data-test-id='catalog-item-content'>
61 <TileInfoLine type='supertitle'>
62 <TooltipWrapper className='with-overlay' tooltipClassName='tile-super-info' dataTestId='catalog-item-vendor-name'>{vendorName}</TooltipWrapper>
65 <TileInfoLine type='title'>
66 <TooltipWrapper className='with-overlay' tooltipClassName='tile-title-info' dataTestId='catalog-item-name'>{name}</TooltipWrapper>
74 CatalogItemDetails.PropTypes = {
75 catalogItemData: PropTypes.obj,
76 catalogItemTypeClass: PropTypes.string,
77 onSelect: PropTypes.func,
78 onMigrate: PropTypes.func
81 export default CatalogItemDetails;