@@ -76,40 +76,57 @@ class SimilarSeriesForm extends React.PureComponent {
76
76
}
77
77
78
78
render ( ) {
79
- const hasValidationErrors = this . state . validationErrors . length > 0 ;
79
+ return (
80
+ < SimilarSeriesFormView
81
+ l10n = { this . props . l10n }
82
+ handleChange = { this . handleChange }
83
+ handleSubmit = { this . handleSubmit }
84
+ similarSeriesId = { this . state . similarSeriesId }
85
+ isDisabled = { this . state . isDisabled }
86
+ hasServerError = { this . state . hasServerError }
87
+ validationErrors = { this . state . validationErrors }
88
+ />
89
+ )
90
+ }
91
+ }
92
+
93
+ class SimilarSeriesFormView extends React . PureComponent {
94
+ render ( ) {
95
+ const { similarSeriesId, hasServerError, isDisabled, validationErrors, handleChange, handleSubmit} = this . props ;
96
+ const hasValidationErrors = validationErrors . length > 0 ;
80
97
81
98
return (
82
99
< div className = "row" >
83
100
< div id = "mark-similar-series-failed-msg"
84
- className = { `alert alert-danger text-center col-sm-8 col-sm-offset-2 ${ this . state . hasServerError ? '' : 'hidden' } ` } >
101
+ className = { `alert alert-danger text-center col-sm-8 col-sm-offset-2 ${ hasServerError ? '' : 'hidden' } ` } >
85
102
{ this . props . l10n [ 't_server_error' ] || 'Server error' }
86
103
</ div >
87
104
88
105
< div className = "col-sm-9 col-sm-offset-3" >
89
106
< form id = "mark-similar-series-form"
90
107
className = { `form-inline ${ hasValidationErrors ? 'has-error' : '' } ` }
91
- onSubmit = { this . handleSubmit } >
108
+ onSubmit = { handleSubmit } >
92
109
93
110
< div className = "form-group form-group-sm" >
94
111
< input id = "similar-id"
95
112
type = "text"
96
113
className = "form-control"
97
114
required = "required"
98
115
placeholder = { this . props . l10n [ 't_similar_series_id' ] || 'Similar series ID' }
99
- value = { this . state . similarSeriesId }
100
- onChange = { this . handleChange }
101
- disabled = { this . state . isDisabled } />
116
+ value = { similarSeriesId }
117
+ onChange = { handleChange }
118
+ disabled = { isDisabled } />
102
119
</ div >
103
120
104
121
< div className = "form-group form-group-sm" >
105
122
< button type = "submit"
106
123
className = "btn btn-primary btn-sm"
107
- disabled = { this . state . isDisabled } >
124
+ disabled = { isDisabled } >
108
125
{ this . props . l10n [ 't_mark_as_similar' ] || 'Mark as similar' }
109
126
</ button >
110
127
</ div >
111
128
< span id = "similar-id.errors" className = { `help-block ${ hasValidationErrors ? '' : 'hidden' } ` } >
112
- { this . state . validationErrors . join ( ', ' ) }
129
+ { validationErrors . join ( ', ' ) }
113
130
</ span >
114
131
115
132
</ form >
0 commit comments