Skip to content

Commit 86f9ce4

Browse files
clear selected defined export on any form changes (include few missing inputs)
1 parent 04a5a98 commit 86f9ce4

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

jsapp/js/components/projectDownloads/projectExportsCreator.es6

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,10 @@ export default class ProjectExportsCreator extends React.Component {
278278
}
279279

280280
onAnyInputChange(statePropName, newValue) {
281+
this.clearSelectedDefinedExport();
281282
const newStateObj = {};
282283
newStateObj[statePropName] = newValue;
283284
this.setState(newStateObj);
284-
this.clearSelectedDefinedExport();
285285
}
286286

287287
onSelectedExportTypeChange(newValue) {
@@ -290,6 +290,7 @@ export default class ProjectExportsCreator extends React.Component {
290290
}
291291

292292
onSelectedRowsChange(newRowsArray) {
293+
this.clearSelectedDefinedExport();
293294
const newSelectedRows = new Set();
294295
newRowsArray.forEach((item) => {
295296
if (item.checked) {
@@ -301,11 +302,13 @@ export default class ProjectExportsCreator extends React.Component {
301302

302303
selectAllRows(evt) {
303304
evt.preventDefault();
305+
this.clearSelectedDefinedExport();
304306
this.setState({selectedRows: new Set(this.getAllSelectableRows())});
305307
}
306308

307309
clearSelectedRows(evt) {
308310
evt.preventDefault();
311+
this.clearSelectedDefinedExport();
309312
this.setState({selectedRows: new Set()});
310313
}
311314

@@ -392,7 +395,8 @@ export default class ProjectExportsCreator extends React.Component {
392395
payload.name = this.state.customExportName || this.generateExportName();
393396
}
394397

395-
// unless custom selection is enabled, we send empty fields (it means "all fields" for backend)
398+
// unless custom selection is enabled, we send empty fields (it means "all
399+
// fields" for backend); otherwise we send the selected rows
396400
if (this.state.isCustomSelectionEnabled) {
397401
payload.export_settings.fields = Array.from(this.state.selectedRows);
398402
}
@@ -603,7 +607,10 @@ export default class ProjectExportsCreator extends React.Component {
603607
/>
604608

605609
<bem.ProjectDownloads__textButton
606-
disabled={!this.state.isCustomSelectionEnabled}
610+
disabled={(
611+
!this.state.isCustomSelectionEnabled ||
612+
this.state.selectedRows.size === this.state.selectableRowsCount
613+
)}
607614
onClick={this.selectAllRows}
608615
>
609616
{t('Select all')}
@@ -612,7 +619,10 @@ export default class ProjectExportsCreator extends React.Component {
612619
<span className='project-downloads__vr'/>
613620

614621
<bem.ProjectDownloads__textButton
615-
disabled={!this.state.isCustomSelectionEnabled}
622+
disabled={(
623+
!this.state.isCustomSelectionEnabled ||
624+
this.state.selectedRows.size === 0
625+
)}
616626
onClick={this.clearSelectedRows}
617627
>
618628
{t('Deselect all')}

0 commit comments

Comments
 (0)