AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 1 | /*! |
| 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 Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 16 | import { connect } from 'react-redux'; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 17 | import SoftwareProductActionHelper from 'sdc-app/onboarding/softwareProduct/SoftwareProductActionHelper.js'; |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 18 | import { |
| 19 | mapStateToProps as attachmentsMapStateToProps, |
| 20 | mapActionsToProps as attachmentsMapActionsToProps |
| 21 | } from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachments.js'; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 22 | // import AttachmentsView from './AttachmentsView.jsx'; |
| 23 | import AttachmentsView from 'sdc-app/onboarding/softwareProduct/attachments/SoftwareProductAttachmentsView.jsx'; |
| 24 | import UploadScreenActionHelper from './UploadScreenActionHelper.js'; |
| 25 | import HeatSetup from './HeatSetup'; |
| 26 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 27 | export const mapStateToProps = state => { |
| 28 | let original = attachmentsMapStateToProps(state); |
| 29 | return { |
| 30 | ...original, |
| 31 | HeatSetupComponent: HeatSetup, |
| 32 | isReadOnlyMode: false |
| 33 | }; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 34 | }; |
| 35 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 36 | const 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 | }; |
AviZi | 280f801 | 2017-06-09 02:39:56 +0300 | [diff] [blame] | 61 | }; |
| 62 | |
Einav Weiss Keidar | 7fdf733 | 2018-03-20 14:45:40 +0200 | [diff] [blame] | 63 | export default connect(mapStateToProps, mapActionsToProps, null, { |
| 64 | withRef: true |
| 65 | })(AttachmentsView); |