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:
Kanagaraj M 2018-02-13 12:00:02 +05:30 committed by Harshavardhana
parent ead6337eab
commit 9bfa07ecf5
61 changed files with 55 additions and 56 deletions

View file

@ -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()

View file

@ -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

View file

@ -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)

View file

@ -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,

View file

@ -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,

View file

@ -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 = () => (

View file

@ -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())
} }
} }

View file

@ -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">

View file

@ -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
} }
} }

View file

@ -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
} }
} }

View file

@ -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
} }
} }

View file

@ -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(() => {

View file

@ -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", () => {

View file

@ -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 } },

View file

@ -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) => {

View file

@ -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 {

View file

@ -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

View file

@ -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)

View file

@ -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", () => {

View file

@ -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

View file

@ -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: "" },

View file

@ -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 = []

View file

@ -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,

View file

@ -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 {

View file

@ -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) => {

View file

@ -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 = {

View file

@ -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(() => {

View file

@ -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", () => {

View file

@ -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 = {

View file

@ -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

View file

@ -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)