@@ -28,10 +28,21 @@ export default class FeedVersionViewer extends Component {
28
28
notesRequested : PropTypes . func ,
29
29
fetchValidationResult : PropTypes . func ,
30
30
downloadFeedClicked : PropTypes . func ,
31
- loadFeedVersionForEditing : PropTypes . func
31
+ loadFeedVersionForEditing : PropTypes . func ,
32
+ validationJob : PropTypes . object
32
33
}
33
34
render ( ) {
34
- const version = this . props . version
35
+ const {
36
+ version,
37
+ feedVersionIndex,
38
+ versionSection,
39
+ feedSource,
40
+ fetchValidationResult,
41
+ user,
42
+ validationJob,
43
+ notesRequested,
44
+ newNotePosted
45
+ } = this . props
35
46
const messages = getComponentMessages ( 'FeedVersionViewer' )
36
47
37
48
if ( ! version ) return < p className = 'text-center lead' > { getMessage ( messages , 'noVersionsExist' ) } </ p >
@@ -61,37 +72,38 @@ export default class FeedVersionViewer extends Component {
61
72
< Row >
62
73
< Col xs = { 12 } sm = { 3 } >
63
74
< VersionSectionSelector
64
- version = { this . props . version }
65
- feedVersionIndex = { this . props . feedVersionIndex }
66
- versionSection = { this . props . versionSection }
75
+ version = { version }
76
+ feedVersionIndex = { feedVersionIndex }
77
+ validationJob = { validationJob }
78
+ versionSection = { versionSection }
67
79
/>
68
80
</ Col >
69
81
< Col xs = { 12 } sm = { 9 } >
70
- { ! this . props . versionSection
82
+ { ! versionSection
71
83
? < FeedVersionReport
72
- isPublished = { version . id === this . props . feedSource . publishedVersionId }
84
+ isPublished = { version . id === feedSource . publishedVersionId }
73
85
{ ...this . props }
74
86
/>
75
- : this . props . versionSection === 'issues'
87
+ : versionSection === 'issues'
76
88
? < GtfsValidationViewer
77
89
validationResult = { version . validationResult }
78
90
version = { version }
79
- fetchValidationResult = { ( ) => { this . props . fetchValidationResult ( version ) } }
91
+ fetchValidationResult = { ( ) => { fetchValidationResult ( version ) } }
80
92
/>
81
- : this . props . versionSection === 'gtfsplus' && isModuleEnabled ( 'gtfsplus' )
93
+ : versionSection === 'gtfsplus' && isModuleEnabled ( 'gtfsplus' )
82
94
? < ActiveGtfsPlusVersionSummary
83
95
version = { version }
84
96
/>
85
- : this . props . versionSection === 'comments'
97
+ : versionSection === 'comments'
86
98
? < NotesViewer
87
99
type = 'feed-version'
88
100
stacked
89
- user = { this . props . user }
90
- version = { this . props . version }
101
+ user = { user }
102
+ version = { version }
91
103
notes = { version . notes }
92
104
noteCount = { version . noteCount }
93
- notesRequested = { ( ) => { this . props . notesRequested ( ) } }
94
- newNotePosted = { ( note ) => { this . props . newNotePosted ( note ) } }
105
+ notesRequested = { ( ) => { notesRequested ( ) } }
106
+ newNotePosted = { ( note ) => { newNotePosted ( note ) } }
95
107
/>
96
108
: null
97
109
}
@@ -114,10 +126,19 @@ export class VersionButtonToolbar extends Component {
114
126
115
127
downloadFeedClicked : PropTypes . func ,
116
128
deleteFeedVersionConfirmed : PropTypes . func ,
117
- loadFeedVersionForEditing : PropTypes . func
129
+ loadFeedVersionForEditing : PropTypes . func ,
130
+ validationJob : PropTypes . object
118
131
}
119
132
render ( ) {
120
- const version = this . props . version
133
+ const {
134
+ version,
135
+ hasVersions,
136
+ downloadFeedClicked,
137
+ isPublic,
138
+ loadFeedVersionForEditing,
139
+ deleteDisabled,
140
+ deleteFeedVersionConfirmed
141
+ } = this . props
121
142
const messages = getComponentMessages ( 'FeedVersionViewer' )
122
143
return (
123
144
< div style = { { display : 'inline' } } >
@@ -127,21 +148,21 @@ export class VersionButtonToolbar extends Component {
127
148
{ /* "Download Feed" Button */ }
128
149
< Button
129
150
bsStyle = 'primary'
130
- disabled = { ! this . props . hasVersions }
131
- onClick = { ( evt ) => this . props . downloadFeedClicked ( version , this . props . isPublic ) }
151
+ disabled = { ! hasVersions }
152
+ onClick = { ( evt ) => downloadFeedClicked ( version , isPublic ) }
132
153
>
133
154
< Glyphicon glyph = 'download' /> < span className = 'hidden-xs' > { getMessage ( messages , 'download' ) } </ span > < span className = 'hidden-xs hidden-sm' > { getMessage ( messages , 'feed' ) } </ span >
134
155
</ Button >
135
156
136
157
{ /* "Load for Editing" Button */ }
137
- { isModuleEnabled ( 'editor' ) && ! this . props . isPublic
158
+ { isModuleEnabled ( 'editor' ) && ! isPublic
138
159
? < Button bsStyle = 'success'
139
- disabled = { ! this . props . hasVersions }
160
+ disabled = { ! hasVersions }
140
161
onClick = { ( evt ) => {
141
162
this . refs . confirm . open ( {
142
163
title : getMessage ( messages , 'load' ) ,
143
164
body : getMessage ( messages , 'confirmLoad' ) ,
144
- onConfirm : ( ) => { this . props . loadFeedVersionForEditing ( version ) }
165
+ onConfirm : ( ) => { loadFeedVersionForEditing ( version ) }
145
166
} )
146
167
} }
147
168
>
@@ -151,15 +172,15 @@ export class VersionButtonToolbar extends Component {
151
172
}
152
173
153
174
{ /* "Delete Version" Button */ }
154
- { ! this . props . isPublic
175
+ { ! isPublic
155
176
? < Button
156
177
bsStyle = 'danger'
157
- disabled = { this . props . deleteDisabled || ! this . props . hasVersions || typeof this . props . deleteFeedVersionConfirmed === 'undefined' }
178
+ disabled = { deleteDisabled || ! hasVersions || typeof deleteFeedVersionConfirmed === 'undefined' }
158
179
onClick = { ( evt ) => {
159
180
this . refs . confirm . open ( {
160
181
title : `${ getMessage ( messages , 'delete' ) } ${ getMessage ( messages , 'version' ) } ` ,
161
182
body : getMessage ( messages , 'confirmDelete' ) ,
162
- onConfirm : ( ) => { this . props . deleteFeedVersionConfirmed ( version ) }
183
+ onConfirm : ( ) => { deleteFeedVersionConfirmed ( version ) }
163
184
} )
164
185
} }
165
186
>
@@ -176,17 +197,22 @@ export class VersionButtonToolbar extends Component {
176
197
177
198
class VersionSectionSelector extends Component {
178
199
static propTypes = {
200
+ validationJob : PropTypes . object ,
179
201
version : PropTypes . object ,
180
202
feedVersionIndex : PropTypes . number ,
181
203
versionSection : PropTypes . string
182
204
}
183
205
renderIssuesLabel ( version ) {
184
- const color = version . validationSummary . loadStatus !== 'SUCCESS'
206
+ const color = this . props . validationJob
207
+ ? 'warning'
208
+ : version . validationSummary . loadStatus !== 'SUCCESS'
185
209
? 'danger'
186
210
: version . validationSummary . errorCount
187
211
? 'warning'
188
212
: 'success'
189
- const text = version . validationSummary . loadStatus !== 'SUCCESS'
213
+ const text = this . props . validationJob
214
+ ? < span > processing < Icon className = 'fa-spin' type = 'refresh' /> </ span >
215
+ : version . validationSummary . loadStatus !== 'SUCCESS'
190
216
? 'critical error'
191
217
: version . validationSummary . errorCount
192
218
return (
0 commit comments