mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-04 00:18:01 +01:00
fix: missing feature toggle should pre-fill name
This commit is contained in:
parent
00064644e5
commit
a4961cc6d3
@ -4,14 +4,16 @@ import { connect } from 'react-redux';
|
||||
import arrayMove from 'array-move';
|
||||
import { createFeatureToggles, validateName } from './../../../store/feature-actions';
|
||||
import AddFeatureComponent from './form-add-feature-component';
|
||||
import { loadNameFromHash } from './util';
|
||||
|
||||
const defaultStrategy = { name: 'default' };
|
||||
|
||||
class WrapperComponent extends Component {
|
||||
constructor() {
|
||||
super();
|
||||
constructor(props) {
|
||||
super(props);
|
||||
const name = loadNameFromHash();
|
||||
this.state = {
|
||||
featureToggle: { name: '', description: '', strategies: [], enabled: true },
|
||||
featureToggle: { name, description: '', strategies: [], enabled: true },
|
||||
errors: {},
|
||||
dirty: false,
|
||||
};
|
||||
|
@ -5,3 +5,13 @@ export const trim = value => {
|
||||
return value;
|
||||
}
|
||||
};
|
||||
|
||||
export function loadNameFromHash() {
|
||||
let field = '';
|
||||
try {
|
||||
[, field] = document.location.hash.match(/name=([a-z0-9-_.]+)/i);
|
||||
} catch (e) {
|
||||
// nothing
|
||||
}
|
||||
return field;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user