mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -05:00
re-organize components and actions by feature (#5518)
Now the files grouped based on the features instead of the previous approach of grouping by type.
This commit is contained in:
parent
ead6337eab
commit
9bfa07ecf5
@ -27,7 +27,7 @@ import { Provider } from "react-redux"
|
|||||||
import { minioBrowserPrefix } from "./js/constants"
|
import { minioBrowserPrefix } from "./js/constants"
|
||||||
import configureStore from "./js/store/configure-store"
|
import configureStore from "./js/store/configure-store"
|
||||||
import hideLoader from "./js/loader"
|
import hideLoader from "./js/loader"
|
||||||
import App from "./js/components/App"
|
import App from "./js/App"
|
||||||
|
|
||||||
const store = configureStore()
|
const store = configureStore()
|
||||||
|
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import { Route, Switch, Redirect } from "react-router-dom"
|
import { Route, Switch, Redirect } from "react-router-dom"
|
||||||
import Browser from "../components/Browser"
|
import Browser from "./browser/Browser"
|
||||||
import Login from "../components/Login"
|
import Login from "./browser/Login"
|
||||||
import web from "../web"
|
import web from "./web"
|
||||||
import { minioBrowserPrefix } from "../constants"
|
import { minioBrowserPrefix } from "./constants"
|
||||||
|
|
||||||
const AuthorizedRoute = ({ component: Component, ...rest }) => (
|
const AuthorizedRoute = ({ component: Component, ...rest }) => (
|
||||||
<Route
|
<Route
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
import configureStore from "redux-mock-store"
|
import configureStore from "redux-mock-store"
|
||||||
import thunk from "redux-thunk"
|
import thunk from "redux-thunk"
|
||||||
import * as actionsAlert from "../alert"
|
import * as actionsAlert from "../actions"
|
||||||
|
|
||||||
const middlewares = [thunk]
|
const middlewares = [thunk]
|
||||||
const mockStore = configureStore(middlewares)
|
const mockStore = configureStore(middlewares)
|
@ -14,10 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import reducer from "../alert"
|
import reducer from "../reducer"
|
||||||
import * as actionsAlert from "../../actions/alert"
|
import * as actionsAlert from "../actions"
|
||||||
|
|
||||||
describe("buckets reducer", () => {
|
describe("alert reducer", () => {
|
||||||
it("should return the initial state", () => {
|
it("should return the initial state", () => {
|
||||||
expect(reducer(undefined, {})).toEqual({
|
expect(reducer(undefined, {})).toEqual({
|
||||||
show: false,
|
show: false,
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as actionsAlert from "../actions/alert"
|
import * as actionsAlert from "./actions"
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
show: false,
|
show: false,
|
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import Path from "./Path"
|
import Path from "../objects/Path"
|
||||||
import StorageInfo from "./StorageInfo"
|
import StorageInfo from "./StorageInfo"
|
||||||
|
|
||||||
export const Header = () => (
|
export const Header = () => (
|
@ -18,8 +18,8 @@ import React from "react"
|
|||||||
import { connect } from "react-redux"
|
import { connect } from "react-redux"
|
||||||
import classNames from "classnames"
|
import classNames from "classnames"
|
||||||
import logo from "../../img/logo.svg"
|
import logo from "../../img/logo.svg"
|
||||||
import Alert from "./Alert"
|
import Alert from "../alert/Alert"
|
||||||
import * as actionsAlert from "../actions/alert"
|
import * as actionsAlert from "../alert/actions"
|
||||||
import InputGroup from "../components/InputGroup"
|
import InputGroup from "../components/InputGroup"
|
||||||
import { minioBrowserPrefix } from "../constants"
|
import { minioBrowserPrefix } from "../constants"
|
||||||
import web from "../web"
|
import web from "../web"
|
||||||
@ -115,7 +115,8 @@ export class Login extends React.Component {
|
|||||||
|
|
||||||
const mapDispatchToProps = dispatch => {
|
const mapDispatchToProps = dispatch => {
|
||||||
return {
|
return {
|
||||||
showAlert: (type, message) => dispatch(actionsAlert.set({type: type, message: message})),
|
showAlert: (type, message) =>
|
||||||
|
dispatch(actionsAlert.set({ type: type, message: message })),
|
||||||
clearAlert: () => dispatch(actionsAlert.clear())
|
clearAlert: () => dispatch(actionsAlert.clear())
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,7 +17,7 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import MobileHeader from "./MobileHeader"
|
import MobileHeader from "./MobileHeader"
|
||||||
import Header from "./Header"
|
import Header from "./Header"
|
||||||
import ObjectsSection from "./ObjectsSection"
|
import ObjectsSection from "../objects/ObjectsSection"
|
||||||
|
|
||||||
export const MainContent = () => (
|
export const MainContent = () => (
|
||||||
<div className="fe-body">
|
<div className="fe-body">
|
@ -18,7 +18,7 @@ import React from "react"
|
|||||||
import classNames from "classnames"
|
import classNames from "classnames"
|
||||||
import { connect } from "react-redux"
|
import { connect } from "react-redux"
|
||||||
import logo from "../../img/logo.svg"
|
import logo from "../../img/logo.svg"
|
||||||
import * as actionsCommon from "../actions/common"
|
import * as actionsCommon from "./actions"
|
||||||
|
|
||||||
export const MobileHeader = ({ sidebarOpen, toggleSidebar }) => (
|
export const MobileHeader = ({ sidebarOpen, toggleSidebar }) => (
|
||||||
<header className="fe-header-mobile hidden-lg hidden-md">
|
<header className="fe-header-mobile hidden-lg hidden-md">
|
||||||
@ -47,7 +47,7 @@ export const MobileHeader = ({ sidebarOpen, toggleSidebar }) => (
|
|||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
return {
|
return {
|
||||||
sidebarOpen: state.common.sidebarOpen
|
sidebarOpen: state.browser.sidebarOpen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -21,10 +21,10 @@ import { connect } from "react-redux"
|
|||||||
|
|
||||||
import logo from "../../img/logo.svg"
|
import logo from "../../img/logo.svg"
|
||||||
import Dropdown from "react-bootstrap/lib/Dropdown"
|
import Dropdown from "react-bootstrap/lib/Dropdown"
|
||||||
import BucketSearch from "./BucketSearch"
|
import BucketSearch from "../buckets/BucketSearch"
|
||||||
import BucketList from "./BucketList"
|
import BucketList from "../buckets/BucketList"
|
||||||
import Host from "./Host"
|
import Host from "./Host"
|
||||||
import * as actionsCommon from "../actions/common"
|
import * as actionsCommon from "./actions"
|
||||||
|
|
||||||
export const SideBar = ({ sidebarOpen, clickOutside }) => {
|
export const SideBar = ({ sidebarOpen, clickOutside }) => {
|
||||||
return (
|
return (
|
||||||
@ -51,7 +51,7 @@ export const SideBar = ({ sidebarOpen, clickOutside }) => {
|
|||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
return {
|
return {
|
||||||
sidebarOpen: state.common.sidebarOpen
|
sidebarOpen: state.browser.sidebarOpen
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -17,7 +17,7 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import { connect } from "react-redux"
|
import { connect } from "react-redux"
|
||||||
import humanize from "humanize"
|
import humanize from "humanize"
|
||||||
import * as actionsCommon from "../actions/common"
|
import * as actionsCommon from "./actions"
|
||||||
|
|
||||||
export class StorageInfo extends React.Component {
|
export class StorageInfo extends React.Component {
|
||||||
componentWillMount() {
|
componentWillMount() {
|
||||||
@ -51,7 +51,7 @@ export class StorageInfo extends React.Component {
|
|||||||
|
|
||||||
const mapStateToProps = state => {
|
const mapStateToProps = state => {
|
||||||
return {
|
return {
|
||||||
storageInfo: state.common.storageInfo
|
storageInfo: state.browser.storageInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
import configureStore from "redux-mock-store"
|
import configureStore from "redux-mock-store"
|
||||||
import thunk from "redux-thunk"
|
import thunk from "redux-thunk"
|
||||||
import * as actionsCommon from "../common"
|
import * as actionsCommon from "../actions"
|
||||||
|
|
||||||
jest.mock("../../web", () => ({
|
jest.mock("../../web", () => ({
|
||||||
StorageInfo: jest.fn(() => {
|
StorageInfo: jest.fn(() => {
|
@ -14,8 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import reducer from "../common"
|
import reducer from "../reducer"
|
||||||
import * as actionsCommon from "../../actions/common"
|
import * as actionsCommon from "../actions"
|
||||||
|
|
||||||
describe("common reducer", () => {
|
describe("common reducer", () => {
|
||||||
it("should return the initial state", () => {
|
it("should return the initial state", () => {
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as actionsCommon from "../actions/common"
|
import * as actionsCommon from "./actions"
|
||||||
|
|
||||||
export default (
|
export default (
|
||||||
state = { sidebarOpen: false, storageInfo: { total: 0, free: 0 } },
|
state = { sidebarOpen: false, storageInfo: { total: 0, free: 0 } },
|
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import { connect } from "react-redux"
|
import { connect } from "react-redux"
|
||||||
import * as actionsBuckets from "../actions/buckets"
|
import * as actionsBuckets from "./actions"
|
||||||
import { getCurrentBucket } from "../selectors/buckets"
|
import { getCurrentBucket } from "./selectors"
|
||||||
import Bucket from "./Bucket"
|
import Bucket from "./Bucket"
|
||||||
|
|
||||||
const mapStateToProps = (state, ownProps) => {
|
const mapStateToProps = (state, ownProps) => {
|
@ -17,8 +17,8 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import { connect } from "react-redux"
|
import { connect } from "react-redux"
|
||||||
import { Scrollbars } from "react-custom-scrollbars"
|
import { Scrollbars } from "react-custom-scrollbars"
|
||||||
import * as actionsBuckets from "../actions/buckets"
|
import * as actionsBuckets from "./actions"
|
||||||
import { getVisibleBuckets } from "../selectors/buckets"
|
import { getVisibleBuckets } from "./selectors"
|
||||||
import BucketContainer from "./BucketContainer"
|
import BucketContainer from "./BucketContainer"
|
||||||
|
|
||||||
export class BucketList extends React.Component {
|
export class BucketList extends React.Component {
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import { connect } from "react-redux"
|
import { connect } from "react-redux"
|
||||||
import * as actionsBuckets from "../actions/buckets"
|
import * as actionsBuckets from "./actions"
|
||||||
|
|
||||||
export const BucketSearch = ({ onChange }) => (
|
export const BucketSearch = ({ onChange }) => (
|
||||||
<div
|
<div
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
import configureStore from "redux-mock-store"
|
import configureStore from "redux-mock-store"
|
||||||
import thunk from "redux-thunk"
|
import thunk from "redux-thunk"
|
||||||
import * as actionsBuckets from "../buckets"
|
import * as actionsBuckets from "../actions"
|
||||||
|
|
||||||
jest.mock("../../web", () => ({
|
jest.mock("../../web", () => ({
|
||||||
ListBuckets: jest.fn(() => {
|
ListBuckets: jest.fn(() => {
|
||||||
@ -52,9 +52,7 @@ describe("Buckets actions", () => {
|
|||||||
|
|
||||||
it("creates buckets/SET_FILTER directly", () => {
|
it("creates buckets/SET_FILTER directly", () => {
|
||||||
const store = mockStore()
|
const store = mockStore()
|
||||||
const expectedActions = [
|
const expectedActions = [{ type: "buckets/SET_FILTER", filter: "test" }]
|
||||||
{ type: "buckets/SET_FILTER", filter: "test" }
|
|
||||||
]
|
|
||||||
store.dispatch(actionsBuckets.setFilter("test"))
|
store.dispatch(actionsBuckets.setFilter("test"))
|
||||||
const actions = store.getActions()
|
const actions = store.getActions()
|
||||||
expect(actions).toEqual(expectedActions)
|
expect(actions).toEqual(expectedActions)
|
@ -14,8 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import reducer from "../buckets"
|
import reducer from "../reducer"
|
||||||
import * as actions from "../../actions/buckets"
|
import * as actions from "../actions"
|
||||||
|
|
||||||
describe("buckets reducer", () => {
|
describe("buckets reducer", () => {
|
||||||
it("should return the initial state", () => {
|
it("should return the initial state", () => {
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { getVisibleBuckets, getCurrentBucket } from "../buckets"
|
import { getVisibleBuckets, getCurrentBucket } from "../selectors"
|
||||||
|
|
||||||
describe("getVisibleBuckets", () => {
|
describe("getVisibleBuckets", () => {
|
||||||
let state
|
let state
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as actionsBuckets from "../actions/buckets"
|
import * as actionsBuckets from "./actions"
|
||||||
|
|
||||||
export default (
|
export default (
|
||||||
state = { list: [], filter: "", currentBucket: "" },
|
state = { list: [], filter: "", currentBucket: "" },
|
@ -18,7 +18,7 @@ import React from "react"
|
|||||||
import humanize from "humanize"
|
import humanize from "humanize"
|
||||||
import Moment from "moment"
|
import Moment from "moment"
|
||||||
import ObjectItem from "./ObjectItem"
|
import ObjectItem from "./ObjectItem"
|
||||||
import * as actionsObjects from "../actions/objects"
|
import * as actionsObjects from "./actions"
|
||||||
|
|
||||||
export const ObjectContainer = ({ object }) => {
|
export const ObjectContainer = ({ object }) => {
|
||||||
const actionButtons = []
|
const actionButtons = []
|
@ -17,7 +17,7 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import classNames from "classnames"
|
import classNames from "classnames"
|
||||||
import { connect } from "react-redux"
|
import { connect } from "react-redux"
|
||||||
import * as actionsObjects from "../actions/objects"
|
import * as actionsObjects from "./actions"
|
||||||
|
|
||||||
export const ObjectsHeader = ({
|
export const ObjectsHeader = ({
|
||||||
sortNameOrder,
|
sortNameOrder,
|
@ -18,7 +18,7 @@ import React from "react"
|
|||||||
import classNames from "classnames"
|
import classNames from "classnames"
|
||||||
import { connect } from "react-redux"
|
import { connect } from "react-redux"
|
||||||
import InfiniteScroll from "react-infinite-scroller"
|
import InfiniteScroll from "react-infinite-scroller"
|
||||||
import * as actionsObjects from "../actions/objects"
|
import * as actionsObjects from "./actions"
|
||||||
import ObjectsList from "./ObjectsList"
|
import ObjectsList from "./ObjectsList"
|
||||||
|
|
||||||
export class ObjectsListContainer extends React.Component {
|
export class ObjectsListContainer extends React.Component {
|
@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
import React from "react"
|
import React from "react"
|
||||||
import { connect } from "react-redux"
|
import { connect } from "react-redux"
|
||||||
import { getCurrentBucket, getCurrentPrefix } from "../selectors/buckets"
|
import { getCurrentBucket } from "../buckets/selectors"
|
||||||
import * as actionsObjects from "../actions/objects"
|
import * as actionsObjects from "./actions"
|
||||||
|
|
||||||
export const Path = ({ currentBucket, currentPrefix, selectPrefix }) => {
|
export const Path = ({ currentBucket, currentPrefix, selectPrefix }) => {
|
||||||
const onPrefixClick = (e, prefix) => {
|
const onPrefixClick = (e, prefix) => {
|
@ -17,7 +17,7 @@
|
|||||||
import React from "react"
|
import React from "react"
|
||||||
import { connect } from "react-redux"
|
import { connect } from "react-redux"
|
||||||
import ObjectItem from "./ObjectItem"
|
import ObjectItem from "./ObjectItem"
|
||||||
import * as actionsObjects from "../actions/objects"
|
import * as actionsObjects from "./actions"
|
||||||
|
|
||||||
export const PrefixContainer = ({ object, currentPrefix, selectPrefix }) => {
|
export const PrefixContainer = ({ object, currentPrefix, selectPrefix }) => {
|
||||||
const props = {
|
const props = {
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
import configureStore from "redux-mock-store"
|
import configureStore from "redux-mock-store"
|
||||||
import thunk from "redux-thunk"
|
import thunk from "redux-thunk"
|
||||||
import * as actionsObjects from "../objects"
|
import * as actionsObjects from "../actions"
|
||||||
|
|
||||||
jest.mock("../../web", () => ({
|
jest.mock("../../web", () => ({
|
||||||
ListObjects: jest.fn(() => {
|
ListObjects: jest.fn(() => {
|
@ -14,8 +14,8 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import reducer from "../objects"
|
import reducer from "../reducer"
|
||||||
import * as actions from "../../actions/objects"
|
import * as actions from "../actions"
|
||||||
|
|
||||||
describe("objects reducer", () => {
|
describe("objects reducer", () => {
|
||||||
it("should return the initial state", () => {
|
it("should return the initial state", () => {
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import * as actionsObjects from "../actions/objects"
|
import * as actionsObjects from "./actions"
|
||||||
|
|
||||||
export default (
|
export default (
|
||||||
state = {
|
state = {
|
@ -15,13 +15,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { combineReducers } from "redux"
|
import { combineReducers } from "redux"
|
||||||
import common from "./common"
|
import browser from "./browser/reducer"
|
||||||
import alert from "./alert"
|
import alert from "./alert/reducer"
|
||||||
import buckets from "./buckets"
|
import buckets from "./buckets/reducer"
|
||||||
import objects from "./objects"
|
import objects from "./objects/reducer"
|
||||||
|
|
||||||
const rootReducer = combineReducers({
|
const rootReducer = combineReducers({
|
||||||
common,
|
browser,
|
||||||
alert,
|
alert,
|
||||||
buckets,
|
buckets,
|
||||||
objects
|
objects
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
import { createStore, applyMiddleware } from "redux"
|
import { createStore, applyMiddleware } from "redux"
|
||||||
import thunkMiddleware from "redux-thunk"
|
import thunkMiddleware from "redux-thunk"
|
||||||
import reducers from "../reducers/index"
|
import reducers from "../reducers"
|
||||||
|
|
||||||
const createStoreWithMiddleware = applyMiddleware(thunkMiddleware)(createStore)
|
const createStoreWithMiddleware = applyMiddleware(thunkMiddleware)(createStore)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user