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, { Component } from 'react';
17 import i18n from 'nfvo-utils/i18n/i18n.js';
18 import { tabsMapping } from '../SoftwareProductAttachmentsConstants.js';
19 import SortableModuleFileList from './components/SortableModuleFileList';
20 import UnassignedFile from './components/UnassignedFile';
21 import UnassignedFileList from './components/UnassignedFileList';
22 import EmptyListContent from './components/EmptyListContent';
23 import ArtifactOrNestedFileList from './components/ArtifactOrNestedFileList';
25 const buildLabelValueObject = str =>
26 typeof str === 'string' ? { value: str, label: str } : str;
28 class SoftwareProductHeatSetupView extends Component {
29 processAndValidateHeat(heatData, heatDataCache) {
35 onProcessAndValidate({ heatData, heatDataCache, version }).then(() =>
36 changeAttachmentsTab(tabsMapping.VALIDATION)
52 const formattedUnassigned = unassigned.map(buildLabelValueObject);
53 const formattedArtifacts = artifacts.map(buildLabelValueObject);
56 className={`heat-setup-view ${
57 isReadOnlyMode ? 'disabled' : ''
59 <div className="heat-setup-view-modules-and-artifacts">
60 <SortableModuleFileList
62 isReadOnlyMode={this.props.isReadOnlyMode}
63 artifacts={formattedArtifacts}
64 unassigned={formattedUnassigned}
66 <ArtifactOrNestedFileList
68 title={i18n('ARTIFACTS')}
69 options={formattedUnassigned}
70 selected={formattedArtifacts}
71 onSelectChanged={onArtifactListChange}
72 isReadOnlyMode={this.props.isReadOnlyMode}
74 modules && modules.length > 0
78 onAddAllUnassigned={onAddAllUnassigned}
80 <ArtifactOrNestedFileList
82 title={i18n('NESTED HEAT FILES')}
84 isReadOnlyMode={this.props.isReadOnlyMode}
89 {formattedUnassigned.length > 0 ? (
91 {formattedUnassigned.map(file => (
99 <EmptyListContent heatDataExist={heatDataExist} />
101 </UnassignedFileList>
107 export default SoftwareProductHeatSetupView;