mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
fix warning
This commit is contained in:
parent
2e0094cd91
commit
d90f0e7a2a
@ -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"
|
||||
|
@ -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)) || '-'}
|
||||
/>
|
||||
);
|
||||
|
@ -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>
|
||||
|
@ -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) {
|
||||
|
@ -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');
|
||||
|
@ -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(),
|
||||
};
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user