From ab64d7eb1ca167a5eae55aa2c4c056c1e1154434 Mon Sep 17 00:00:00 2001 From: sveisvei Date: Tue, 25 Oct 2016 10:42:38 +0200 Subject: [PATCH] semi working input state store --- .../src/component/feature/add-component.jsx | 136 ++++++++++-------- .../src/component/feature/add-container.jsx | 94 ++++-------- .../src/component/feature/edit-container.jsx | 120 +++++++--------- .../feature/select-strategies-container.js | 8 ++ .../component/feature/select-strategies.jsx | 17 ++- .../component/feature/selected-strategies.jsx | 4 +- .../feature/strategies-for-toggle.jsx | 14 +- .../src/component/input-helpers.js | 57 ++++++-- .../src/component/strategies/add-container.js | 9 +- .../src/store/input-actions.js | 6 + .../src/store/input-store.js | 47 ++++-- 11 files changed, 274 insertions(+), 238 deletions(-) create mode 100644 packages/unleash-frontend-next/src/component/feature/select-strategies-container.js diff --git a/packages/unleash-frontend-next/src/component/feature/add-component.jsx b/packages/unleash-frontend-next/src/component/feature/add-component.jsx index 58ec139294..6698c25781 100644 --- a/packages/unleash-frontend-next/src/component/feature/add-component.jsx +++ b/packages/unleash-frontend-next/src/component/feature/add-component.jsx @@ -1,78 +1,88 @@ -import React, { PropTypes } from 'react'; +import React, { Component, PropTypes } from 'react'; import { Input, Switch, Button } from 'react-toolbox'; -import AddFeatureToggleStrategy from './strategies-for-toggle'; +import SelectStrategies from './strategies-for-toggle'; import SelectedStrategies from './selected-strategies'; -const AddFeatureToggleComponent = ({ - strategies, - featureToggle, - updateField, - addStrategy, - removeStrategy, - onSubmit, - onCancel, - editmode, -}) => { - const { - name, // eslint-disable-line - description, - enabled, - } = featureToggle; - const configuredStrategies = featureToggle.strategies; +class AddFeatureToggleComponent extends Component { - return ( -
-
- - + componentWillMount () { + // TODO unwind this stuff + if (this.props.initCallRequired === true) { + this.props.init(this.props.input); + } + } + + render () { + const { + input, + setValue, + addStrategy, + removeStrategy, + onSubmit, + onCancel, + editmode = false, + } = this.props; + + const { + name, // eslint-disable-line + description, + enabled, + } = input; + const configuredStrategies = input.strategies || []; + + return ( + +
+ setValue('name', v)} /> + setValue('description', v)} /> + +
+ + setValue('enabled', v)} /> +
+
+ +
+ Activation strategies + +
+ +
+ +

- +
- -
- Activation strategies - -
- -
- -
- -
- - -