@@ -8,7 +8,7 @@ var UploadCsvBox = React.createClass({
88 hideListItems : "hidden" ,
99 hideErrorMessage : "hidden" ,
1010 errorMessage :'' ,
11- fileValue : ''
11+ fileValue : ''
1212 } ;
1313 } ,
1414
@@ -35,12 +35,14 @@ var UploadCsvBox = React.createClass({
3535 . then ( responseJson => {
3636 const not_found_batches = responseJson . not_found_batches ;
3737 const samples_nbr = responseJson . samples_nbr ;
38-
38+ const error_message = responseJson . error_message ;
39+
3940 // Create row from template with filename and upload info
4041 const filename = file . name ;
41- const uploadInfo = {
42+ const uploadInfo = {
4243 uploadedSamplesCount : samples_nbr ,
43- notFoundUuids : not_found_batches
44+ notFoundUuids : not_found_batches ,
45+ errorMessage : error_message
4446 } ;
4547
4648 // Add the new row to the state
@@ -88,30 +90,37 @@ var UploadCsvBox = React.createClass({
8890
8991 renderUploadRow : function ( rowData , index ) {
9092 const { filename, uploadInfo, showTooltip } = rowData ;
91- const { uploadedSamplesCount, notFoundUuids } = uploadInfo ;
93+ const { uploadedSamplesCount, notFoundUuids, errorMessage } = uploadInfo ;
9294 const batchesNotFound = notFoundUuids . length ;
9395 const batchesText = batchesNotFound == 1 ? 'batch' : 'batches' ;
9496 const samplesText = uploadedSamplesCount == 1 ? 'sample' : 'samples' ;
9597
9698 const tooltipText = notFoundUuids . slice ( 0 , 5 ) . map ( ( batch_number ) => < div > { batch_number } </ div > ) ;
9799
100+ const rowContent = errorMessage == "" ?
101+ < div className = "uploaded-samples-count" >
102+ { uploadedSamplesCount } { samplesText }
103+ { batchesNotFound > 0 && (
104+ < span className = "dashed-underline" >
105+ { " (" } { batchesNotFound } { batchesText } not found{ ")" }
106+ </ span >
107+ ) }
108+ </ div > :
109+ < div className = "uploaded-samples-count" >
110+ { errorMessage }
111+ </ div > ;
112+
113+
98114 return (
99115 < div className = "items-row" key = { filename } >
100116 < div className = "items-item gap-5" >
101117 < div className = "icon-circle-minus icon-gray remove_file" onClick = { ( ) => this . handleRemove ( index ) } > </ div >
102118 < div className = "file-name" > { filename } </ div >
103119 </ div >
104- < div className = { `items-row-action gap-5 not_found_message ${ batchesNotFound > 0 ? 'ttip input-required' : '' } ` }
120+ < div className = { `items-row-action gap-5 not_found_message ${ batchesNotFound > 0 ? ' ttip ' : ' ' } ${ batchesNotFound > 0 || errorMessage != "" ? ' input-required ' : ' ' } }` }
105121 onClick = { ( ) => this . handleClick ( index ) } >
106- < div className = "uploaded-samples-count" >
107- { uploadedSamplesCount } { samplesText }
108- { batchesNotFound > 0 && (
109- < span className = "dashed-underline" >
110- { " (" } { batchesNotFound } { batchesText } not found{ ")" }
111- </ span >
112- ) }
113- </ div >
114- < div className = { `upload-icon bigger ${ batchesNotFound > 0 ? 'icon-alert icon-red' : 'icon-check' } ` } > </ div >
122+ { rowContent }
123+ < div className = { `upload-icon bigger ${ batchesNotFound > 0 || errorMessage != "" ? 'icon-alert icon-red' : 'icon-check' } ` } > </ div >
115124 { batchesNotFound > 0 && (
116125 < div className = { `ttext not-found-uuids ${ showTooltip ? '' : 'hidden' } ` } >
117126 { tooltipText }
0 commit comments