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 configureStore from "./js/store/configure-store"
import hideLoader from "./js/loader"
import App from "./js/components/App"
import App from "./js/App"
const store = configureStore()

View file

@ -16,10 +16,10 @@
import React from "react"
import { Route, Switch, Redirect } from "react-router-dom"
import Browser from "../components/Browser"
import Login from "../components/Login"
import web from "../web"
import { minioBrowserPrefix } from "../constants"
import Browser from "./browser/Browser"
import Login from "./browser/Login"
import web from "./web"
import { minioBrowserPrefix } from "./constants"
const AuthorizedRoute = ({ component: Component, ...rest }) => (
<Route

View file

@ -16,7 +16,7 @@
import configureStore from "redux-mock-store"
import thunk from "redux-thunk"
import * as actionsAlert from "../alert"
import * as actionsAlert from "../actions"
const middlewares = [thunk]
const mockStore = configureStore(middlewares)

View file

@ -14,10 +14,10 @@
* limitations under the License.
*/
import reducer from "../alert"
import * as actionsAlert from "../../actions/alert"
import reducer from "../reducer"
import * as actionsAlert from "../actions"
describe("buckets reducer", () => {
describe("alert reducer", () => {
it("should return the initial state", () => {
expect(reducer(undefined, {})).toEqual({
show: false,

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
import * as actionsAlert from "../actions/alert"
import * as actionsAlert from "./actions"
const initialState = {
show: false,

View file

@ -15,7 +15,7 @@
*/
import React from "react"
import Path from "./Path"
import Path from "../objects/Path"
import StorageInfo from "./StorageInfo"
export const Header = () => (

View file

@ -18,8 +18,8 @@ import React from "react"
import { connect } from "react-redux"
import classNames from "classnames"
import logo from "../../img/logo.svg"
import Alert from "./Alert"
import * as actionsAlert from "../actions/alert"
import Alert from "../alert/Alert"
import * as actionsAlert from "../alert/actions"
import InputGroup from "../components/InputGroup"
import { minioBrowserPrefix } from "../constants"
import web from "../web"
@ -115,7 +115,8 @@ export class Login extends React.Component {
const mapDispatchToProps = dispatch => {
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())
}
}

View file

@ -17,7 +17,7 @@
import React from "react"
import MobileHeader from "./MobileHeader"
import Header from "./Header"
import ObjectsSection from "./ObjectsSection"
import ObjectsSection from "../objects/ObjectsSection"
export const MainContent = () => (
<div className="fe-body">

View file

@ -18,7 +18,7 @@ import React from "react"
import classNames from "classnames"
import { connect } from "react-redux"
import logo from "../../img/logo.svg"
import * as actionsCommon from "../actions/common"
import * as actionsCommon from "./actions"
export const MobileHeader = ({ sidebarOpen, toggleSidebar }) => (
<header className="fe-header-mobile hidden-lg hidden-md">
@ -47,7 +47,7 @@ export const MobileHeader = ({ sidebarOpen, toggleSidebar }) => (
const mapStateToProps = state => {
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 Dropdown from "react-bootstrap/lib/Dropdown"
import BucketSearch from "./BucketSearch"
import BucketList from "./BucketList"
import BucketSearch from "../buckets/BucketSearch"
import BucketList from "../buckets/BucketList"
import Host from "./Host"
import * as actionsCommon from "../actions/common"
import * as actionsCommon from "./actions"
export const SideBar = ({ sidebarOpen, clickOutside }) => {
return (
@ -51,7 +51,7 @@ export const SideBar = ({ sidebarOpen, clickOutside }) => {
const mapStateToProps = state => {
return {
sidebarOpen: state.common.sidebarOpen
sidebarOpen: state.browser.sidebarOpen
}
}

View file

@ -17,7 +17,7 @@
import React from "react"
import { connect } from "react-redux"
import humanize from "humanize"
import * as actionsCommon from "../actions/common"
import * as actionsCommon from "./actions"
export class StorageInfo extends React.Component {
componentWillMount() {
@ -51,7 +51,7 @@ export class StorageInfo extends React.Component {
const mapStateToProps = state => {
return {
storageInfo: state.common.storageInfo
storageInfo: state.browser.storageInfo
}
}

View file

@ -16,7 +16,7 @@
import configureStore from "redux-mock-store"
import thunk from "redux-thunk"
import * as actionsCommon from "../common"
import * as actionsCommon from "../actions"
jest.mock("../../web", () => ({
StorageInfo: jest.fn(() => {

View file

@ -14,8 +14,8 @@
* limitations under the License.
*/
import reducer from "../common"
import * as actionsCommon from "../../actions/common"
import reducer from "../reducer"
import * as actionsCommon from "../actions"
describe("common reducer", () => {
it("should return the initial state", () => {

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
import * as actionsCommon from "../actions/common"
import * as actionsCommon from "./actions"
export default (
state = { sidebarOpen: false, storageInfo: { total: 0, free: 0 } },

View file

@ -16,8 +16,8 @@
import React from "react"
import { connect } from "react-redux"
import * as actionsBuckets from "../actions/buckets"
import { getCurrentBucket } from "../selectors/buckets"
import * as actionsBuckets from "./actions"
import { getCurrentBucket } from "./selectors"
import Bucket from "./Bucket"
const mapStateToProps = (state, ownProps) => {

View file

@ -17,8 +17,8 @@
import React from "react"
import { connect } from "react-redux"
import { Scrollbars } from "react-custom-scrollbars"
import * as actionsBuckets from "../actions/buckets"
import { getVisibleBuckets } from "../selectors/buckets"
import * as actionsBuckets from "./actions"
import { getVisibleBuckets } from "./selectors"
import BucketContainer from "./BucketContainer"
export class BucketList extends React.Component {

View file

@ -16,7 +16,7 @@
import React from "react"
import { connect } from "react-redux"
import * as actionsBuckets from "../actions/buckets"
import * as actionsBuckets from "./actions"
export const BucketSearch = ({ onChange }) => (
<div

View file

@ -16,7 +16,7 @@
import configureStore from "redux-mock-store"
import thunk from "redux-thunk"
import * as actionsBuckets from "../buckets"
import * as actionsBuckets from "../actions"
jest.mock("../../web", () => ({
ListBuckets: jest.fn(() => {
@ -52,9 +52,7 @@ describe("Buckets actions", () => {
it("creates buckets/SET_FILTER directly", () => {
const store = mockStore()
const expectedActions = [
{ type: "buckets/SET_FILTER", filter: "test" }
]
const expectedActions = [{ type: "buckets/SET_FILTER", filter: "test" }]
store.dispatch(actionsBuckets.setFilter("test"))
const actions = store.getActions()
expect(actions).toEqual(expectedActions)

View file

@ -14,8 +14,8 @@
* limitations under the License.
*/
import reducer from "../buckets"
import * as actions from "../../actions/buckets"
import reducer from "../reducer"
import * as actions from "../actions"
describe("buckets reducer", () => {
it("should return the initial state", () => {

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
import { getVisibleBuckets, getCurrentBucket } from "../buckets"
import { getVisibleBuckets, getCurrentBucket } from "../selectors"
describe("getVisibleBuckets", () => {
let state

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
import * as actionsBuckets from "../actions/buckets"
import * as actionsBuckets from "./actions"
export default (
state = { list: [], filter: "", currentBucket: "" },

View file

@ -18,7 +18,7 @@ import React from "react"
import humanize from "humanize"
import Moment from "moment"
import ObjectItem from "./ObjectItem"
import * as actionsObjects from "../actions/objects"
import * as actionsObjects from "./actions"
export const ObjectContainer = ({ object }) => {
const actionButtons = []

View file

@ -17,7 +17,7 @@
import React from "react"
import classNames from "classnames"
import { connect } from "react-redux"
import * as actionsObjects from "../actions/objects"
import * as actionsObjects from "./actions"
export const ObjectsHeader = ({
sortNameOrder,

View file

@ -18,7 +18,7 @@ import React from "react"
import classNames from "classnames"
import { connect } from "react-redux"
import InfiniteScroll from "react-infinite-scroller"
import * as actionsObjects from "../actions/objects"
import * as actionsObjects from "./actions"
import ObjectsList from "./ObjectsList"
export class ObjectsListContainer extends React.Component {

View file

@ -16,8 +16,8 @@
import React from "react"
import { connect } from "react-redux"
import { getCurrentBucket, getCurrentPrefix } from "../selectors/buckets"
import * as actionsObjects from "../actions/objects"
import { getCurrentBucket } from "../buckets/selectors"
import * as actionsObjects from "./actions"
export const Path = ({ currentBucket, currentPrefix, selectPrefix }) => {
const onPrefixClick = (e, prefix) => {

View file

@ -17,7 +17,7 @@
import React from "react"
import { connect } from "react-redux"
import ObjectItem from "./ObjectItem"
import * as actionsObjects from "../actions/objects"
import * as actionsObjects from "./actions"
export const PrefixContainer = ({ object, currentPrefix, selectPrefix }) => {
const props = {

View file

@ -16,7 +16,7 @@
import configureStore from "redux-mock-store"
import thunk from "redux-thunk"
import * as actionsObjects from "../objects"
import * as actionsObjects from "../actions"
jest.mock("../../web", () => ({
ListObjects: jest.fn(() => {

View file

@ -14,8 +14,8 @@
* limitations under the License.
*/
import reducer from "../objects"
import * as actions from "../../actions/objects"
import reducer from "../reducer"
import * as actions from "../actions"
describe("objects reducer", () => {
it("should return the initial state", () => {

View file

@ -14,7 +14,7 @@
* limitations under the License.
*/
import * as actionsObjects from "../actions/objects"
import * as actionsObjects from "./actions"
export default (
state = {

View file

@ -15,13 +15,13 @@
*/
import { combineReducers } from "redux"
import common from "./common"
import alert from "./alert"
import buckets from "./buckets"
import objects from "./objects"
import browser from "./browser/reducer"
import alert from "./alert/reducer"
import buckets from "./buckets/reducer"
import objects from "./objects/reducer"
const rootReducer = combineReducers({
common,
browser,
alert,
buckets,
objects

View file

@ -16,7 +16,7 @@
import { createStore, applyMiddleware } from "redux"
import thunkMiddleware from "redux-thunk"
import reducers from "../reducers/index"
import reducers from "../reducers"
const createStoreWithMiddleware = applyMiddleware(thunkMiddleware)(createStore)