diff --git a/browser/app/index.js b/browser/app/index.js index 8162022c0..9f1e70d2f 100644 --- a/browser/app/index.js +++ b/browser/app/index.js @@ -21,10 +21,10 @@ import "material-design-iconic-font/dist/css/material-design-iconic-font.min.css import React from "react" import ReactDOM from "react-dom" -import { BrowserRouter, Route } from "react-router-dom" +import { Router, Route } from "react-router-dom" import { Provider } from "react-redux" -import { minioBrowserPrefix } from "./js/constants" +import history from "./js/history" import configureStore from "./js/store/configure-store" import hideLoader from "./js/loader" import App from "./js/App" @@ -33,9 +33,9 @@ const store = configureStore() ReactDOM.render( - - - + + + , document.getElementById("root") ) diff --git a/browser/app/js/App.js b/browser/app/js/App.js index eb833e400..5eeeaa734 100644 --- a/browser/app/js/App.js +++ b/browser/app/js/App.js @@ -34,13 +34,15 @@ const AuthorizedRoute = ({ component: Component, ...rest }) => ( /> ) -export const App = ({ match }) => ( - - - - - - -) +export const App = () => { + return ( + + + + + + + ) +} export default App diff --git a/browser/app/js/browser/Login.js b/browser/app/js/browser/Login.js index f2c003fea..f8ceceb64 100644 --- a/browser/app/js/browser/Login.js +++ b/browser/app/js/browser/Login.js @@ -21,7 +21,6 @@ import logo from "../../img/logo.svg" import Alert from "../alert/Alert" import * as actionsAlert from "../alert/actions" import InputGroup from "./InputGroup" -import { minioBrowserPrefix } from "../constants" import web from "../web" import { Redirect } from "react-router-dom" @@ -46,7 +45,7 @@ export class Login extends React.Component { password: document.getElementById("secretKey").value }) .then(res => { - history.push(minioBrowserPrefix) + history.push("/") }) .catch(e => { showAlert("danger", e.message) @@ -67,7 +66,7 @@ export class Login extends React.Component { render() { const { clearAlert, alert } = this.props if (web.LoggedIn()) { - return + return } let alertBox = // Make sure you don't show a fading out alert box on the initial web-page load. diff --git a/browser/app/js/browser/MainActions.js b/browser/app/js/browser/MainActions.js index 996a1339b..35c3da796 100644 --- a/browser/app/js/browser/MainActions.js +++ b/browser/app/js/browser/MainActions.js @@ -17,10 +17,16 @@ import React from "react" import { connect } from "react-redux" import { Dropdown, OverlayTrigger, Tooltip } from "react-bootstrap" +import web from "../web" import * as actionsBuckets from "../buckets/actions" import * as uploadsActions from "../uploads/actions" +import { getPrefixWritable } from "../objects/selectors" -export const MainActions = ({ uploadFile, showMakeBucketModal }) => { +export const MainActions = ({ + prefixWritable, + uploadFile, + showMakeBucketModal +}) => { const uploadTooltip = Upload file const makeBucketTooltip = ( Create bucket @@ -31,47 +37,59 @@ export const MainActions = ({ uploadFile, showMakeBucketModal }) => { e.target.value = null } - return ( - - - - - - - - - - - - - - - { - e.preventDefault() - showMakeBucketModal() - }} - > - - - - - - ) + const loggedIn = web.LoggedIn() + + if (loggedIn || prefixWritable) { + return ( + + + + + + + + + + + + + + {loggedIn && ( + + { + e.preventDefault() + showMakeBucketModal() + }} + > + + + + )} + + + ) + } else { + return