Show import validation only if more than 500 rows
[MAILPOET-1626]
This commit is contained in:
@@ -11,6 +11,34 @@ import Moment from 'moment';
|
|||||||
import sanitizeCSVData from './sanitize_csv_data.jsx';
|
import sanitizeCSVData from './sanitize_csv_data.jsx';
|
||||||
import StepInputValidation from './step_input_validation.jsx';
|
import StepInputValidation from './step_input_validation.jsx';
|
||||||
|
|
||||||
|
const SUBSCRIBERS_LIMIT_FOR_VALIDATION = 500;
|
||||||
|
|
||||||
|
function getMethodSelectionNextStepLink(importData) {
|
||||||
|
if (importData === undefined) {
|
||||||
|
return 'step_data_manipulation';
|
||||||
|
}
|
||||||
|
if (importData.subscribersCount === undefined) {
|
||||||
|
return 'step_data_manipulation';
|
||||||
|
}
|
||||||
|
if (importData.subscribersCount < SUBSCRIBERS_LIMIT_FOR_VALIDATION) {
|
||||||
|
return 'step_data_manipulation';
|
||||||
|
}
|
||||||
|
return 'step_input_validation';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDataManipulationPreviousStepLink(importData) {
|
||||||
|
if (importData === undefined) {
|
||||||
|
return 'step_method_selection';
|
||||||
|
}
|
||||||
|
if (importData.subscribersCount === undefined) {
|
||||||
|
return 'step_method_selection';
|
||||||
|
}
|
||||||
|
if (importData.subscribersCount < SUBSCRIBERS_LIMIT_FOR_VALIDATION) {
|
||||||
|
return 'step_method_selection';
|
||||||
|
}
|
||||||
|
return 'step_input_validation';
|
||||||
|
}
|
||||||
|
|
||||||
jQuery(document).ready(() => {
|
jQuery(document).ready(() => {
|
||||||
if (!jQuery('#mailpoet_subscribers_import').length) {
|
if (!jQuery('#mailpoet_subscribers_import').length) {
|
||||||
return;
|
return;
|
||||||
@@ -116,7 +144,10 @@ jQuery(document).ready(() => {
|
|||||||
source: isFile ? 'file upload' : 'pasted data',
|
source: isFile ? 'file upload' : 'pasted data',
|
||||||
'MailPoet Free version': window.mailpoet_version,
|
'MailPoet Free version': window.mailpoet_version,
|
||||||
});
|
});
|
||||||
router.navigate('step_input_validation', { trigger: true });
|
router.navigate(
|
||||||
|
getMethodSelectionNextStepLink(window.importData.step_method_selection),
|
||||||
|
{ trigger: true }
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
MailPoet.Modal.loading(false);
|
MailPoet.Modal.loading(false);
|
||||||
let errorNotice = MailPoet.I18n.t('noValidRecords');
|
let errorNotice = MailPoet.I18n.t('noValidRecords');
|
||||||
@@ -295,7 +326,7 @@ jQuery(document).ready(() => {
|
|||||||
source: 'MailChimp',
|
source: 'MailChimp',
|
||||||
'MailPoet Free version': window.mailpoet_version,
|
'MailPoet Free version': window.mailpoet_version,
|
||||||
});
|
});
|
||||||
router.navigate('step_input_validation', { trigger: true });
|
router.navigate('step_data_manipulation', { trigger: true });
|
||||||
}).fail((response) => {
|
}).fail((response) => {
|
||||||
if (response.errors.length > 0) {
|
if (response.errors.length > 0) {
|
||||||
MailPoet.Notice.error(
|
MailPoet.Notice.error(
|
||||||
@@ -319,6 +350,7 @@ jQuery(document).ready(() => {
|
|||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<StepInputValidation
|
<StepInputValidation
|
||||||
navigate={router.navigate}
|
navigate={router.navigate}
|
||||||
|
importData={window.importData.step_method_selection}
|
||||||
/>,
|
/>,
|
||||||
container
|
container
|
||||||
);
|
);
|
||||||
@@ -841,7 +873,10 @@ jQuery(document).ready(() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
previousStepButton.off().on('click', () => {
|
previousStepButton.off().on('click', () => {
|
||||||
router.navigate('step_input_validation', { trigger: true });
|
router.navigate(
|
||||||
|
getDataManipulationPreviousStepLink(window.importData.step_method_selection),
|
||||||
|
{ trigger: true }
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
nextStepButton.off().on('click', (event) => {
|
nextStepButton.off().on('click', (event) => {
|
||||||
|
@@ -17,12 +17,6 @@ class SubscriberManageImportExportCest {
|
|||||||
$I->attachFile('[data-automation-id="import-file-upload-input"]', 'MailPoetImportList.csv');
|
$I->attachFile('[data-automation-id="import-file-upload-input"]', 'MailPoetImportList.csv');
|
||||||
$I->click('#method_file [data-automation-id="import-next-step"]');
|
$I->click('#method_file [data-automation-id="import-next-step"]');
|
||||||
|
|
||||||
// input validation step
|
|
||||||
$I->click('[data-automation-id="subscribers_agreed"]');
|
|
||||||
$I->click('[data-automation-id="sent_once_last_year"]');
|
|
||||||
$I->click('[data-automation-id="input_understand"]');
|
|
||||||
$I->click('#step_input_validation [data-automation-id="import-next-step"]');
|
|
||||||
|
|
||||||
//click is to trigger dropdown to display selections
|
//click is to trigger dropdown to display selections
|
||||||
$I->click('input.select2-search__field');
|
$I->click('input.select2-search__field');
|
||||||
//choose My First List
|
//choose My First List
|
||||||
|
Reference in New Issue
Block a user