1
0
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:
Ivar Conradi Østhus 2020-01-10 08:22:08 +01:00
parent c27fb9ac1d
commit c3aa3ea88f
6 changed files with 11 additions and 6 deletions

View File

@ -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,

View File

@ -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);

View File

@ -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;
}
});

View File

@ -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,

View File

@ -26,7 +26,7 @@ const InputPercentage = ({ name, minLabel, maxLabel, value, onChange }) => (
<span style={infoLabelStyle}>{maxLabel}</span>&nbsp;
</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>
);

View File

@ -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}