Skip to content
This repository has been archived by the owner on Jun 10, 2021. It is now read-only.

Name max length check #29

Merged
merged 2 commits into from
Aug 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion common/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ const Constants = {
'#039587',
'#344562',
],
forms: {
maxLength: {
"FEATURE_ID" : 150,
"SEGMENT_ID" : 150,
"TRAITS_ID" : 150
},
},
defaultRule: {
property: '',
operator: 'EQUAL',
Expand Down Expand Up @@ -159,7 +166,7 @@ const Constants = {
'Node JS': require('./code-help/install/install-node')(keywords),
'Java': require('./code-help/install/install-java')(keywords),
'.NET': require('./code-help/install/install-dotnet')(keywords),
},
},
},
simulate: {},
roles: {
Expand Down
7 changes: 5 additions & 2 deletions web/components/modals/CreateFlag.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import data from '../../../common/data/base/_data';
import SegmentOverrides from '../SegmentOverrides';
import AddEditTags from '../AddEditTags';
import TagList from '../TagList';
import Constants from '../../../common/constants';

const FEATURE_ID_MAXLENGTH = Constants.forms.maxLength.FEATURE_ID;

const CreateFlag = class extends Component {
static displayName = 'CreateFlag'
Expand Down Expand Up @@ -114,7 +117,7 @@ const CreateFlag = class extends Component {
const Provider = identity ? IdentityProvider : FeatureListProvider;
const valueString = isEdit ? 'Value' : 'Initial value';
const enabledString = isEdit ? 'Enabled' : 'Enabled by default';

return (
<ProjectProvider
id={this.props.projectId}
Expand Down Expand Up @@ -163,7 +166,6 @@ const CreateFlag = class extends Component {
</Tabs>
</FormGroup>
)}

<FormGroup className="mb-4 mr-3 ml-3">
<InputGroup
ref={e => this.input = e}
Expand All @@ -172,6 +174,7 @@ const CreateFlag = class extends Component {
readOnly: isEdit,
className: 'full-width',
name: 'featureID',
maxLength: FEATURE_ID_MAXLENGTH,
}}
value={name}
onChange={e => this.setState({ name: Format.enumeration.set(Utils.safeParseEventValue(e)).toLowerCase() })}
Expand Down
6 changes: 5 additions & 1 deletion web/components/modals/CreateSegment.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ import engine from 'bullet-train-rules-engine';
import Rule from './Rule';
import Highlight from '../Highlight';
import SegmentStore from '../../../common/stores/segment-list-store';
import Constants from '../../../common/constants';

const SEGMENT_ID_MAXLENGTH = Constants.forms.maxLength.SEGMENT_ID;

const CreateSegment = class extends Component {
static displayName = 'CreateSegment'
Expand Down Expand Up @@ -167,7 +170,8 @@ const CreateSegment = class extends Component {
inputProps={{
className: 'full-width',
name: 'segmentID',
readOnly: isEdit
readOnly: isEdit,
maxLength: SEGMENT_ID_MAXLENGTH
}}
value={name}
onChange={e => this.setState({ name: Format.enumeration.set(Utils.safeParseEventValue(e)).toLowerCase() })}
Expand Down
4 changes: 4 additions & 0 deletions web/components/modals/CreateTrait.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import React, { Component } from 'react';
import Highlight from '../Highlight';
import Constants from '../../../common/constants';

const TRAITS_ID_MAXLENGTH = Constants.forms.maxLength.TRAITS_ID;

const CreateTrait = class extends Component {
static displayName = 'CreateTrait'
Expand Down Expand Up @@ -62,6 +65,7 @@ const CreateTrait = class extends Component {
readOnly: isEdit,
className: 'full-width',
name: 'traitID',
maxLength: TRAITS_ID_MAXLENGTH,
}}
value={trait_key}
onChange={e => this.setState({ trait_key: Format.enumeration.set(Utils.safeParseEventValue(e)).toLowerCase() })}
Expand Down