From ed1cce38b6b537ceb172d9365915f0e8ee42445b Mon Sep 17 00:00:00 2001 From: sveisvei Date: Mon, 24 Oct 2016 21:00:20 +0200 Subject: [PATCH] rename files to lowercase and dashes --- .../src/{App.jsx => component/app.jsx} | 4 +- ...dFeatureToggleUI.jsx => add-component.jsx} | 12 +++--- ...AddFeatureToggle.jsx => add-container.jsx} | 2 +- ...itFeatureToggle.jsx => edit-container.jsx} | 4 +- .../{Feature.jsx => feature-component.jsx} | 0 .../{FeatureList.jsx => list-component.jsx} | 8 ++-- ...reListContainer.jsx => list-container.jsx} | 4 +- ...gureStrategy.jsx => select-strategies.jsx} | 4 +- ...Strategies.jsx => selected-strategies.jsx} | 8 ++-- ...Strategy.jsx => strategies-for-toggle.jsx} | 8 ++-- .../src/{Navigation.jsx => component/nav.jsx} | 2 +- .../src/component/strategies/add-container.js | 40 ++++++++++++++++++ .../src/component/strategies/add-strategy.jsx | 41 ++----------------- .../{list.jsx => list-component.jsx} | 0 .../{index.jsx => list-container.jsx} | 2 +- .../src/{style.scss => component/styles.scss} | 0 packages/unleash-frontend-next/src/index.jsx | 2 +- .../src/page/features/create.js | 2 +- .../src/page/features/edit.js | 2 +- .../src/page/features/index.js | 2 +- .../src/page/strategies/create.js | 2 +- .../src/page/strategies/index.js | 2 +- 22 files changed, 78 insertions(+), 73 deletions(-) rename packages/unleash-frontend-next/src/{App.jsx => component/app.jsx} (94%) rename packages/unleash-frontend-next/src/component/feature/{AddFeatureToggleUI.jsx => add-component.jsx} (88%) rename packages/unleash-frontend-next/src/component/feature/{AddFeatureToggle.jsx => add-container.jsx} (97%) rename packages/unleash-frontend-next/src/component/feature/{EditFeatureToggle.jsx => edit-container.jsx} (96%) rename packages/unleash-frontend-next/src/component/feature/{Feature.jsx => feature-component.jsx} (100%) rename packages/unleash-frontend-next/src/component/feature/{FeatureList.jsx => list-component.jsx} (78%) rename packages/unleash-frontend-next/src/component/feature/{FeatureListContainer.jsx => list-container.jsx} (85%) rename packages/unleash-frontend-next/src/component/feature/{ConfigureStrategy.jsx => select-strategies.jsx} (96%) rename packages/unleash-frontend-next/src/component/feature/{ConfiguredStrategies.jsx => selected-strategies.jsx} (89%) rename packages/unleash-frontend-next/src/component/feature/{AddFeatureToggleStrategy.jsx => strategies-for-toggle.jsx} (85%) rename packages/unleash-frontend-next/src/{Navigation.jsx => component/nav.jsx} (97%) create mode 100644 packages/unleash-frontend-next/src/component/strategies/add-container.js rename packages/unleash-frontend-next/src/component/strategies/{list.jsx => list-component.jsx} (100%) rename packages/unleash-frontend-next/src/component/strategies/{index.jsx => list-container.jsx} (92%) rename packages/unleash-frontend-next/src/{style.scss => component/styles.scss} (100%) diff --git a/packages/unleash-frontend-next/src/App.jsx b/packages/unleash-frontend-next/src/component/app.jsx similarity index 94% rename from packages/unleash-frontend-next/src/App.jsx rename to packages/unleash-frontend-next/src/component/app.jsx index a44938c947..1b199f5182 100644 --- a/packages/unleash-frontend-next/src/App.jsx +++ b/packages/unleash-frontend-next/src/component/app.jsx @@ -1,8 +1,8 @@ import React, { Component } from 'react'; import { Layout, Panel, NavDrawer, AppBar } from 'react-toolbox'; -import style from './style'; +import style from './styles.scss'; -import Navigation from './Navigation'; +import Navigation from './nav'; export default class App extends Component { constructor (props) { diff --git a/packages/unleash-frontend-next/src/component/feature/AddFeatureToggleUI.jsx b/packages/unleash-frontend-next/src/component/feature/add-component.jsx similarity index 88% rename from packages/unleash-frontend-next/src/component/feature/AddFeatureToggleUI.jsx rename to packages/unleash-frontend-next/src/component/feature/add-component.jsx index 1aff600bd3..58ec139294 100644 --- a/packages/unleash-frontend-next/src/component/feature/AddFeatureToggleUI.jsx +++ b/packages/unleash-frontend-next/src/component/feature/add-component.jsx @@ -1,9 +1,9 @@ import React, { PropTypes } from 'react'; import { Input, Switch, Button } from 'react-toolbox'; -import AddFeatureToggleStrategy from './AddFeatureToggleStrategy'; -import ConfiguredStrategies from './ConfiguredStrategies'; +import AddFeatureToggleStrategy from './strategies-for-toggle'; +import SelectedStrategies from './selected-strategies'; -const AddFeatureToggleUI = ({ +const AddFeatureToggleComponent = ({ strategies, featureToggle, updateField, @@ -50,7 +50,7 @@ const AddFeatureToggleUI = ({
Activation strategies -
@@ -69,7 +69,7 @@ const AddFeatureToggleUI = ({ ); }; -AddFeatureToggleUI.propTypes = { +AddFeatureToggleComponent.propTypes = { strategies: PropTypes.array.required, featureToggle: PropTypes.object, updateField: PropTypes.func.required, @@ -80,4 +80,4 @@ AddFeatureToggleUI.propTypes = { editmode: PropTypes.bool, }; -export default AddFeatureToggleUI; +export default AddFeatureToggleComponent; diff --git a/packages/unleash-frontend-next/src/component/feature/AddFeatureToggle.jsx b/packages/unleash-frontend-next/src/component/feature/add-container.jsx similarity index 97% rename from packages/unleash-frontend-next/src/component/feature/AddFeatureToggle.jsx rename to packages/unleash-frontend-next/src/component/feature/add-container.jsx index cc798e02ec..015c66f60b 100644 --- a/packages/unleash-frontend-next/src/component/feature/AddFeatureToggle.jsx +++ b/packages/unleash-frontend-next/src/component/feature/add-container.jsx @@ -1,8 +1,8 @@ import React, { PropTypes } from 'react'; import { connect } from 'react-redux'; import { createFeatureToggles } from '../../store/feature-actions'; -import AddFeatureToggleUI from './AddFeatureToggleUI'; import { fetchStrategies } from '../../store/strategy-actions'; +import AddFeatureToggleUI from './add-component'; class AddFeatureToggle extends React.Component { constructor () { diff --git a/packages/unleash-frontend-next/src/component/feature/EditFeatureToggle.jsx b/packages/unleash-frontend-next/src/component/feature/edit-container.jsx similarity index 96% rename from packages/unleash-frontend-next/src/component/feature/EditFeatureToggle.jsx rename to packages/unleash-frontend-next/src/component/feature/edit-container.jsx index a96693670f..0fed095c7f 100644 --- a/packages/unleash-frontend-next/src/component/feature/EditFeatureToggle.jsx +++ b/packages/unleash-frontend-next/src/component/feature/edit-container.jsx @@ -1,7 +1,7 @@ import React, { PropTypes } from 'react'; import { connect } from 'react-redux'; import { editFeatureToggle } from '../../store/feature-actions'; -import AddFeatureToggleUI from './AddFeatureToggleUI'; +import AddFeatureToggleComponent from './add-component'; import { fetchStrategies } from '../../store/strategy-actions'; @@ -69,7 +69,7 @@ class EditFeatureToggle extends React.Component { render () { return ( - - {features.map(feature => - + {features.map((feature, i) => + )} ({ features: state.features.toJS(), @@ -15,6 +15,6 @@ const mapDispatchToProps = { const FeatureListContainer = connect( mapStateToProps, mapDispatchToProps -)(FeatureList); +)(FeatureListComponent); export default FeatureListContainer; diff --git a/packages/unleash-frontend-next/src/component/feature/ConfigureStrategy.jsx b/packages/unleash-frontend-next/src/component/feature/select-strategies.jsx similarity index 96% rename from packages/unleash-frontend-next/src/component/feature/ConfigureStrategy.jsx rename to packages/unleash-frontend-next/src/component/feature/select-strategies.jsx index ea142c95e9..bd1a9ceab7 100644 --- a/packages/unleash-frontend-next/src/component/feature/ConfigureStrategy.jsx +++ b/packages/unleash-frontend-next/src/component/feature/select-strategies.jsx @@ -1,7 +1,7 @@ import React, { PropTypes } from 'react'; import { Button, Input } from 'react-toolbox'; -class ConfigureStrategy extends React.Component { +class SelectStrategies extends React.Component { constructor (props) { super(props); this.state = { @@ -82,4 +82,4 @@ class ConfigureStrategy extends React.Component { } } -export default ConfigureStrategy; +export default SelectStrategies; diff --git a/packages/unleash-frontend-next/src/component/feature/ConfiguredStrategies.jsx b/packages/unleash-frontend-next/src/component/feature/selected-strategies.jsx similarity index 89% rename from packages/unleash-frontend-next/src/component/feature/ConfiguredStrategies.jsx rename to packages/unleash-frontend-next/src/component/feature/selected-strategies.jsx index 40c2067a20..0de1b28941 100644 --- a/packages/unleash-frontend-next/src/component/feature/ConfiguredStrategies.jsx +++ b/packages/unleash-frontend-next/src/component/feature/selected-strategies.jsx @@ -1,7 +1,7 @@ import React, { PropTypes } from 'react'; import { Avatar, Chip } from 'react-toolbox'; -class ConfiguredStrategies extends React.Component { +class SelectedStrategies extends React.Component { static propTypes () { return { configuredStrategies: PropTypes.array.isRequired, @@ -30,11 +30,11 @@ class ConfiguredStrategies extends React.Component { )); return ( -

+

{strategies.length > 0 ? strategies :

No activation strategies added

} -

+
); } } -export default ConfiguredStrategies; +export default SelectedStrategies; diff --git a/packages/unleash-frontend-next/src/component/feature/AddFeatureToggleStrategy.jsx b/packages/unleash-frontend-next/src/component/feature/strategies-for-toggle.jsx similarity index 85% rename from packages/unleash-frontend-next/src/component/feature/AddFeatureToggleStrategy.jsx rename to packages/unleash-frontend-next/src/component/feature/strategies-for-toggle.jsx index b914b90d73..397deb2c42 100644 --- a/packages/unleash-frontend-next/src/component/feature/AddFeatureToggleStrategy.jsx +++ b/packages/unleash-frontend-next/src/component/feature/strategies-for-toggle.jsx @@ -1,7 +1,7 @@ import React, { PropTypes } from 'react'; -import ConfigureStrategy from './ConfigureStrategy'; +import SelectStrategies from './select-strategies'; -class AddFeatureToggleStrategy extends React.Component { +class AddStrategiesToToggle extends React.Component { constructor () { super(); this.state = { @@ -40,7 +40,7 @@ class AddFeatureToggleStrategy extends React.Component { render () { return this.state.showConfigure ? - : @@ -48,4 +48,4 @@ class AddFeatureToggleStrategy extends React.Component { } } -export default AddFeatureToggleStrategy; +export default AddStrategiesToToggle; diff --git a/packages/unleash-frontend-next/src/Navigation.jsx b/packages/unleash-frontend-next/src/component/nav.jsx similarity index 97% rename from packages/unleash-frontend-next/src/Navigation.jsx rename to packages/unleash-frontend-next/src/component/nav.jsx index cd752c52bb..bded15c70b 100644 --- a/packages/unleash-frontend-next/src/Navigation.jsx +++ b/packages/unleash-frontend-next/src/component/nav.jsx @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { ListSubHeader, List, ListItem, ListDivider } from 'react-toolbox'; -import style from './style'; +import style from './styles.scss'; export default class UnleashNav extends Component { static contextTypes = { diff --git a/packages/unleash-frontend-next/src/component/strategies/add-container.js b/packages/unleash-frontend-next/src/component/strategies/add-container.js new file mode 100644 index 0000000000..d3f21d96be --- /dev/null +++ b/packages/unleash-frontend-next/src/component/strategies/add-container.js @@ -0,0 +1,40 @@ +import { connect } from 'react-redux'; + +import { createMapper, createActions } from '../input-helpers'; +import { createStrategy } from '../../store/strategy-actions'; + +import AddStrategy, { PARAM_PREFIX } from './add-strategy'; + +const ID = 'add-strategy'; + +const actions = createActions(ID, (methods, dispatch) => { + methods.onSubmit = (input) => ( + (e) => { + e.preventDefault(); + + const parametersTemplate = {}; + Object.keys(input).forEach(key => { + if (key.startsWith(PARAM_PREFIX)) { + parametersTemplate[input[key]] = 'string'; + } + }); + input.parametersTemplate = parametersTemplate; + + createStrategy(input)(dispatch) + .then(() => methods.clear()) + // somewhat quickfix / hacky to go back.. + .then(() => window.history.back()); + } + ); + + methods.onCancel = (e) => { + e.preventDefault(); + // somewhat quickfix / hacky to go back.. + window.history.back(); + }; + + + return methods; +}); + +export default connect(createMapper(ID), actions)(AddStrategy); diff --git a/packages/unleash-frontend-next/src/component/strategies/add-strategy.jsx b/packages/unleash-frontend-next/src/component/strategies/add-strategy.jsx index 2ffeb4b667..66aa7099ad 100644 --- a/packages/unleash-frontend-next/src/component/strategies/add-strategy.jsx +++ b/packages/unleash-frontend-next/src/component/strategies/add-strategy.jsx @@ -1,16 +1,13 @@ import React, { PropTypes } from 'react'; -import { connect } from 'react-redux'; import Input from 'react-toolbox/lib/input'; import Button from 'react-toolbox/lib/button'; -import { createMapper, createActions } from '../input-helpers'; -import { createStrategy } from '../../store/strategy-actions'; - function gerArrayWithEntries (num) { return Array.from(Array(num)); } -const PARAM_PREFIX = 'param_'; +export const PARAM_PREFIX = 'param_'; + const genParams = (input, num = 0, setValue) => { return (
{gerArrayWithEntries(num).map((v, i) => { const key = `${PARAM_PREFIX}${i + 1}`; @@ -76,36 +73,4 @@ AddStrategy.propTypes = { onSubmit: PropTypes.func, }; -const ID = 'add-strategy'; - -const actions = createActions(ID, (methods, dispatch) => { - methods.onSubmit = (input) => ( - (e) => { - e.preventDefault(); - - const parametersTemplate = {}; - Object.keys(input).forEach(key => { - if (key.startsWith(PARAM_PREFIX)) { - parametersTemplate[input[key]] = 'string'; - } - }); - input.parametersTemplate = parametersTemplate; - - createStrategy(input)(dispatch) - .then(() => methods.clear()) - // somewhat quickfix / hacky to go back.. - .then(() => window.history.back()); - } - ); - - methods.onCancel = (e) => { - e.preventDefault(); - // somewhat quickfix / hacky to go back.. - window.history.back(); - }; - - - return methods; -}); - -export default connect(createMapper(ID), actions)(AddStrategy); +export default AddStrategy; diff --git a/packages/unleash-frontend-next/src/component/strategies/list.jsx b/packages/unleash-frontend-next/src/component/strategies/list-component.jsx similarity index 100% rename from packages/unleash-frontend-next/src/component/strategies/list.jsx rename to packages/unleash-frontend-next/src/component/strategies/list-component.jsx diff --git a/packages/unleash-frontend-next/src/component/strategies/index.jsx b/packages/unleash-frontend-next/src/component/strategies/list-container.jsx similarity index 92% rename from packages/unleash-frontend-next/src/component/strategies/index.jsx rename to packages/unleash-frontend-next/src/component/strategies/list-container.jsx index aea177acf2..1b1d1eb87e 100644 --- a/packages/unleash-frontend-next/src/component/strategies/index.jsx +++ b/packages/unleash-frontend-next/src/component/strategies/list-container.jsx @@ -1,5 +1,5 @@ import { connect } from 'react-redux'; -import StrategiesListComponent from './list.jsx'; +import StrategiesListComponent from './list-component.jsx'; import { fetchStrategies, removeStrategy } from '../../store/strategy-actions'; const mapStateToProps = (state) => { diff --git a/packages/unleash-frontend-next/src/style.scss b/packages/unleash-frontend-next/src/component/styles.scss similarity index 100% rename from packages/unleash-frontend-next/src/style.scss rename to packages/unleash-frontend-next/src/component/styles.scss diff --git a/packages/unleash-frontend-next/src/index.jsx b/packages/unleash-frontend-next/src/index.jsx index cc64462701..a45ca4a3ce 100644 --- a/packages/unleash-frontend-next/src/index.jsx +++ b/packages/unleash-frontend-next/src/index.jsx @@ -6,7 +6,7 @@ import thunkMiddleware from 'redux-thunk'; import { createStore, applyMiddleware } from 'redux'; import store from './store'; -import App from './App'; +import App from './component/app'; import Features from './page/features'; import CreateFeatureToggle from './page/features/create'; diff --git a/packages/unleash-frontend-next/src/page/features/create.js b/packages/unleash-frontend-next/src/page/features/create.js index 8f825d29f5..86b5f0b410 100644 --- a/packages/unleash-frontend-next/src/page/features/create.js +++ b/packages/unleash-frontend-next/src/page/features/create.js @@ -1,5 +1,5 @@ import React from 'react'; -import AddFeatureToggle from '../../component/feature/AddFeatureToggle'; +import AddFeatureToggle from '../../component/feature/add-container'; const render = () => (
diff --git a/packages/unleash-frontend-next/src/page/features/edit.js b/packages/unleash-frontend-next/src/page/features/edit.js index c26d3685b6..3e9c0e75b6 100644 --- a/packages/unleash-frontend-next/src/page/features/edit.js +++ b/packages/unleash-frontend-next/src/page/features/edit.js @@ -1,5 +1,5 @@ import React, { Component, PropTypes } from 'react'; -import EditFeatureToggle from '../../component/feature/EditFeatureToggle'; +import EditFeatureToggle from '../../component/feature/edit-container'; export default class Features extends Component { static propTypes () { diff --git a/packages/unleash-frontend-next/src/page/features/index.js b/packages/unleash-frontend-next/src/page/features/index.js index 06c0dffbc4..b632addcd0 100644 --- a/packages/unleash-frontend-next/src/page/features/index.js +++ b/packages/unleash-frontend-next/src/page/features/index.js @@ -1,5 +1,5 @@ import React from 'react'; -import FeatureListContainer from '../../component/feature/FeatureListContainer'; +import FeatureListContainer from '../../component/feature/list-container'; const render = () => (); diff --git a/packages/unleash-frontend-next/src/page/strategies/create.js b/packages/unleash-frontend-next/src/page/strategies/create.js index 0a8dd7bfe3..bd94fcf7d1 100644 --- a/packages/unleash-frontend-next/src/page/strategies/create.js +++ b/packages/unleash-frontend-next/src/page/strategies/create.js @@ -1,4 +1,4 @@ import React from 'react'; -import AddStrategies from '../../component/strategies/add-strategy'; +import AddStrategies from '../../component/strategies/add-container'; export default () => (); diff --git a/packages/unleash-frontend-next/src/page/strategies/index.js b/packages/unleash-frontend-next/src/page/strategies/index.js index 0d224abb06..8f41038bd0 100644 --- a/packages/unleash-frontend-next/src/page/strategies/index.js +++ b/packages/unleash-frontend-next/src/page/strategies/index.js @@ -1,4 +1,4 @@ import React from 'react'; -import Strategies from '../../component/strategies'; +import Strategies from '../../component/strategies/list-container'; export default () => ();