1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

fix warning

This commit is contained in:
ivaosthu 2016-10-26 16:10:55 +02:00 committed by Ivar Conradi Østhus
parent 2e0094cd91
commit d90f0e7a2a
7 changed files with 20 additions and 15 deletions

View File

@ -19,7 +19,6 @@ class ErrorComponent extends React.Component {
icon="question_answer"
label={snackbarMsg}
ref="snackbar"
timeout={2000}
onClick={this.props.muteErrors}
onTimeout={this.props.muteErrors}
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 actions = [
<div>{strategies && strategies.map(s => <Chip><small>{s.name}</small></Chip>)}</div>,
<Link to={`/features/edit/${name}`} title={`Edit ${name}`}>
<div key="strategies">{strategies && strategies.map((s, i) => <Chip key={i}><small>{s.name}</small></Chip>)}</div>,
<Link key="change" to={`/features/edit/${name}`} title={`Edit ${name}`}>
<FontIcon value="edit" className={style.action} />
</Link>,
<FontIcon className={style.action} value="delete" onClick={() => onFeatureRemove(name)} />,
<FontIcon key="delete" className={style.action} value="delete" onClick={() => onFeatureRemove(name)} />,
];
const leftActions = [
<Switch onChange={() => onFeatureClick(feature)} checked={enabled} />,
<Switch key="left-actions" onChange={() => onFeatureClick(feature)} checked={enabled} />,
];
return (
<ListItem
key={name}
leftActions={leftActions}
rightActions={actions}
caption={<Link to={`/features/edit/${name}`} title={`Edit ${name}`} className={style.link}>
{name}
</Link>}
caption={name}
legend={(description && description.substring(0, 100)) || '-'}
/>
);

View File

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

View File

@ -53,7 +53,7 @@ class StrategyConfigure extends React.Component {
render () {
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) {

View File

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

View File

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

View File

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