Display errors from back end on Accounts page in crouton
[osm/UI.git] / skyquake / plugins / composer / src / src / components / CatalogPanelToolbar.js
1
2 /*
3 *
4 * Copyright 2016 RIFT.IO Inc
5 *
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
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
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.
17 *
18 */
19 'use strict';
20
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'
26
27 import '../styles/CatalogPanelToolbar.scss'
28
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'
35
36 const CatalogHeader = React.createClass({
37 mixins: [PureRenderMixin],
38 getInitialState() {
39 return {};
40 },
41 getDefaultProps() {
42 },
43 componentWillMount() {
44 },
45 componentDidMount() {
46 },
47 componentDidUpdate() {
48 },
49 componentWillUnmount() {
50 },
51 render() {
52 return (
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} />
60 </div>
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" />
67 </div>
68 </div>
69 <Button type="image" title="Copy catalog item" className="action-copy-catalog-item" onClick={this.onClickDuplicateCatalogItem} src={imgCopy} />
70 </div>
71 <div className="btn-group">
72 <Button type="image" title="Delete catalog item" className="action-delete-catalog-item" onClick = {this.onClickDeleteCatalogItem} src={imgDelete} />
73 </div>
74 </div>
75 </div>
76 );
77 },
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
83 },
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
89 },
90 onClickDeleteCatalogItem() {
91 CatalogItemsActions.deleteSelectedCatalogItem();
92 },
93 onClickCreateCatalogItem(type) {
94 CatalogItemsActions.createCatalogItem(type);
95 },
96 onClickDuplicateCatalogItem() {
97 CatalogItemsActions.duplicateSelectedCatalogItem();
98 },
99 onClickExportCatalogItems() {
100 CatalogPanelTrayActions.open();
101 CatalogItemsActions.exportSelectedCatalogItems();
102 }
103 });
104
105 export default CatalogHeader;