4 * Copyright 2016 RIFT.IO Inc
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
21 import React
from 'react'
22 import Button
from './Button'
23 import PureRenderMixin
from 'react-addons-pure-render-mixin'
24 import CatalogPanelTrayActions
from '../actions/CatalogPanelTrayActions'
25 import CatalogItemsActions
from '../actions/CatalogItemsActions'
27 import '../styles/CatalogPanelToolbar.scss'
29 import imgAdd
from '../../../node_modules/open-iconic/svg/plus.svg'
30 import imgCopy
from '../../../node_modules/open-iconic/svg/layers.svg'
31 import imgOnboard
from '../../../node_modules/open-iconic/svg/cloud-upload.svg'
32 import imgUpdate
from '../../../node_modules/open-iconic/svg/rain.svg'
33 import imgDownload
from '../../../node_modules/open-iconic/svg/cloud-download.svg'
34 import imgDelete
from '../../../node_modules/open-iconic/svg/trash.svg'
36 const CatalogHeader
= React
.createClass({
37 mixins
: [PureRenderMixin
],
43 componentWillMount() {
47 componentDidUpdate() {
49 componentWillUnmount() {
53 <div className
="CatalogPanelToolbar">
54 <h1
>Descriptor Catalogs
</h1
>
55 <div className
="btn-bar">
56 <div className
="btn-group">
57 <Button type
="image" title
="OnBoard a catalog package" className
="action-onboard-catalog-package" onClick
={this.onClickOnBoardCatalog
} src
={imgOnboard
} />
58 <Button type
="image" title
="Update a catalog package" className
="action-update-catalog-package" onClick
={this.onClickUpdateCatalog
} src
={imgUpdate
} />
59 <Button type
="image" title
="Export selected catalog item(s)" className
="action-export-catalog-items" onClick
={this.onClickExportCatalogItems
} src
={imgDownload
} />
61 <div className
="btn-group">
62 <div className
="menu">
63 <Button type
="image" title
="Create a new catalog item" className
="action-create-catalog-item" onClick
={this.onClickCreateCatalogItem
.bind(null, 'nsd')} src
={imgAdd
} />
64 <div className
="sub-menu">
65 <Button type
="image" title
="Create a new catalog item" className
="action-create-catalog-item" onClick
={this.onClickCreateCatalogItem
.bind(null, 'nsd')} src
={imgAdd
} label
="Add NSD" />
66 <Button type
="image" title
="Create a new catalog item" className
="action-create-catalog-item" onClick
={this.onClickCreateCatalogItem
.bind(null, 'vnfd')} src
={imgAdd
} label
="Add VNFD" />
69 <Button type
="image" title
="Copy catalog item" className
="action-copy-catalog-item" onClick
={this.onClickDuplicateCatalogItem
} src
={imgCopy
} />
71 <div className
="btn-group">
72 <Button type
="image" title
="Delete catalog item" className
="action-delete-catalog-item" onClick
= {this.onClickDeleteCatalogItem
} src
={imgDelete
} />
78 onClickUpdateCatalog() {
79 //CatalogPanelTrayActions.open();
80 // note CatalogPackageManagerUploadDropZone wired our btn
81 // click event to the DropZone.js configuration and will
82 // open the tray when/if files are added to the drop zone
84 onClickOnBoardCatalog() {
85 //CatalogPanelTrayActions.open();
86 // note CatalogPackageManagerUploadDropZone wired our btn
87 // click event to the DropZone.js configuration and will
88 // open the tray when/if files are added to the drop zone
90 onClickDeleteCatalogItem() {
91 CatalogItemsActions
.deleteSelectedCatalogItem();
93 onClickCreateCatalogItem(type
) {
94 CatalogItemsActions
.createCatalogItem(type
);
96 onClickDuplicateCatalogItem() {
97 CatalogPanelTrayActions
.open();
98 CatalogItemsActions
.duplicateSelectedCatalogItem();
100 onClickExportCatalogItems() {
101 CatalogPanelTrayActions
.open();
102 CatalogItemsActions
.exportSelectedCatalogItems();
106 export default CatalogHeader
;