8cc396f6fc2eaf1729de89d6ae7bd95bbdc3a0c6
[sdc.git] / openecomp-ui / src / sdc-app / onboarding / onboard / workspace / WorkspaceView.jsx
1 /*
2  * Copyright © 2016-2018 European Support Limited
3  *
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
7  * 
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  * 
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.
15  */
16 import React from 'react';
17 import DetailsCatalogView from '../DetailsCatalogView.jsx';
18 import i18n from 'nfvo-utils/i18n/i18n.js';
19 import { tabsMapping } from 'sdc-app/onboarding/onboard/OnboardConstants.js';
20
21 const WorkspaceView = props => {
22     let {
23         onAddLicenseModelClick,
24         users,
25         onAddSoftwareProductClick,
26         onSelectLicenseModel,
27         onSelectSoftwareProduct,
28         searchValue,
29         onMigrate,
30         filteredItems: { vspList, vlmList },
31         isArchived
32     } = props;
33     const handleSelectVSP = (item, users) =>
34         onSelectSoftwareProduct(item, users, tabsMapping.WORKSPACE);
35     const handleSelectVLM = (item, users) =>
36         onSelectLicenseModel(item, users, tabsMapping.WORKSPACE);
37     return (
38         <div className="catalog-wrapper workspace-view">
39             <div className="catalog-header workspace-header">
40                 {i18n('WORKSPACE')}
41             </div>
42             <DetailsCatalogView
43                 VLMList={vlmList}
44                 VSPList={vspList}
45                 users={users}
46                 onAddVLM={!isArchived ? onAddLicenseModelClick : undefined}
47                 onAddVSP={!isArchived ? onAddSoftwareProductClick : undefined}
48                 onSelectVLM={handleSelectVLM}
49                 onSelectVSP={handleSelectVSP}
50                 onMigrate={onMigrate}
51                 filter={searchValue}
52             />
53         </div>
54     );
55 };
56
57 export default WorkspaceView;