@@ -28,10 +28,21 @@ export default class FeedVersionViewer extends Component {
2828 notesRequested : PropTypes . func ,
2929 fetchValidationResult : PropTypes . func ,
3030 downloadFeedClicked : PropTypes . func ,
31- loadFeedVersionForEditing : PropTypes . func
31+ loadFeedVersionForEditing : PropTypes . func ,
32+ validationJob : PropTypes . object
3233 }
3334 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
3546 const messages = getComponentMessages ( 'FeedVersionViewer' )
3647
3748 if ( ! version ) return < p className = 'text-center lead' > { getMessage ( messages , 'noVersionsExist' ) } </ p >
@@ -61,37 +72,38 @@ export default class FeedVersionViewer extends Component {
6172 < Row >
6273 < Col xs = { 12 } sm = { 3 } >
6374 < 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 }
6779 />
6880 </ Col >
6981 < Col xs = { 12 } sm = { 9 } >
70- { ! this . props . versionSection
82+ { ! versionSection
7183 ? < FeedVersionReport
72- isPublished = { version . id === this . props . feedSource . publishedVersionId }
84+ isPublished = { version . id === feedSource . publishedVersionId }
7385 { ...this . props }
7486 />
75- : this . props . versionSection === 'issues'
87+ : versionSection === 'issues'
7688 ? < GtfsValidationViewer
7789 validationResult = { version . validationResult }
7890 version = { version }
79- fetchValidationResult = { ( ) => { this . props . fetchValidationResult ( version ) } }
91+ fetchValidationResult = { ( ) => { fetchValidationResult ( version ) } }
8092 />
81- : this . props . versionSection === 'gtfsplus' && isModuleEnabled ( 'gtfsplus' )
93+ : versionSection === 'gtfsplus' && isModuleEnabled ( 'gtfsplus' )
8294 ? < ActiveGtfsPlusVersionSummary
8395 version = { version }
8496 />
85- : this . props . versionSection === 'comments'
97+ : versionSection === 'comments'
8698 ? < NotesViewer
8799 type = 'feed-version'
88100 stacked
89- user = { this . props . user }
90- version = { this . props . version }
101+ user = { user }
102+ version = { version }
91103 notes = { version . notes }
92104 noteCount = { version . noteCount }
93- notesRequested = { ( ) => { this . props . notesRequested ( ) } }
94- newNotePosted = { ( note ) => { this . props . newNotePosted ( note ) } }
105+ notesRequested = { ( ) => { notesRequested ( ) } }
106+ newNotePosted = { ( note ) => { newNotePosted ( note ) } }
95107 />
96108 : null
97109 }
@@ -114,10 +126,19 @@ export class VersionButtonToolbar extends Component {
114126
115127 downloadFeedClicked : PropTypes . func ,
116128 deleteFeedVersionConfirmed : PropTypes . func ,
117- loadFeedVersionForEditing : PropTypes . func
129+ loadFeedVersionForEditing : PropTypes . func ,
130+ validationJob : PropTypes . object
118131 }
119132 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
121142 const messages = getComponentMessages ( 'FeedVersionViewer' )
122143 return (
123144 < div style = { { display : 'inline' } } >
@@ -127,21 +148,21 @@ export class VersionButtonToolbar extends Component {
127148 { /* "Download Feed" Button */ }
128149 < Button
129150 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 ) }
132153 >
133154 < Glyphicon glyph = 'download' /> < span className = 'hidden-xs' > { getMessage ( messages , 'download' ) } </ span > < span className = 'hidden-xs hidden-sm' > { getMessage ( messages , 'feed' ) } </ span >
134155 </ Button >
135156
136157 { /* "Load for Editing" Button */ }
137- { isModuleEnabled ( 'editor' ) && ! this . props . isPublic
158+ { isModuleEnabled ( 'editor' ) && ! isPublic
138159 ? < Button bsStyle = 'success'
139- disabled = { ! this . props . hasVersions }
160+ disabled = { ! hasVersions }
140161 onClick = { ( evt ) => {
141162 this . refs . confirm . open ( {
142163 title : getMessage ( messages , 'load' ) ,
143164 body : getMessage ( messages , 'confirmLoad' ) ,
144- onConfirm : ( ) => { this . props . loadFeedVersionForEditing ( version ) }
165+ onConfirm : ( ) => { loadFeedVersionForEditing ( version ) }
145166 } )
146167 } }
147168 >
@@ -151,15 +172,15 @@ export class VersionButtonToolbar extends Component {
151172 }
152173
153174 { /* "Delete Version" Button */ }
154- { ! this . props . isPublic
175+ { ! isPublic
155176 ? < Button
156177 bsStyle = 'danger'
157- disabled = { this . props . deleteDisabled || ! this . props . hasVersions || typeof this . props . deleteFeedVersionConfirmed === 'undefined' }
178+ disabled = { deleteDisabled || ! hasVersions || typeof deleteFeedVersionConfirmed === 'undefined' }
158179 onClick = { ( evt ) => {
159180 this . refs . confirm . open ( {
160181 title : `${ getMessage ( messages , 'delete' ) } ${ getMessage ( messages , 'version' ) } ` ,
161182 body : getMessage ( messages , 'confirmDelete' ) ,
162- onConfirm : ( ) => { this . props . deleteFeedVersionConfirmed ( version ) }
183+ onConfirm : ( ) => { deleteFeedVersionConfirmed ( version ) }
163184 } )
164185 } }
165186 >
@@ -176,17 +197,22 @@ export class VersionButtonToolbar extends Component {
176197
177198class VersionSectionSelector extends Component {
178199 static propTypes = {
200+ validationJob : PropTypes . object ,
179201 version : PropTypes . object ,
180202 feedVersionIndex : PropTypes . number ,
181203 versionSection : PropTypes . string
182204 }
183205 renderIssuesLabel ( version ) {
184- const color = version . validationSummary . loadStatus !== 'SUCCESS'
206+ const color = this . props . validationJob
207+ ? 'warning'
208+ : version . validationSummary . loadStatus !== 'SUCCESS'
185209 ? 'danger'
186210 : version . validationSummary . errorCount
187211 ? 'warning'
188212 : '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'
190216 ? 'critical error'
191217 : version . validationSummary . errorCount
192218 return (
0 commit comments