@@ -22,7 +22,8 @@ import type {ManagerUserState} from '../../types/reducers'
2222export default class LabelEditor extends React . Component {
2323 state = {
2424 validation : {
25- name : true
25+ name : true ,
26+ description : true
2627 } ,
2728 newLabel : { ...this . props . label }
2829 }
@@ -42,10 +43,11 @@ export default class LabelEditor extends React.Component {
4243 else return permissions . isApplicationAdmin ( ) || permissions . canAdministerAnOrganization ( )
4344 }
4445
45- _onFormChange = ( { target} : { target : HTMLInputElement } ) => {
46+ _onFormChange = ( { target} : { target : HTMLInputElement } , alwaysValid : Boolean ) => {
4647 const { name, value, type, checked} = target
48+
4749 const universalValue = type === 'checkbox' ? checked : value
48- const valid = type === 'checkbox' ? true : universalValue . length > 0
50+ const valid = alwaysValid || universalValue . length
4951
5052 this . setState (
5153 update ( this . state , {
@@ -110,6 +112,17 @@ export default class LabelEditor extends React.Component {
110112 < FormControl . Feedback />
111113 < HelpBlock > Required.</ HelpBlock >
112114 </ FormGroup >
115+ < FormGroup
116+ data-test-id = 'label-description'
117+ >
118+ < ControlLabel > Description</ ControlLabel >
119+ < FormControl
120+ value = { newLabel . description }
121+ name = { 'description' }
122+ onChange = { e => this . _onFormChange ( e , true ) }
123+ />
124+ < FormControl . Feedback />
125+ </ FormGroup >
113126 </ ListGroupItem >
114127 < ListGroupItem >
115128 < Row >
@@ -139,7 +152,7 @@ export default class LabelEditor extends React.Component {
139152 checked = { newLabel . adminOnly }
140153 name = { 'adminOnly' }
141154 type = 'checkbox'
142- onChange = { this . _onFormChange }
155+ onChange = { e => this . _onFormChange ( e , true ) }
143156 />
144157 </ Col >
145158 < Col xs = { 9 } >
0 commit comments