mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
fix: Should be possible to clone even if strategy does not have groupId
This commit is contained in:
parent
c27fb9ac1d
commit
c3aa3ea88f
@ -13,6 +13,10 @@ class AddFeatureComponent extends Component {
|
||||
window.onbeforeunload = () => 'Data will be lost if you leave the page, are you sure?';
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
window.onbeforeunload = false;
|
||||
}
|
||||
|
||||
render() {
|
||||
const {
|
||||
input,
|
||||
|
@ -11,7 +11,7 @@ class WrapperComponent extends Component {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
featureToggle: { strategies: [], enabled: true },
|
||||
featureToggle: { name: '', description: '', strategies: [], enabled: true },
|
||||
errors: {},
|
||||
dirty: false,
|
||||
};
|
||||
@ -71,7 +71,7 @@ class WrapperComponent extends Component {
|
||||
const { featureToggle } = this.state;
|
||||
featureToggle.createdAt = new Date();
|
||||
|
||||
if (Array.isArray(featureToggle.strategies)) {
|
||||
if (Array.isArray(featureToggle.strategies && featureToggle.strategies.length > 0)) {
|
||||
featureToggle.strategies.forEach(s => {
|
||||
delete s.id;
|
||||
});
|
||||
@ -115,7 +115,7 @@ const mapDispatchToProps = dispatch => ({
|
||||
});
|
||||
|
||||
const FormAddContainer = connect(
|
||||
() => {},
|
||||
() => ({}),
|
||||
mapDispatchToProps
|
||||
)(WrapperComponent);
|
||||
|
||||
|
@ -66,7 +66,7 @@ class CopyFeatureComponent extends Component {
|
||||
|
||||
if (replaceGroupId) {
|
||||
copyToggle.strategies.forEach(s => {
|
||||
if (s.parameters.groupId) {
|
||||
if (s.parameters && s.parameters.groupId) {
|
||||
s.parameters.groupId = newToggleName;
|
||||
}
|
||||
});
|
||||
|
@ -8,7 +8,7 @@ import { HeaderTitle } from '../../common';
|
||||
class StrategiesSectionComponent extends React.Component {
|
||||
static propTypes = {
|
||||
strategies: PropTypes.array.isRequired,
|
||||
featureToggleName: PropTypes.string.isRequired,
|
||||
featureToggleName: PropTypes.string,
|
||||
addStrategy: PropTypes.func,
|
||||
removeStrategy: PropTypes.func,
|
||||
updateStrategy: PropTypes.func,
|
||||
|
@ -26,7 +26,7 @@ const InputPercentage = ({ name, minLabel, maxLabel, value, onChange }) => (
|
||||
<span style={infoLabelStyle}>{maxLabel}</span>
|
||||
</Cell>
|
||||
</Grid>
|
||||
<Slider min={0} max={100} defaultValue={value} value={value} onChange={onChange} label={name} />
|
||||
<Slider min={0} max={100} value={value} onChange={onChange} label={name} />
|
||||
</div>
|
||||
);
|
||||
|
||||
|
@ -40,6 +40,7 @@ export const DrawerMenu = ({ links = [] }) => (
|
||||
{links.map(link => (
|
||||
<a
|
||||
href={link.href}
|
||||
key={link.href}
|
||||
target="_blank"
|
||||
className={[styles.navigationLink, 'mdl-color-text--grey-900'].join(' ')}
|
||||
title={link.title}
|
||||
|
Loading…
Reference in New Issue
Block a user