mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-06 00:07:44 +01:00
fix warning
This commit is contained in:
parent
f2f331d12c
commit
5a0d53befc
@ -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"
|
||||||
|
@ -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)) || '-'}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
@ -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>
|
||||||
|
@ -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) {
|
||||||
|
@ -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');
|
||||||
|
@ -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(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user