1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-11 00:08:30 +01:00

Cleanup error messages for strategies

This commit is contained in:
ivaosthu 2017-11-02 23:32:02 +01:00
parent 96f0566fa5
commit e8441f3111
2 changed files with 3 additions and 8 deletions

View File

@ -128,7 +128,6 @@ class AddStrategy extends Component {
name="name" name="name"
required required
disabled={editmode} disabled={editmode}
pattern="^[0-9a-zA-Z\.\-\_]+$"
onChange={({ target }) => setValue('name', trim(target.value))} onChange={({ target }) => setValue('name', trim(target.value))}
value={input.name} value={input.name}
/> />

View File

@ -11,16 +11,12 @@ export const RECEIVE_STRATEGIES = 'RECEIVE_STRATEGIES';
export const ERROR_RECEIVE_STRATEGIES = 'ERROR_RECEIVE_STRATEGIES'; export const ERROR_RECEIVE_STRATEGIES = 'ERROR_RECEIVE_STRATEGIES';
export const ERROR_CREATING_STRATEGY = 'ERROR_CREATING_STRATEGY'; export const ERROR_CREATING_STRATEGY = 'ERROR_CREATING_STRATEGY';
export const ERROR_UPDATING_STRATEGY = 'ERROR_UPDATING_STRATEGY'; export const ERROR_UPDATING_STRATEGY = 'ERROR_UPDATING_STRATEGY';
export const ERROR_REMOVING_STRATEGY = 'ERROR_REMOVING_STRATEGY';
const addStrategy = strategy => ({ type: ADD_STRATEGY, strategy }); const addStrategy = strategy => ({ type: ADD_STRATEGY, strategy });
const createRemoveStrategy = strategy => ({ type: REMOVE_STRATEGY, strategy }); const createRemoveStrategy = strategy => ({ type: REMOVE_STRATEGY, strategy });
const updatedStrategy = strategy => ({ type: UPDATE_STRATEGY, strategy }); const updatedStrategy = strategy => ({ type: UPDATE_STRATEGY, strategy });
const errorCreatingStrategy = statusCode => ({
type: ERROR_CREATING_STRATEGY,
statusCode,
});
const startRequest = () => ({ type: REQUEST_STRATEGIES }); const startRequest = () => ({ type: REQUEST_STRATEGIES });
const receiveStrategies = json => ({ const receiveStrategies = json => ({
@ -62,7 +58,7 @@ export function createStrategy(strategy) {
return api return api
.create(strategy) .create(strategy)
.then(() => dispatch(addStrategy(strategy))) .then(() => dispatch(addStrategy(strategy)))
.catch(error => dispatch(errorCreatingStrategy(error))); .catch(dispatchAndThrow(dispatch, ERROR_CREATING_STRATEGY));
}; };
} }
@ -82,7 +78,7 @@ export function removeStrategy(strategy) {
api api
.remove(strategy) .remove(strategy)
.then(() => dispatch(createRemoveStrategy(strategy))) .then(() => dispatch(createRemoveStrategy(strategy)))
.catch(error => dispatch(errorCreatingStrategy(error))); .catch(dispatchAndThrow(dispatch, ERROR_REMOVING_STRATEGY));
} }
export function getApplicationsWithStrategy(strategyName) { export function getApplicationsWithStrategy(strategyName) {