2017-01-23 18:07:22 -08:00
|
|
|
/*
|
2019-04-09 11:39:42 -07:00
|
|
|
* MinIO Cloud Storage (C) 2016, 2018 MinIO, Inc.
|
2017-01-23 18:07:22 -08:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2018-02-01 09:23:11 +05:30
|
|
|
import React from "react"
|
|
|
|
import classNames from "classnames"
|
2018-03-27 01:19:12 +05:30
|
|
|
import ClickOutHandler from "react-onclickout"
|
2018-02-01 09:23:11 +05:30
|
|
|
import { connect } from "react-redux"
|
2018-03-27 01:19:12 +05:30
|
|
|
|
2018-02-01 09:23:11 +05:30
|
|
|
import logo from "../../img/logo.svg"
|
2018-02-13 12:00:02 +05:30
|
|
|
import BucketSearch from "../buckets/BucketSearch"
|
|
|
|
import BucketList from "../buckets/BucketList"
|
2018-02-01 09:23:11 +05:30
|
|
|
import Host from "./Host"
|
2018-02-13 12:00:02 +05:30
|
|
|
import * as actionsCommon from "./actions"
|
2018-02-24 08:59:30 +05:30
|
|
|
import web from "../web"
|
2017-01-23 18:07:22 -08:00
|
|
|
|
2018-03-27 01:19:12 +05:30
|
|
|
export const SideBar = ({ sidebarOpen, clickOutside }) => {
|
2019-08-12 22:36:19 -07:00
|
|
|
const onClickOut = e => {
|
|
|
|
if (e.target.classList.contains("feh-trigger")) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
clickOutside()
|
|
|
|
}
|
2017-01-23 18:07:22 -08:00
|
|
|
return (
|
2019-08-12 22:36:19 -07:00
|
|
|
<ClickOutHandler onClickOut={onClickOut}>
|
2018-03-27 01:19:12 +05:30
|
|
|
<div
|
|
|
|
className={classNames({
|
|
|
|
"fe-sidebar": true,
|
|
|
|
toggled: sidebarOpen
|
|
|
|
})}
|
|
|
|
>
|
|
|
|
<div className="fes-header clearfix hidden-sm hidden-xs">
|
|
|
|
<img src={logo} alt="" />
|
2019-03-23 22:27:09 +05:30
|
|
|
<h2>MinIO Browser</h2>
|
2017-01-23 18:07:22 -08:00
|
|
|
</div>
|
2018-03-27 01:19:12 +05:30
|
|
|
<div className="fes-list">
|
2018-02-24 08:59:30 +05:30
|
|
|
{web.LoggedIn() && <BucketSearch />}
|
2018-02-01 09:23:11 +05:30
|
|
|
<BucketList />
|
2017-01-23 18:07:22 -08:00
|
|
|
</div>
|
2018-03-27 01:19:12 +05:30
|
|
|
<Host />
|
2017-01-23 18:07:22 -08:00
|
|
|
</div>
|
2018-03-27 01:19:12 +05:30
|
|
|
</ClickOutHandler>
|
2017-01-23 18:07:22 -08:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2018-02-10 08:04:14 +05:30
|
|
|
const mapStateToProps = state => {
|
|
|
|
return {
|
2018-03-23 00:55:56 +05:30
|
|
|
sidebarOpen: state.browser.sidebarOpen
|
2018-02-10 08:04:14 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const mapDispatchToProps = dispatch => {
|
|
|
|
return {
|
2018-03-27 01:19:12 +05:30
|
|
|
clickOutside: () => dispatch(actionsCommon.closeSidebar())
|
2018-02-10 08:04:14 +05:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-12 22:36:19 -07:00
|
|
|
export default connect(
|
|
|
|
mapStateToProps,
|
|
|
|
mapDispatchToProps
|
|
|
|
)(SideBar)
|