@imposium-hub/components 1.42.4 → 1.42.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,6 +32,8 @@ interface IEmailWorkflowState {
32
32
  uploading : boolean;
33
33
  downloading : boolean;
34
34
  renderedBatch : boolean;
35
+ missingColumns : string;
36
+ isMissing : boolean;
35
37
  }
36
38
 
37
39
  class EmailWorkflow extends React.PureComponent<IEmailWorkflowProps, IEmailWorkflowState> {
@@ -55,10 +57,25 @@ class EmailWorkflow extends React.PureComponent<IEmailWorkflowProps, IEmailWorkf
55
57
  downloading : false,
56
58
  selectedBatchId: '',
57
59
  renderedBatch: false,
60
+ missingColumns: '',
61
+ isMissing: false,
58
62
  };
59
63
  this.hiddenFileInputRef = React.createRef();
60
64
  }
61
65
 
66
+ public componentDidUpdate() : void {
67
+ const { batchJobs : { missing }} = this.props;
68
+ if (missing.length >= 0 ) {
69
+ const missingColumn = Object.keys(missing).map((m) => missing[m]);
70
+ const showMissing = missingColumn.join();
71
+ this.setState({
72
+ uploadComplete: false,
73
+ missingColumns: showMissing,
74
+ isMissing: true,
75
+ });
76
+ }
77
+ }
78
+
62
79
  public downloadSampleCsv() {
63
80
 
64
81
  const {name} = this.props.story;
@@ -125,6 +142,7 @@ class EmailWorkflow extends React.PureComponent<IEmailWorkflowProps, IEmailWorkf
125
142
  }
126
143
 
127
144
  private importBatch({story_id, id, name, uploadEvt}) {
145
+ this.setState({ missingColumns: '', isMissing: false });
128
146
  const {accessKey, compositionId, isExport, handleError} = this.props;
129
147
  this.props.importBatchFromCsv(story_id, id, name, uploadEvt.target.files[0], accessKey, compositionId, !isExport, isExport)
130
148
  .then(() => {
@@ -196,7 +214,7 @@ class EmailWorkflow extends React.PureComponent<IEmailWorkflowProps, IEmailWorkf
196
214
  }
197
215
 
198
216
  public render() {
199
- const {uploadComplete, uploading, downloading, renderedBatch, selectedBatchId} = this.state;
217
+ const {uploadComplete, uploading, downloading, renderedBatch, selectedBatchId, missingColumns, isMissing} = this.state;
200
218
  const {isExport} = this.props;
201
219
 
202
220
  const emailOptions = [
@@ -230,6 +248,7 @@ class EmailWorkflow extends React.PureComponent<IEmailWorkflowProps, IEmailWorkf
230
248
  <h2>{copy.publish.emailTitle}</h2>
231
249
  <HRule/>
232
250
  <p>{copy.publish.emailDesc}</p>
251
+ {isMissing ? <><HRule/><p className='missingColumns'>{`${copy.publish.csvMissingColumns} ${missingColumns}`}</p></> : ''}
233
252
  <input
234
253
  type='file'
235
254
  style={{display: 'none'}}