blob: 4532c0a7d2795644f7e8a39516240cfd1cd61a9a [file] [log] [blame]
AviZi280f8012017-06-09 02:39:56 +03001/*!
2 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
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
13 * or implied. See the License for the specific language governing
14 * permissions and limitations under the License.
15 */
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020016import { connect } from 'react-redux';
AviZi280f8012017-06-09 02:39:56 +030017import SoftwareProductActionHelper from 'sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js';
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020018import {
19 mapStateToProps as attachmentsMapStateToProps,
20 mapActionsToProps as attachmentsMapActionsToProps
21} from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js';
AviZi280f8012017-06-09 02:39:56 +030022// import AttachmentsView from './AttachmentsView.jsx';
23import AttachmentsView from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx';
24import UploadScreenActionHelper from './UploadScreenActionHelper.js';
25import HeatSetup from './HeatSetup';
26
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020027export const mapStateToProps = state => {
28 let original = attachmentsMapStateToProps(state);
29 return {
30 ...original,
31 HeatSetupComponent: HeatSetup,
32 isReadOnlyMode: false
33 };
AviZi280f8012017-06-09 02:39:56 +030034};
35
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020036const mapActionsToProps = (dispatch, { softwareProductId }) => {
37 let original = attachmentsMapActionsToProps(dispatch, {
38 softwareProductId
39 });
40 return {
41 ...original,
42 onDownload: heatCandidate =>
43 UploadScreenActionHelper.downloadHeatFile(dispatch, heatCandidate),
44 onUpload: formData =>
45 UploadScreenActionHelper.uploadFile(dispatch, formData),
46 onSave: heatCandidate =>
47 SoftwareProductActionHelper.updateSoftwareProductHeatCandidate(
48 dispatch,
49 {
50 softwareProductId,
51 heatCandidate
52 }
53 ),
54 onProcessAndValidate: (heatData, heatDataCache) =>
55 UploadScreenActionHelper.processAndValidateHeat(
56 dispatch,
57 heatData,
58 heatDataCache
59 )
60 };
AviZi280f8012017-06-09 02:39:56 +030061};
62
Einav Weiss Keidar7fdf7332018-03-20 14:45:40 +020063export default connect(mapStateToProps, mapActionsToProps, null, {
64 withRef: true
65})(AttachmentsView);