1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-07 01:16:28 +02: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?'; window.onbeforeunload = () => 'Data will be lost if you leave the page, are you sure?';
} }
componentWillUnmount() {
window.onbeforeunload = false;
}
render() { render() {
const { const {
input, input,

View File

@ -11,7 +11,7 @@ class WrapperComponent extends Component {
constructor() { constructor() {
super(); super();
this.state = { this.state = {
featureToggle: { strategies: [], enabled: true }, featureToggle: { name: '', description: '', strategies: [], enabled: true },
errors: {}, errors: {},
dirty: false, dirty: false,
}; };
@ -71,7 +71,7 @@ class WrapperComponent extends Component {
const { featureToggle } = this.state; const { featureToggle } = this.state;
featureToggle.createdAt = new Date(); featureToggle.createdAt = new Date();
if (Array.isArray(featureToggle.strategies)) { if (Array.isArray(featureToggle.strategies && featureToggle.strategies.length > 0)) {
featureToggle.strategies.forEach(s => { featureToggle.strategies.forEach(s => {
delete s.id; delete s.id;
}); });
@ -115,7 +115,7 @@ const mapDispatchToProps = dispatch => ({
}); });
const FormAddContainer = connect( const FormAddContainer = connect(
() => {}, () => ({}),
mapDispatchToProps mapDispatchToProps
)(WrapperComponent); )(WrapperComponent);

View File

@ -66,7 +66,7 @@ class CopyFeatureComponent extends Component {
if (replaceGroupId) { if (replaceGroupId) {
copyToggle.strategies.forEach(s => { copyToggle.strategies.forEach(s => {
if (s.parameters.groupId) { if (s.parameters && s.parameters.groupId) {
s.parameters.groupId = newToggleName; s.parameters.groupId = newToggleName;
} }
}); });

View File

@ -8,7 +8,7 @@ import { HeaderTitle } from '../../common';
class StrategiesSectionComponent extends React.Component { class StrategiesSectionComponent extends React.Component {
static propTypes = { static propTypes = {
strategies: PropTypes.array.isRequired, strategies: PropTypes.array.isRequired,
featureToggleName: PropTypes.string.isRequired, featureToggleName: PropTypes.string,
addStrategy: PropTypes.func, addStrategy: PropTypes.func,
removeStrategy: PropTypes.func, removeStrategy: PropTypes.func,
updateStrategy: PropTypes.func, updateStrategy: PropTypes.func,

View File

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

View File

@ -40,6 +40,7 @@ export const DrawerMenu = ({ links = [] }) => (
{links.map(link => ( {links.map(link => (
<a <a
href={link.href} href={link.href}
key={link.href}
target="_blank" target="_blank"
className={[styles.navigationLink, 'mdl-color-text--grey-900'].join(' ')} className={[styles.navigationLink, 'mdl-color-text--grey-900'].join(' ')}
title={link.title} title={link.title}