1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-06 00:07:44 +01:00

fix warning

This commit is contained in:
ivaosthu 2016-10-26 16:10:55 +02:00
parent f2f331d12c
commit 5a0d53befc
7 changed files with 20 additions and 15 deletions

View File

@ -19,7 +19,6 @@ class ErrorComponent extends React.Component {
icon="question_answer" icon="question_answer"
label={snackbarMsg} label={snackbarMsg}
ref="snackbar" ref="snackbar"
timeout={2000}
onClick={this.props.muteErrors} onClick={this.props.muteErrors}
onTimeout={this.props.muteErrors} onTimeout={this.props.muteErrors}
type="warning" type="warning"

View File

@ -12,24 +12,23 @@ const Feature = ({ feature, onFeatureClick, onFeatureRemove }) => {
const { name, description, enabled, strategies } = feature; // eslint-disable-line no-shadow const { name, description, enabled, strategies } = feature; // eslint-disable-line no-shadow
const actions = [ const actions = [
<div>{strategies && strategies.map(s => <Chip><small>{s.name}</small></Chip>)}</div>, <div key="strategies">{strategies && strategies.map((s, i) => <Chip key={i}><small>{s.name}</small></Chip>)}</div>,
<Link to={`/features/edit/${name}`} title={`Edit ${name}`}> <Link key="change" to={`/features/edit/${name}`} title={`Edit ${name}`}>
<FontIcon value="edit" className={style.action} /> <FontIcon value="edit" className={style.action} />
</Link>, </Link>,
<FontIcon className={style.action} value="delete" onClick={() => onFeatureRemove(name)} />, <FontIcon key="delete" className={style.action} value="delete" onClick={() => onFeatureRemove(name)} />,
]; ];
const leftActions = [ const leftActions = [
<Switch onChange={() => onFeatureClick(feature)} checked={enabled} />, <Switch key="left-actions" onChange={() => onFeatureClick(feature)} checked={enabled} />,
]; ];
return ( return (
<ListItem <ListItem
key={name}
leftActions={leftActions} leftActions={leftActions}
rightActions={actions} rightActions={actions}
caption={<Link to={`/features/edit/${name}`} title={`Edit ${name}`} className={style.link}> caption={name}
{name}
</Link>}
legend={(description && description.substring(0, 100)) || '-'} legend={(description && description.substring(0, 100)) || '-'}
/> />
); );

View File

@ -41,7 +41,7 @@ class AddStrategy extends React.Component {
return ( return (
<div style={containerStyle}> <div style={containerStyle}>
<FontIcon value="add" floating mini /> <FontIcon value="add" />
<div style={contentStyle}> <div style={contentStyle}>
<strong>{item.name}</strong> <strong>{item.name}</strong>
<small>{item.description}</small> <small>{item.description}</small>

View File

@ -53,7 +53,7 @@ class StrategyConfigure extends React.Component {
render () { render () {
const leftActions = [ const leftActions = [
<Button onClick={this.handleRemove} icon="remove" floating accent mini />, <Button key="remove" onClick={this.handleRemove} icon="remove" floating accent mini />,
]; ];
if (!this.props.strategyDefinition) { if (!this.props.strategyDefinition) {

View File

@ -1,6 +1,10 @@
import { List, Map as $Map } from 'immutable'; import { List, Map as $Map } from 'immutable';
import { ERROR_RECEIVE_FEATURE_TOGGLES } from './feature-actions';
import { MUTE_ERRORS } from './error-actions'; import { MUTE_ERRORS } from './error-actions';
import {
ERROR_RECEIVE_FEATURE_TOGGLES,
ERROR_CREATING_FEATURE_TOGGLE,
} from './feature-actions';
const debug = require('debug')('unleash:error-store'); const debug = require('debug')('unleash:error-store');
function getInitState () { function getInitState () {
@ -12,10 +16,11 @@ function getInitState () {
const strategies = (state = getInitState(), action) => { const strategies = (state = getInitState(), action) => {
switch (action.type) { switch (action.type) {
case ERROR_CREATING_FEATURE_TOGGLE:
case ERROR_RECEIVE_FEATURE_TOGGLES: case ERROR_RECEIVE_FEATURE_TOGGLES:
debug('Got error', action); debug('Got error', action);
return state return state
.update('list', (list) => list.push('Failed fetching feature toggles')) .update('list', (list) => list.push(action.errorMsg))
.set('showError', true); .set('showError', true);
case MUTE_ERRORS: case MUTE_ERRORS:
debug('muting errors'); debug('muting errors');

View File

@ -28,10 +28,11 @@ function updateFeatureToggle (featureToggle) {
}; };
}; };
function errorCreatingFeatureToggle (statusCode) { function errorCreatingFeatureToggle (error) {
return { return {
type: ERROR_CREATING_FEATURE_TOGGLE, type: ERROR_CREATING_FEATURE_TOGGLE,
statusCode, statusCode: error.statusCode,
errorMsg: error.msg,
receivedAt: Date.now(), receivedAt: Date.now(),
}; };
} }

View File

@ -8,7 +8,8 @@ const headers = {
function throwIfNotSuccess (response) { function throwIfNotSuccess (response) {
if (!response.ok) { if (!response.ok) {
let error = new Error('API call failed'); let error = new Error('API call failed');
error.status = response.status; error.statusCode = response.status;
error.msg = response.json();
throw error; throw error;
} }
return response; return response;