Hidden member import validation messages bahind the experiments flag

refs e9cae26ed4

- The feature still needs polishing UI side and will move out of `enableDeveloperExperiments` flag once that's ready
This commit is contained in:
Nazar Gargol 2020-06-15 22:42:48 +12:00
parent b7fffecaed
commit d13a38c1e3
2 changed files with 20 additions and 14 deletions

View File

@ -21,6 +21,7 @@
<td class="red">Invalid:</td>
<td align="left" data-test-text="import-members-invalid" class="red">{{this.importResponse.invalid.count}}</td>
</tr>
{{#if this.config.enableDeveloperExperiments}}
<tr>
<td colspan="2">Details:</td>
</tr>
@ -30,6 +31,7 @@
<td>{{error.count}}</td>
</tr>
{{/each}}
{{/if}}
{{/if}}
</table>
</div>

View File

@ -14,6 +14,7 @@ import {run} from '@ember/runloop';
import {inject as service} from '@ember/service';
export default ModalComponent.extend({
config: service(),
ajax: service(),
notifications: service(),
memberImportValidator: service(),
@ -93,23 +94,26 @@ export default ModalComponent.extend({
this.set('file', file);
this.set('failureMessage', null);
papaparse.parse(file, {
header: true,
skipEmptyLines: true,
worker: true, // NOTE: compare speed and file sizes with/without this flag
complete: async (results) => {
this.set('fileData', results.data);
// TODO: remove "if" below once import validations are production ready
if (this.config.get('enableDeveloperExperiments')) {
papaparse.parse(file, {
header: true,
skipEmptyLines: true,
worker: true, // NOTE: compare speed and file sizes with/without this flag
complete: async (results) => {
this.set('fileData', results.data);
let result = await this.memberImportValidator.check(results.data);
let result = await this.memberImportValidator.check(results.data);
if (result !== true) {
this._importValidationFailed(result);
if (result !== true) {
this._importValidationFailed(result);
}
},
error: (error) => {
this._validationFailed(error);
}
},
error: (error) => {
this._validationFailed(error);
}
});
});
}
}
},