Work in progress on confirmation dialogs displayed when one navigates from a page with unsaved changes.

Optimized imports.
This commit is contained in:
Tomas Bures 2019-05-08 23:45:48 +02:00
parent 48dcf2c701
commit 3921a6b2cb
76 changed files with 540 additions and 1291 deletions

View file

@ -3,17 +3,9 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import {Trans} from 'react-i18next'; import {Trans} from 'react-i18next';
import { import {requiresAuthenticatedUser, Title, withPageHelpers} from '../lib/page'
requiresAuthenticatedUser, import {withAsyncErrorHandler, withErrorHandling} from '../lib/error-handling';
Title, import axios from '../lib/axios';
withPageHelpers
} from '../lib/page'
import {
withAsyncErrorHandler,
withErrorHandling
} from '../lib/error-handling';
import axios
from '../lib/axios';
import {Button} from '../lib/bootstrap-components'; import {Button} from '../lib/bootstrap-components';
import {getUrl} from "../lib/urls"; import {getUrl} from "../lib/urls";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";

View file

@ -3,30 +3,22 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import {Trans} from 'react-i18next'; import {Trans} from 'react-i18next';
import { import {requiresAuthenticatedUser, Title, withPageHelpers} from '../lib/page'
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../lib/page'
import { import {
Button, Button,
ButtonRow, ButtonRow,
Fieldset, Fieldset,
filterData,
Form, Form,
FormSendMethod, FormSendMethod,
InputField, InputField,
withForm withForm,
withFormErrorHandlers
} from '../lib/form'; } from '../lib/form';
import { import {withAsyncErrorHandler, withErrorHandling} from '../lib/error-handling';
withAsyncErrorHandler, import passwordValidator from '../../../shared/password-validator';
withErrorHandling import interoperableErrors from '../../../shared/interoperable-errors';
} from '../lib/error-handling'; import mailtrainConfig from 'mailtrainConfig';
import passwordValidator
from '../../../shared/password-validator';
import interoperableErrors
from '../../../shared/interoperable-errors';
import mailtrainConfig
from 'mailtrainConfig';
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([
@ -45,6 +37,8 @@ export default class Account extends Component {
this.state = {}; this.state = {};
this.initForm({ this.initForm({
loadMutator: ::this.getFormValuesMutator,
submitMutator: ::this.submitFormValuesMutator,
serverValidation: { serverValidation: {
url: 'rest/account-validate', url: 'rest/account-validate',
changed: ['email', 'currentPassword'] changed: ['email', 'currentPassword']
@ -52,13 +46,19 @@ export default class Account extends Component {
}); });
} }
getFormValuesMutator(data) {
data.password = '';
data.password2 = '';
data.currentPassword = '';
}
submitFormValuesMutator(data) {
return filterData(data, ['name', 'email', 'password', 'currentPassword']);
}
@withAsyncErrorHandler @withAsyncErrorHandler
async loadFormValues() { async loadFormValues() {
await this.getFormValuesFromURL('rest/account', data => { await this.getFormValuesFromURL('rest/account');
data.password = '';
data.password2 = '';
data.currentPassword = '';
});
} }
componentDidMount() { componentDidMount() {
@ -127,6 +127,7 @@ export default class Account extends Component {
state.setIn(['password2', 'error'], password !== password2 ? t('passwordsMustMatch') : null); state.setIn(['password2', 'error'], password !== password2 ? t('passwordsMustMatch') : null);
} }
@withFormErrorHandlers
async submitHandler() { async submitHandler() {
const t = this.props.t; const t = this.props.t;
@ -134,9 +135,7 @@ export default class Account extends Component {
this.disableForm(); this.disableForm();
this.setFormStatusMessage('info', t('updatingUserProfile')); this.setFormStatusMessage('info', t('updatingUserProfile'));
const submitSuccessful = await this.validateAndSendFormValuesToURL(FormSendMethod.POST, 'rest/account', data => { const submitSuccessful = await this.validateAndSendFormValuesToURL(FormSendMethod.POST, 'rest/account');
delete data.password2;
});
if (submitSuccessful) { if (submitSuccessful) {
this.setFlashMessage('success', t('userProfileUpdated')); this.setFlashMessage('success', t('userProfileUpdated'));

View file

@ -1,11 +1,8 @@
'use strict'; 'use strict';
import React import React from 'react';
from 'react'; import Account from './Account';
import Account import API from './API';
from './Account';
import API
from './API';
function getMenus(t) { function getMenus(t) {

View file

@ -1,19 +1,14 @@
'use strict'; 'use strict';
import React, {Component} from "react"; import React, {Component} from "react";
import { withTranslation } from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import {requiresAuthenticatedUser, Title, withPageHelpers} from "../lib/page"; import {requiresAuthenticatedUser, Title, withPageHelpers} from "../lib/page";
import {withAsyncErrorHandler, withErrorHandling} from "../lib/error-handling"; import {withErrorHandling} from "../lib/error-handling";
import {Table} from "../lib/table"; import {Table} from "../lib/table";
import {ButtonRow, Form, InputField, withForm, FormSendMethod} from "../lib/form"; import {ButtonRow, Form, FormSendMethod, InputField, withForm} from "../lib/form";
import {Button, Icon} from "../lib/bootstrap-components"; import {Button} from "../lib/bootstrap-components";
import axios, {HTTPMethod} from "../lib/axios"; import {HTTPMethod} from "../lib/axios";
import {getUrl} from "../lib/urls"; import {tableAddRestActionButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../lib/modals";
import {
tableAddRestActionButton,
tableRestActionDialogInit,
tableRestActionDialogRender
} from "../lib/modals";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -1,15 +1,9 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, withPageHelpers} from '../lib/page'
LinkButton,
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../lib/page'
import { import {
AlignedRow, AlignedRow,
Button, Button,
@ -17,45 +11,27 @@ import {
CheckBox, CheckBox,
Dropdown, Dropdown,
Fieldset, Fieldset,
filterData,
Form, Form,
FormSendMethod, FormSendMethod,
InputField, InputField,
StaticField, StaticField,
TableSelect, TableSelect,
TextArea, TextArea,
withForm withForm,
withFormErrorHandlers
} from '../lib/form'; } from '../lib/form';
import { import {withAsyncErrorHandler, withErrorHandling} from '../lib/error-handling';
withAsyncErrorHandler, import {NamespaceSelect, validateNamespace} from '../lib/namespace';
withErrorHandling
} from '../lib/error-handling';
import {
NamespaceSelect,
validateNamespace
} from '../lib/namespace';
import {DeleteModalDialog} from "../lib/modals"; import {DeleteModalDialog} from "../lib/modals";
import mailtrainConfig import mailtrainConfig from 'mailtrainConfig';
from 'mailtrainConfig'; import {getTemplateTypes, getTypeForm, ResourceType} from '../templates/helpers';
import { import axios from '../lib/axios';
getTemplateTypes, import styles from "../lib/styles.scss";
getTypeForm, import campaignsStyles from "./styles.scss";
ResourceType
} from '../templates/helpers';
import axios
from '../lib/axios';
import styles
from "../lib/styles.scss";
import campaignsStyles
from "./styles.scss";
import {getUrl} from "../lib/urls"; import {getUrl} from "../lib/urls";
import { import {campaignOverridables, CampaignSource, CampaignStatus, CampaignType} from "../../../shared/campaigns";
campaignOverridables, import moment from 'moment';
CampaignSource,
CampaignStatus,
CampaignType
} from "../../../shared/campaigns";
import moment
from 'moment';
import {getMailerTypes} from "../send-configurations/helpers"; import {getMailerTypes} from "../send-configurations/helpers";
import {getCampaignLabels} from "./helpers"; import {getCampaignLabels} from "./helpers";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
@ -116,6 +92,8 @@ export default class CUD extends Component {
this.nextListEntryId = 0; this.nextListEntryId = 0;
this.initForm({ this.initForm({
loadMutator: ::this.getFormValuesMutator,
submitMutator: ::this.submitFormValuesMutator,
onChange: { onChange: {
send_configuration: ::this.onSendConfigurationChanged send_configuration: ::this.onSendConfigurationChanged
}, },
@ -200,9 +178,76 @@ export default class CUD extends Component {
this.fetchSendConfiguration(data.send_configuration); this.fetchSendConfiguration(data.send_configuration);
} }
submitFormValuesMutator(data) {
const isEdit = !!this.props.entity;
data.source = Number.parseInt(data.source);
data.data = {};
if (data.source === CampaignSource.TEMPLATE || data.source === CampaignSource.CUSTOM_FROM_TEMPLATE) {
data.data.sourceTemplate = data.data_sourceTemplate;
}
if (data.source === CampaignSource.CUSTOM_FROM_CAMPAIGN) {
data.data.sourceCampaign = data.data_sourceCampaign;
}
if (!isEdit && data.source === CampaignSource.CUSTOM) {
this.templateTypes[data.data_sourceCustom_type].beforeSave(data);
data.data.sourceCustom = {
type: data.data_sourceCustom_type,
data: data.data_sourceCustom_data,
html: data.data_sourceCustom_html,
text: data.data_sourceCustom_text
}
}
if (data.source === CampaignSource.URL) {
data.data.sourceUrl = data.data_sourceUrl;
}
if (data.type === CampaignType.RSS) {
data.data.feedUrl = data.data_feedUrl;
}
for (const overridable of campaignOverridables) {
if (!data[overridable + '_overriden']) {
data[overridable + '_override'] = null;
}
delete data[overridable + '_overriden'];
}
const lsts = [];
for (const lstUid of data.lists) {
const prefix = 'lists_' + lstUid + '_';
const useSegmentation = data[prefix + 'useSegmentation'] && (data.type === CampaignType.REGULAR || data.type === CampaignType.RSS);
lsts.push({
list: data[prefix + 'list'],
segment: useSegmentation ? data[prefix + 'segment'] : null
});
}
data.lists = lsts;
for (const key in data) {
if (key.startsWith('data_') || key.startsWith('lists_')) {
delete data[key];
}
}
return filterData(data, [
'name', 'description', 'segment', 'namespace', 'send_configuration',
'from_name_override', 'from_email_override', 'reply_to_override', 'subject_override',
'data', 'click_tracking_disabled', 'open_tracking_disabled', 'unsubscribe_url',
'type', 'source', 'parent', 'lists'
]);
}
componentDidMount() { componentDidMount() {
if (this.props.entity) { if (this.props.entity) {
this.getFormValuesFromEntity(this.props.entity, ::this.getFormValuesMutator); this.getFormValuesFromEntity(this.props.entity);
if (this.props.entity.status === CampaignStatus.SENDING) { if (this.props.entity.status === CampaignStatus.SENDING) {
this.disableForm(); this.disableForm();
@ -345,8 +390,8 @@ export default class CUD extends Component {
STATUS: 2 STATUS: 2
} }
@withFormErrorHandlers
async submitHandler(afterSubmitAction) { async submitHandler(afterSubmitAction) {
const isEdit = !!this.props.entity;
const t = this.props.t; const t = this.props.t;
let sendMethod, url; let sendMethod, url;
@ -361,63 +406,7 @@ export default class CUD extends Component {
this.disableForm(); this.disableForm();
this.setFormStatusMessage('info', t('saving')); this.setFormStatusMessage('info', t('saving'));
const submitResult = await this.validateAndSendFormValuesToURL(sendMethod, url, data => { const submitResult = await this.validateAndSendFormValuesToURL(sendMethod, url);
data.source = Number.parseInt(data.source);
data.data = {};
if (data.source === CampaignSource.TEMPLATE || data.source === CampaignSource.CUSTOM_FROM_TEMPLATE) {
data.data.sourceTemplate = data.data_sourceTemplate;
}
if (data.source === CampaignSource.CUSTOM_FROM_CAMPAIGN) {
data.data.sourceCampaign = data.data_sourceCampaign;
}
if (!isEdit && data.source === CampaignSource.CUSTOM) {
this.templateTypes[data.data_sourceCustom_type].beforeSave(data);
data.data.sourceCustom = {
type: data.data_sourceCustom_type,
data: data.data_sourceCustom_data,
html: data.data_sourceCustom_html,
text: data.data_sourceCustom_text
}
}
if (data.source === CampaignSource.URL) {
data.data.sourceUrl = data.data_sourceUrl;
}
if (data.type === CampaignType.RSS) {
data.data.feedUrl = data.data_feedUrl;
}
for (const overridable of campaignOverridables) {
if (!data[overridable + '_overriden']) {
data[overridable + '_override'] = null;
}
delete data[overridable + '_overriden'];
}
const lsts = [];
for (const lstUid of data.lists) {
const prefix = 'lists_' + lstUid + '_';
const useSegmentation = data[prefix + 'useSegmentation'] && (data.type === CampaignType.REGULAR || data.type === CampaignType.RSS);
lsts.push({
list: data[prefix + 'list'],
segment: useSegmentation ? data[prefix + 'segment'] : null
});
}
data.lists = lsts;
for (const key in data) {
if (key.startsWith('data_') || key.startsWith('lists_')) {
delete data[key];
}
}
});
if (submitResult) { if (submitResult) {
if (this.props.entity) { if (this.props.entity) {
@ -426,7 +415,7 @@ export default class CUD extends Component {
} else if (afterSubmitAction === CUD.AfterSubmitAction.LEAVE) { } else if (afterSubmitAction === CUD.AfterSubmitAction.LEAVE) {
this.navigateToWithFlashMessage('/campaigns', 'success', t('Campaign updated')); this.navigateToWithFlashMessage('/campaigns', 'success', t('Campaign updated'));
} else { } else {
await this.getFormValuesFromURL(`rest/campaigns-settings/${this.props.entity.id}`, ::this.getFormValuesMutator); await this.getFormValuesFromURL(`rest/campaigns-settings/${this.props.entity.id}`);
this.enableForm(); this.enableForm();
this.setFormStatusMessage('success', t('Campaign updated')); this.setFormStatusMessage('success', t('Campaign updated'));
} }

View file

@ -1,35 +1,24 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {requiresAuthenticatedUser, Title, withPageHelpers} from '../lib/page'
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../lib/page'
import { import {
Button, Button,
ButtonRow, ButtonRow,
filterData,
Form, Form,
FormSendMethod, FormSendMethod,
StaticField, StaticField,
withForm withForm,
withFormErrorHandlers
} from '../lib/form'; } from '../lib/form';
import {withErrorHandling} from '../lib/error-handling'; import {withErrorHandling} from '../lib/error-handling';
import mailtrainConfig import mailtrainConfig from 'mailtrainConfig';
from 'mailtrainConfig'; import {getEditForm, getTemplateTypes, getTypeForm, ResourceType} from '../templates/helpers';
import { import axios from '../lib/axios';
getEditForm, import styles from "../lib/styles.scss";
getTemplateTypes,
getTypeForm,
ResourceType
} from '../templates/helpers';
import axios
from '../lib/axios';
import styles
from "../lib/styles.scss";
import {getUrl} from "../lib/urls"; import {getUrl} from "../lib/urls";
import {TestSendModalDialog} from "./TestSendModalDialog"; import {TestSendModalDialog} from "./TestSendModalDialog";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
@ -65,7 +54,11 @@ export default class CustomContent extends Component {
exportModalTitle: '' exportModalTitle: ''
}; };
this.initForm(); this.initForm({
loadMutator: ::this.getFormValuesMutator,
submitMutator: ::this.submitFormValuesMutator,
getPreSubmitUpdater: ::this.getPreSubmitFormValuesUpdater,
});
this.sendModalGetDataHandler = ::this.sendModalGetData; this.sendModalGetDataHandler = ::this.sendModalGetData;
this.exportModalGetContentHandler = ::this.exportModalGetContent; this.exportModalGetContentHandler = ::this.exportModalGetContent;
@ -90,9 +83,32 @@ export default class CustomContent extends Component {
this.templateTypes[data.data.sourceCustom.type].afterLoad(data); this.templateTypes[data.data.sourceCustom.type].afterLoad(data);
} }
submitFormValuesMutator(data) {
this.templateTypes[data.data_sourceCustom_type].beforeSave(data);
data.data.sourceCustom = {
type: data.data_sourceCustom_type,
data: data.data_sourceCustom_data,
html: data.data_sourceCustom_html,
text: data.data_sourceCustom_text
};
return filterData(data, ['data']);
}
async getPreSubmitFormValuesUpdater() {
const customTemplateTypeKey = this.getFormValue('data_sourceCustom_type');
const exportedData = await this.templateTypes[customTemplateTypeKey].exportHTMLEditorData(this);
return mutStateData => {
for (const key in exportedData) {
mutStateData.setIn([key, 'value'], exportedData[key]);
}
};
}
componentDidMount() { componentDidMount() {
this.getFormValuesFromEntity(this.props.entity, ::this.getFormValuesMutator); this.getFormValuesFromEntity(this.props.entity);
} }
localValidateFormValues(state) { localValidateFormValues(state) {
@ -115,35 +131,17 @@ export default class CustomContent extends Component {
STATUS: 2 STATUS: 2
} }
@withFormErrorHandlers
async submitHandler(afterSubmitAction) { async submitHandler(afterSubmitAction) {
const t = this.props.t; const t = this.props.t;
const customTemplateTypeKey = this.getFormValue('data_sourceCustom_type');
const exportedData = await this.templateTypes[customTemplateTypeKey].exportHTMLEditorData(this);
const sendMethod = FormSendMethod.PUT; const sendMethod = FormSendMethod.PUT;
const url = `rest/campaigns-content/${this.props.entity.id}`; const url = `rest/campaigns-content/${this.props.entity.id}`;
this.disableForm(); this.disableForm();
this.setFormStatusMessage('info', t('saving')); this.setFormStatusMessage('info', t('saving'));
const submitResult = await this.validateAndSendFormValuesToURL(sendMethod, url, data => { const submitResult = await this.validateAndSendFormValuesToURL(sendMethod, url);
Object.assign(data, exportedData);
this.templateTypes[data.data_sourceCustom_type].beforeSave(data);
data.data.sourceCustom = {
type: data.data_sourceCustom_type,
data: data.data_sourceCustom_data,
html: data.data_sourceCustom_html,
text: data.data_sourceCustom_text
};
for (const key in data) {
if (key.startsWith('data_')) {
delete data[key];
}
}
});
if (submitResult) { if (submitResult) {
if (afterSubmitAction === CustomContent.AfterSubmitAction.STATUS) { if (afterSubmitAction === CustomContent.AfterSubmitAction.STATUS) {
@ -151,7 +149,7 @@ export default class CustomContent extends Component {
} else if (afterSubmitAction === CustomContent.AfterSubmitAction.LEAVE) { } else if (afterSubmitAction === CustomContent.AfterSubmitAction.LEAVE) {
this.navigateToWithFlashMessage('/campaigns', 'success', t('Campaign updated')); this.navigateToWithFlashMessage('/campaigns', 'success', t('Campaign updated'));
} else { } else {
await this.getFormValuesFromURL(`rest/campaigns-content/${this.props.entity.id}`, ::this.getFormValuesMutator); await this.getFormValuesFromURL(`rest/campaigns-content/${this.props.entity.id}`);
this.enableForm(); this.enableForm();
this.setFormStatusMessage('success', t('Campaign updated')); this.setFormStatusMessage('success', t('Campaign updated'));
} }

View file

@ -1,14 +1,9 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {requiresAuthenticatedUser, Title, withPageHelpers} from '../lib/page';
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../lib/page';
import {withErrorHandling} from '../lib/error-handling'; import {withErrorHandling} from '../lib/error-handling';
import {Table} from "../lib/table"; import {Table} from "../lib/table";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";

View file

@ -1,32 +1,20 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {requiresAuthenticatedUser, Title, withPageHelpers} from '../lib/page';
requiresAuthenticatedUser, import {withAsyncErrorHandler, withErrorHandling} from '../lib/error-handling';
Title, import axios from "../lib/axios";
withPageHelpers
} from '../lib/page';
import {
withAsyncErrorHandler,
withErrorHandling
} from '../lib/error-handling';
import axios
from "../lib/axios";
import {getUrl} from "../lib/urls"; import {getUrl} from "../lib/urls";
import Chart import Chart from 'react-google-charts';
from 'react-google-charts';
import styles import styles from "./styles.scss";
from "./styles.scss";
import {Table} from "../lib/table"; import {Table} from "../lib/table";
import {Link} from "react-router-dom"; import {Link} from "react-router-dom";
import mailtrainConfig import mailtrainConfig from "mailtrainConfig";
from "mailtrainConfig";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -1,14 +1,9 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {requiresAuthenticatedUser, Title, withPageHelpers} from '../lib/page';
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../lib/page';
import {withErrorHandling} from '../lib/error-handling'; import {withErrorHandling} from '../lib/error-handling';
import {Table} from "../lib/table"; import {Table} from "../lib/table";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";

View file

@ -1,52 +1,20 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, withPageHelpers} from '../lib/page';
LinkButton, import {AlignedRow, ButtonRow, CheckBox, DatePicker, Form, InputField, TableSelect, withForm} from '../lib/form';
requiresAuthenticatedUser, import {withAsyncErrorHandler, withErrorHandling} from '../lib/error-handling';
Title,
withPageHelpers
} from '../lib/page';
import {
AlignedRow,
ButtonRow,
CheckBox,
DatePicker,
Form,
InputField,
TableSelect,
withForm
} from '../lib/form';
import {
withAsyncErrorHandler,
withErrorHandling
} from '../lib/error-handling';
import {getCampaignLabels} from './helpers'; import {getCampaignLabels} from './helpers';
import {Table} from "../lib/table"; import {Table} from "../lib/table";
import { import {Button, Icon, ModalDialog} from "../lib/bootstrap-components";
Button, import axios from "../lib/axios";
Icon, import {getPublicUrl, getUrl} from "../lib/urls";
ModalDialog import interoperableErrors from '../../../shared/interoperable-errors';
} from "../lib/bootstrap-components"; import {CampaignStatus, CampaignType} from "../../../shared/campaigns";
import axios import moment from 'moment';
from "../lib/axios"; import campaignsStyles from "./styles.scss";
import {
getPublicUrl,
getUrl
} from "../lib/urls";
import interoperableErrors
from '../../../shared/interoperable-errors';
import {
CampaignStatus,
CampaignType
} from "../../../shared/campaigns";
import moment
from 'moment';
import campaignsStyles
from "./styles.scss";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";

View file

@ -2,22 +2,13 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {ModalDialog} from "../lib/bootstrap-components"; import {ModalDialog} from "../lib/bootstrap-components";
import { import {requiresAuthenticatedUser, withPageHelpers} from "../lib/page";
requiresAuthenticatedUser, import {Form, TableSelect, withForm} from "../lib/form";
withPageHelpers
} from "../lib/page";
import {
Form,
TableSelect,
withForm
} from "../lib/form";
import {withErrorHandling} from "../lib/error-handling"; import {withErrorHandling} from "../lib/error-handling";
import {getMailerTypes} from "../send-configurations/helpers"; import {getMailerTypes} from "../send-configurations/helpers";
import axios import axios from '../lib/axios';
from '../lib/axios';
import {getUrl} from '../lib/urls'; import {getUrl} from '../lib/urls';
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";

View file

@ -1,9 +1,6 @@
'use strict'; 'use strict';
import { import {CampaignStatus, CampaignType} from "../../../shared/campaigns";
CampaignStatus,
CampaignType
} from "../../../shared/campaigns";
export function getCampaignLabels(t) { export function getCampaignLabels(t) {

View file

@ -1,39 +1,21 @@
'use strict'; 'use strict';
import React import React from 'react';
from 'react';
import Status import Status from './Status';
from './Status'; import Statistics from './Statistics';
import Statistics import CampaignsCUD from './CUD';
from './Statistics'; import Content from './Content';
import CampaignsCUD import CampaignsList from './List';
from './CUD'; import Share from '../shares/Share';
import Content import Files from "../lib/files";
from './Content'; import {CampaignSource, CampaignType} from "../../../shared/campaigns";
import CampaignsList import TriggersCUD from './triggers/CUD';
from './List'; import TriggersList from './triggers/List';
import Share import StatisticsSubsList from "./StatisticsSubsList";
from '../shares/Share';
import Files
from "../lib/files";
import {
CampaignSource,
CampaignStatus,
CampaignType
} from "../../../shared/campaigns";
import TriggersCUD
from './triggers/CUD';
import TriggersList
from './triggers/List';
import StatisticsSubsList
from "./StatisticsSubsList";
import {SubscriptionStatus} from "../../../shared/lists"; import {SubscriptionStatus} from "../../../shared/lists";
import StatisticsOpened import StatisticsOpened from "./StatisticsOpened";
from "./StatisticsOpened"; import StatisticsLinkClicks from "./StatisticsLinkClicks";
import StatisticsLinkClicks
from "./StatisticsLinkClicks";
import TemplatesCUD from "../templates/root";
import {ellipsizeBreadcrumbLabel} from "../lib/helpers" import {ellipsizeBreadcrumbLabel} from "../lib/helpers"
function getMenus(t) { function getMenus(t) {

View file

@ -1,15 +1,9 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, withPageHelpers} from '../../lib/page';
LinkButton,
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../../lib/page';
import { import {
AlignedRow, AlignedRow,
Button, Button,
@ -26,12 +20,8 @@ import {
import {withErrorHandling} from '../../lib/error-handling'; import {withErrorHandling} from '../../lib/error-handling';
import {DeleteModalDialog} from "../../lib/modals"; import {DeleteModalDialog} from "../../lib/modals";
import {getTriggerTypes} from './helpers'; import {getTriggerTypes} from './helpers';
import { import {Entity, Event} from '../../../../shared/triggers';
Entity, import moment from 'moment';
Event
} from '../../../../shared/triggers';
import moment
from 'moment';
import {getCampaignLabels} from "../helpers"; import {getCampaignLabels} from "../helpers";
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";

View file

@ -1,27 +1,15 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, Toolbar, withPageHelpers} from '../../lib/page';
LinkButton,
requiresAuthenticatedUser,
Title,
Toolbar,
withPageHelpers
} from '../../lib/page';
import {withErrorHandling} from '../../lib/error-handling'; import {withErrorHandling} from '../../lib/error-handling';
import {Table} from '../../lib/table'; import {Table} from '../../lib/table';
import {getTriggerTypes} from './helpers'; import {getTriggerTypes} from './helpers';
import {Icon} from "../../lib/bootstrap-components"; import {Icon} from "../../lib/bootstrap-components";
import mailtrainConfig import mailtrainConfig from 'mailtrainConfig';
from 'mailtrainConfig'; import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../../lib/modals";
import {
tableAddDeleteButton,
tableRestActionDialogInit,
tableRestActionDialogRender
} from "../../lib/modals";
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -2,12 +2,8 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from './i18n'; import {withTranslation} from './i18n';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types'; import {withAsyncErrorHandler, withErrorHandling} from './error-handling';
import {
withAsyncErrorHandler,
withErrorHandling
} from './error-handling';
import {withComponentMixins} from "./decorator-helpers"; import {withComponentMixins} from "./decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -1,7 +1,6 @@
'use strict'; 'use strict';
import React from "react"; import React from "react";
import PropTypes from 'prop-types';
import {createComponentMixin} from "./decorator-helpers"; import {createComponentMixin} from "./decorator-helpers";
function handleError(that, error) { function handleError(that, error) {

View file

@ -1,30 +1,16 @@
'use strict'; 'use strict';
import React, {Component} from "react"; import React, {Component} from "react";
import PropTypes import PropTypes from "prop-types";
from "prop-types";
import {withTranslation} from './i18n'; import {withTranslation} from './i18n';
import { import {requiresAuthenticatedUser, Title, withPageHelpers} from "./page";
requiresAuthenticatedUser,
Title,
withPageHelpers
} from "./page";
import {withErrorHandling} from "./error-handling"; import {withErrorHandling} from "./error-handling";
import {Table} from "./table"; import {Table} from "./table";
import Dropzone import Dropzone from "react-dropzone";
from "react-dropzone"; import {Icon, ModalDialog} from "./bootstrap-components";
import { import axios from './axios';
Icon, import styles from "./styles.scss";
ModalDialog import {getPublicUrl, getUrl} from "./urls";
} from "./bootstrap-components";
import axios
from './axios';
import styles
from "./styles.scss";
import {
getPublicUrl,
getUrl
} from "./urls";
import {withComponentMixins} from "./decorator-helpers"; import {withComponentMixins} from "./decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -1,13 +1,10 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React from 'react';
import i18n import i18n from 'i18next';
from 'i18next';
import {withNamespaces} from "react-i18next"; import {withNamespaces} from "react-i18next";
import LanguageDetector import LanguageDetector from 'i18next-browser-languagedetector';
from 'i18next-browser-languagedetector'; import mailtrainConfig from 'mailtrainConfig';
import mailtrainConfig
from 'mailtrainConfig';
import {convertToFake, getLang} from '../../../shared/langs'; import {convertToFake, getLang} from '../../../shared/langs';
import {createComponentMixin} from "./decorator-helpers"; import {createComponentMixin} from "./decorator-helpers";

View file

@ -1,8 +1,8 @@
'use strict'; 'use strict';
import { mergeWith, isArray } from 'lodash'; import {isArray, mergeWith} from 'lodash';
import kebabCase from 'lodash/kebabCase'; import kebabCase from 'lodash/kebabCase';
import mjml2html, {defaultSkeleton, BodyComponent, HeadComponent, components, dependencies} from "mjml4-in-browser"; import mjml2html, {BodyComponent, components, defaultSkeleton, dependencies, HeadComponent} from "mjml4-in-browser";
export { BodyComponent, HeadComponent }; export { BodyComponent, HeadComponent };

View file

@ -3,30 +3,16 @@
import './public-path'; import './public-path';
import React, {Component} from 'react'; import React, {Component} from 'react';
import ReactDOM import ReactDOM from 'react-dom';
from 'react-dom';
import {I18nextProvider} from 'react-i18next'; import {I18nextProvider} from 'react-i18next';
import i18n, {withTranslation} from './i18n'; import i18n, {withTranslation} from './i18n';
import { import {parentRPC, UntrustedContentRoot} from './untrusted';
parentRPC, import PropTypes from "prop-types";
UntrustedContentRoot import styles from "./sandboxed-ckeditor.scss";
} from './untrusted'; import {getPublicUrl, getSandboxUrl, getTrustedUrl} from "./urls";
import PropTypes import {base, unbase} from "../../../shared/templates";
from "prop-types";
import styles
from "./sandboxed-ckeditor.scss";
import {
getPublicUrl,
getSandboxUrl,
getTrustedUrl
} from "./urls";
import {
base,
unbase
} from "../../../shared/templates";
import CKEditor import CKEditor from "react-ckeditor-component";
from "react-ckeditor-component";
import {initialHeight} from "./sandboxed-ckeditor-shared"; import {initialHeight} from "./sandboxed-ckeditor-shared";
import {withComponentMixins} from "./decorator-helpers"; import {withComponentMixins} from "./decorator-helpers";

View file

@ -2,10 +2,8 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from './i18n'; import {withTranslation} from './i18n';
import PropTypes import PropTypes from "prop-types";
from "prop-types"; import styles from "./sandboxed-ckeditor.scss";
import styles
from "./sandboxed-ckeditor.scss";
import {UntrustedContentHost} from './untrusted'; import {UntrustedContentHost} from './untrusted';
import {Icon} from "./bootstrap-components"; import {Icon} from "./bootstrap-components";

View file

@ -2,10 +2,8 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from './i18n'; import {withTranslation} from './i18n';
import PropTypes import PropTypes from "prop-types";
from "prop-types"; import styles from "./sandboxed-codeeditor.scss";
import styles
from "./sandboxed-codeeditor.scss";
import {UntrustedContentHost} from './untrusted'; import {UntrustedContentHost} from './untrusted';
import {Icon} from "./bootstrap-components"; import {Icon} from "./bootstrap-components";

View file

@ -2,10 +2,8 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from './i18n'; import {withTranslation} from './i18n';
import PropTypes import PropTypes from "prop-types";
from "prop-types"; import styles from "./sandboxed-grapesjs.scss";
import styles
from "./sandboxed-grapesjs.scss";
import {UntrustedContentHost} from './untrusted'; import {UntrustedContentHost} from './untrusted';
import {Icon} from "./bootstrap-components"; import {Icon} from "./bootstrap-components";

View file

@ -2,10 +2,8 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from './i18n'; import {withTranslation} from './i18n';
import PropTypes import PropTypes from "prop-types";
from "prop-types"; import styles from "./sandboxed-mosaico.scss";
import styles
from "./sandboxed-mosaico.scss";
import {UntrustedContentHost} from './untrusted'; import {UntrustedContentHost} from './untrusted';
import {Icon} from "./bootstrap-components"; import {Icon} from "./bootstrap-components";

View file

@ -1,29 +1,21 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import ReactDOMServer import ReactDOMServer from 'react-dom/server';
from 'react-dom/server'; import PropTypes from 'prop-types';
import PropTypes
from 'prop-types';
import {withTranslation} from './i18n'; import {withTranslation} from './i18n';
import jQuery import jQuery from 'jquery';
from 'jquery';
import 'datatables.net'; import 'datatables.net';
import 'datatables.net-bs4'; import 'datatables.net-bs4';
import 'datatables.net-bs4/css/dataTables.bootstrap4.css'; import 'datatables.net-bs4/css/dataTables.bootstrap4.css';
import axios import axios from './axios';
from './axios';
import {withPageHelpers} from './page' import {withPageHelpers} from './page'
import { import {withAsyncErrorHandler, withErrorHandling} from './error-handling';
withAsyncErrorHandler, import styles from "./styles.scss";
withErrorHandling
} from './error-handling';
import styles
from "./styles.scss";
import {getUrl} from "./urls"; import {getUrl} from "./urls";
import {withComponentMixins} from "./decorator-helpers"; import {withComponentMixins} from "./decorator-helpers";

View file

@ -1,28 +1,20 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import ReactDOMServer import ReactDOMServer from 'react-dom/server';
from 'react-dom/server';
import {withTranslation} from './i18n'; import {withTranslation} from './i18n';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import jQuery import jQuery from 'jquery';
from 'jquery';
import '../../static/jquery/jquery-ui-1.12.1.min.js'; import '../../static/jquery/jquery-ui-1.12.1.min.js';
import '../../static/fancytree/jquery.fancytree-all.min.js'; import '../../static/fancytree/jquery.fancytree-all.min.js';
import '../../static/fancytree/skin-bootstrap/ui.fancytree.min.css'; import '../../static/fancytree/skin-bootstrap/ui.fancytree.min.css';
import './tree.scss'; import './tree.scss';
import axios import axios from './axios';
from './axios';
import {withPageHelpers} from './page' import {withPageHelpers} from './page'
import { import {withAsyncErrorHandler, withErrorHandling} from './error-handling';
withAsyncErrorHandler, import styles from "./styles.scss";
withErrorHandling
} from './error-handling';
import styles
from "./styles.scss";
import {getUrl} from "./urls"; import {getUrl} from "./urls";
import {withComponentMixins} from "./decorator-helpers"; import {withComponentMixins} from "./decorator-helpers";

View file

@ -1,27 +1,13 @@
'use strict'; 'use strict';
import React, {Component} from "react"; import React, {Component} from "react";
import PropTypes import PropTypes from "prop-types";
from "prop-types";
import {withTranslation} from './i18n'; import {withTranslation} from './i18n';
import { import {requiresAuthenticatedUser, withPageHelpers} from "./page";
requiresAuthenticatedUser, import {withAsyncErrorHandler, withErrorHandling} from "./error-handling";
withPageHelpers import axios from "./axios";
} from "./page"; import styles from "./styles.scss";
import { import {getSandboxUrl, getUrl, setRestrictedAccessToken} from "./urls";
withAsyncErrorHandler,
withErrorHandling
} from "./error-handling";
import axios
from "./axios";
import styles
from "./styles.scss";
import {
getSandboxUrl,
getTrustedUrl,
getUrl,
setRestrictedAccessToken
} from "./urls";
import {withComponentMixins} from "./decorator-helpers"; import {withComponentMixins} from "./decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -1,40 +1,31 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {Trans} from 'react-i18next'; import {Trans} from 'react-i18next';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, withPageHelpers} from '../lib/page';
LinkButton,
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../lib/page';
import { import {
Button, Button,
ButtonRow, ButtonRow,
CheckBox, CheckBox,
Dropdown, filterData, Dropdown,
filterData,
Form, Form,
FormSendMethod, FormSendMethod,
InputField, InputField,
StaticField, StaticField,
TableSelect, TableSelect,
TextArea, TextArea,
withForm withForm,
withFormErrorHandlers
} from '../lib/form'; } from '../lib/form';
import {withErrorHandling} from '../lib/error-handling'; import {withErrorHandling} from '../lib/error-handling';
import {DeleteModalDialog} from '../lib/modals'; import {DeleteModalDialog} from '../lib/modals';
import { import {NamespaceSelect, validateNamespace} from '../lib/namespace';
NamespaceSelect, import {FieldWizard, UnsubscriptionMode} from '../../../shared/lists';
validateNamespace import styles from "../lib/styles.scss";
} from '../lib/namespace'; import mailtrainConfig from 'mailtrainConfig';
import {UnsubscriptionMode, FieldWizard} from '../../../shared/lists';
import styles
from "../lib/styles.scss";
import mailtrainConfig
from 'mailtrainConfig';
import {getMailerTypes} from "../send-configurations/helpers"; import {getMailerTypes} from "../send-configurations/helpers";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
@ -128,6 +119,7 @@ export default class CUD extends Component {
validateNamespace(t, state); validateNamespace(t, state);
} }
@withFormErrorHandlers
async submitHandler(submitAndLeave) { async submitHandler(submitAndLeave) {
const t = this.props.t; const t = this.props.t;

View file

@ -2,26 +2,12 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, Toolbar, withPageHelpers} from '../lib/page';
LinkButton, import {withAsyncErrorHandler, withErrorHandling} from '../lib/error-handling';
requiresAuthenticatedUser,
Title,
Toolbar,
withPageHelpers
} from '../lib/page';
import {
withAsyncErrorHandler,
withErrorHandling
} from '../lib/error-handling';
import {Table} from '../lib/table'; import {Table} from '../lib/table';
import {Link} from "react-router-dom";
import {Icon} from "../lib/bootstrap-components"; import {Icon} from "../lib/bootstrap-components";
import {checkPermissions} from "../lib/permissions"; import {checkPermissions} from "../lib/permissions";
import { import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../lib/modals";
tableAddDeleteButton,
tableRestActionDialogInit,
tableRestActionDialogRender
} from "../lib/modals";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
import {withForm} from "../lib/form"; import {withForm} from "../lib/form";

View file

@ -1,25 +1,15 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {requiresAuthenticatedUser, Title, withPageHelpers} from '../lib/page';
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../lib/page';
import {withErrorHandling} from '../lib/error-handling'; import {withErrorHandling} from '../lib/error-handling';
import {Table} from '../lib/table'; import {Table} from '../lib/table';
import {getTriggerTypes} from '../campaigns/triggers/helpers'; import {getTriggerTypes} from '../campaigns/triggers/helpers';
import {Icon} from "../lib/bootstrap-components"; import {Icon} from "../lib/bootstrap-components";
import mailtrainConfig import mailtrainConfig from 'mailtrainConfig';
from 'mailtrainConfig'; import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../lib/modals";
import {
tableAddDeleteButton,
tableRestActionDialogInit,
tableRestActionDialogRender
} from "../lib/modals";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -1,16 +1,10 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {Trans} from 'react-i18next'; import {Trans} from 'react-i18next';
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, withPageHelpers} from '../../lib/page';
LinkButton,
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../../lib/page';
import { import {
ACEEditor, ACEEditor,
Button, Button,
@ -28,17 +22,10 @@ import {
import {withErrorHandling} from '../../lib/error-handling'; import {withErrorHandling} from '../../lib/error-handling';
import {DeleteModalDialog} from "../../lib/modals"; import {DeleteModalDialog} from "../../lib/modals";
import {getFieldTypes} from './helpers'; import {getFieldTypes} from './helpers';
import validators import validators from '../../../../shared/validators';
from '../../../../shared/validators'; import slugify from 'slugify';
import slugify import {DateFormat, parseBirthday, parseDate} from '../../../../shared/date';
from 'slugify'; import styles from "../../lib/styles.scss";
import {
DateFormat,
parseBirthday,
parseDate
} from '../../../../shared/date';
import styles
from "../../lib/styles.scss";
import 'brace/mode/json'; import 'brace/mode/json';
import 'brace/mode/handlebars'; import 'brace/mode/handlebars';
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";

View file

@ -1,25 +1,14 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, Toolbar, withPageHelpers} from '../../lib/page';
LinkButton,
requiresAuthenticatedUser,
Title,
Toolbar,
withPageHelpers
} from '../../lib/page';
import {withErrorHandling} from '../../lib/error-handling'; import {withErrorHandling} from '../../lib/error-handling';
import {Table} from '../../lib/table'; import {Table} from '../../lib/table';
import {getFieldTypes} from './helpers'; import {getFieldTypes} from './helpers';
import {Icon} from "../../lib/bootstrap-components"; import {Icon} from "../../lib/bootstrap-components";
import { import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../../lib/modals";
tableAddDeleteButton,
tableRestActionDialogInit,
tableRestActionDialogRender
} from "../../lib/modals";
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -1,7 +1,6 @@
'use strict'; 'use strict';
import React from 'react'; import React from 'react';
import {Fieldset, InputField} from "../../lib/form";
export function getFieldTypes(t) { export function getFieldTypes(t) {

View file

@ -1,16 +1,10 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {Trans} from 'react-i18next'; import {Trans} from 'react-i18next';
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, withPageHelpers} from '../../lib/page';
LinkButton,
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../../lib/page';
import { import {
ACEEditor, ACEEditor,
AlignedRow, AlignedRow,
@ -26,27 +20,14 @@ import {
withForm withForm
} from '../../lib/form'; } from '../../lib/form';
import {withErrorHandling} from '../../lib/error-handling'; import {withErrorHandling} from '../../lib/error-handling';
import { import {NamespaceSelect, validateNamespace} from '../../lib/namespace';
NamespaceSelect,
validateNamespace
} from '../../lib/namespace';
import {DeleteModalDialog} from "../../lib/modals"; import {DeleteModalDialog} from "../../lib/modals";
import mailtrainConfig import mailtrainConfig from 'mailtrainConfig';
from 'mailtrainConfig'; import {getTrustedUrl, getUrl} from "../../lib/urls";
import { import {ActionLink, Icon} from "../../lib/bootstrap-components";
getTrustedUrl, import styles from "../../lib/styles.scss";
getUrl import formsStyles from "./styles.scss";
} from "../../lib/urls"; import axios from "../../lib/axios";
import {
ActionLink,
Icon
} from "../../lib/bootstrap-components";
import styles
from "../../lib/styles.scss";
import formsStyles
from "./styles.scss";
import axios
from "../../lib/axios";
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -2,25 +2,12 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, Toolbar, withPageHelpers} from '../../lib/page';
LinkButton, import {withAsyncErrorHandler, withErrorHandling} from '../../lib/error-handling';
requiresAuthenticatedUser,
Title,
Toolbar,
withPageHelpers
} from '../../lib/page';
import {
withAsyncErrorHandler,
withErrorHandling
} from '../../lib/error-handling';
import {Table} from '../../lib/table'; import {Table} from '../../lib/table';
import {Icon} from "../../lib/bootstrap-components"; import {Icon} from "../../lib/bootstrap-components";
import {checkPermissions} from "../../lib/permissions"; import {checkPermissions} from "../../lib/permissions";
import { import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../../lib/modals";
tableAddDeleteButton,
tableRestActionDialogInit,
tableRestActionDialogRender
} from "../../lib/modals";
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -1,15 +1,9 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, withPageHelpers} from '../../lib/page';
LinkButton,
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../../lib/page';
import { import {
AlignedRow, AlignedRow,
Button, Button,
@ -24,27 +18,15 @@ import {
TextArea, TextArea,
withForm withForm
} from '../../lib/form'; } from '../../lib/form';
import { import {withAsyncErrorHandler, withErrorHandling} from '../../lib/error-handling';
withAsyncErrorHandler,
withErrorHandling
} from '../../lib/error-handling';
import {DeleteModalDialog} from "../../lib/modals"; import {DeleteModalDialog} from "../../lib/modals";
import {getImportLabels} from './helpers'; import {getImportLabels} from './helpers';
import { import {ImportSource, inProgress, MappingType, prepInProgress} from '../../../../shared/imports';
ImportSource, import axios from "../../lib/axios";
inProgress,
MappingType,
prepInProgress
} from '../../../../shared/imports';
import axios
from "../../lib/axios";
import {getUrl} from "../../lib/urls"; import {getUrl} from "../../lib/urls";
import listStyles import listStyles from "../styles.scss";
from "../styles.scss"; import styles from "../../lib/styles.scss";
import styles import interoperableErrors from "../../../../shared/interoperable-errors";
from "../../lib/styles.scss";
import interoperableErrors
from "../../../../shared/interoperable-errors";
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";

View file

@ -1,30 +1,17 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, Toolbar, withPageHelpers} from '../../lib/page';
LinkButton,
requiresAuthenticatedUser,
Title,
Toolbar,
withPageHelpers
} from '../../lib/page';
import {withErrorHandling} from '../../lib/error-handling'; import {withErrorHandling} from '../../lib/error-handling';
import {Table} from '../../lib/table'; import {Table} from '../../lib/table';
import {getImportLabels} from './helpers'; import {getImportLabels} from './helpers';
import {Icon} from "../../lib/bootstrap-components"; import {Icon} from "../../lib/bootstrap-components";
import mailtrainConfig import mailtrainConfig from 'mailtrainConfig';
from 'mailtrainConfig'; import moment from "moment";
import moment
from "moment";
import {inProgress} from '../../../../shared/imports'; import {inProgress} from '../../../../shared/imports';
import { import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../../lib/modals";
tableAddDeleteButton,
tableRestActionDialogInit,
tableRestActionDialogRender
} from "../../lib/modals";
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -1,25 +1,15 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {requiresAuthenticatedUser, Title, withPageHelpers} from '../../lib/page';
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../../lib/page';
import {AlignedRow} from '../../lib/form'; import {AlignedRow} from '../../lib/form';
import { import {withAsyncErrorHandler, withErrorHandling} from '../../lib/error-handling';
withAsyncErrorHandler,
withErrorHandling
} from '../../lib/error-handling';
import {getImportLabels} from './helpers'; import {getImportLabels} from './helpers';
import axios import axios from "../../lib/axios";
from "../../lib/axios";
import {getUrl} from "../../lib/urls"; import {getUrl} from "../../lib/urls";
import moment import moment from "moment";
from "moment";
import {runStatusInProgress} from "../../../../shared/imports"; import {runStatusInProgress} from "../../../../shared/imports";
import {Table} from "../../lib/table"; import {Table} from "../../lib/table";
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";

View file

@ -1,40 +1,19 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {requiresAuthenticatedUser, Title, withPageHelpers} from '../../lib/page';
requiresAuthenticatedUser, import {AlignedRow, ButtonRow} from '../../lib/form';
Title, import {withAsyncErrorHandler, withErrorHandling} from '../../lib/error-handling';
withPageHelpers
} from '../../lib/page';
import {
AlignedRow,
ButtonRow
} from '../../lib/form';
import {
withAsyncErrorHandler,
withErrorHandling
} from '../../lib/error-handling';
import {getImportLabels} from './helpers'; import {getImportLabels} from './helpers';
import { import {prepFinishedAndNotInProgress, runInProgress, runStatusInProgress} from '../../../../shared/imports';
prepFinishedAndNotInProgress,
runInProgress,
runStatusInProgress
} from '../../../../shared/imports';
import {Table} from "../../lib/table"; import {Table} from "../../lib/table";
import { import {Button, Icon} from "../../lib/bootstrap-components";
Button, import axios from "../../lib/axios";
Icon
} from "../../lib/bootstrap-components";
import axios
from "../../lib/axios";
import {getUrl} from "../../lib/urls"; import {getUrl} from "../../lib/urls";
import moment import moment from "moment";
from "moment"; import interoperableErrors from '../../../../shared/interoperable-errors';
import interoperableErrors
from '../../../../shared/interoperable-errors';
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
import React from 'react'; import React from 'react';
import {ImportSource, MappingType, ImportStatus, RunStatus} from '../../../../shared/imports'; import {ImportSource, ImportStatus, MappingType, RunStatus} from '../../../../shared/imports';
export function getImportLabels(t) { export function getImportLabels(t) {

View file

@ -1,46 +1,22 @@
'use strict'; 'use strict';
import React, {Component} from "react"; import React, {Component} from "react";
import PropTypes import PropTypes from "prop-types";
from "prop-types";
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, Toolbar, withPageHelpers} from "../../lib/page";
LinkButton, import {ButtonRow, Dropdown, Form, FormSendMethod, InputField, withForm} from "../../lib/form";
requiresAuthenticatedUser,
Title,
Toolbar,
withPageHelpers
} from "../../lib/page";
import {
Button as FormButton,
ButtonRow,
Dropdown,
Form,
FormSendMethod,
InputField,
withForm
} from "../../lib/form";
import {withErrorHandling} from "../../lib/error-handling"; import {withErrorHandling} from "../../lib/error-handling";
import {DeleteModalDialog} from "../../lib/modals"; import {DeleteModalDialog} from "../../lib/modals";
import styles import styles from "./CUD.scss";
from "./CUD.scss";
import {DragDropContext} from "react-dnd"; import {DragDropContext} from "react-dnd";
import HTML5Backend import HTML5Backend from "react-dnd-html5-backend";
from "react-dnd-html5-backend"; import TouchBackend from "react-dnd-touch-backend";
import TouchBackend import SortableTree from "react-sortable-tree";
from "react-dnd-touch-backend";
import SortableTree
from "react-sortable-tree";
import 'react-sortable-tree/style.css'; import 'react-sortable-tree/style.css';
import { import {ActionLink, Button, Icon} from "../../lib/bootstrap-components";
ActionLink,
Button,
Icon
} from "../../lib/bootstrap-components";
import {getRuleHelpers} from "./helpers"; import {getRuleHelpers} from "./helpers";
import RuleSettingsPane import RuleSettingsPane from "./RuleSettingsPane";
from "./RuleSettingsPane";
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";
// https://stackoverflow.com/a/4819886/1601953 // https://stackoverflow.com/a/4819886/1601953

View file

@ -1,24 +1,13 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, Toolbar, withPageHelpers} from '../../lib/page';
LinkButton,
requiresAuthenticatedUser,
Title,
Toolbar,
withPageHelpers
} from '../../lib/page';
import {withErrorHandling} from '../../lib/error-handling'; import {withErrorHandling} from '../../lib/error-handling';
import {Table} from '../../lib/table'; import {Table} from '../../lib/table';
import {Icon} from "../../lib/bootstrap-components"; import {Icon} from "../../lib/bootstrap-components";
import { import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../../lib/modals";
tableAddDeleteButton,
tableRestActionDialogInit,
tableRestActionDialogRender
} from "../../lib/modals";
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -1,27 +1,15 @@
'use strict'; 'use strict';
import React, {PureComponent} from "react"; import React, {PureComponent} from "react";
import PropTypes import PropTypes from "prop-types";
from "prop-types";
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {requiresAuthenticatedUser, withPageHelpers} from "../../lib/page";
requiresAuthenticatedUser, import {Button, ButtonRow, Dropdown, Form, TableSelect, withForm} from "../../lib/form";
withPageHelpers
} from "../../lib/page";
import {
Button,
ButtonRow,
Dropdown,
Form,
TableSelect,
withForm
} from "../../lib/form";
import {withErrorHandling} from "../../lib/error-handling"; import {withErrorHandling} from "../../lib/error-handling";
import {getRuleHelpers} from "./helpers"; import {getRuleHelpers} from "./helpers";
import {getFieldTypes} from "../fields/helpers"; import {getFieldTypes} from "../fields/helpers";
import styles import styles from "./CUD.scss";
from "./CUD.scss";
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -2,8 +2,8 @@
import React from 'react'; import React from 'react';
import {DatePicker, Dropdown, InputField} from "../../lib/form"; import {DatePicker, Dropdown, InputField} from "../../lib/form";
import { parseDate, parseBirthday, formatDate, formatBirthday, DateFormat, birthdayYear, getDateFormatString, getBirthdayFormatString } from '../../../../shared/date'; import {DateFormat, formatBirthday, formatDate, parseBirthday, parseDate} from '../../../../shared/date';
import { tMark } from "../../lib/i18n"; import {tMark} from "../../lib/i18n";
export function getRuleHelpers(t, fields) { export function getRuleHelpers(t, fields) {

View file

@ -1,16 +1,10 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {HTTPMethod} from '../../lib/axios'; import {HTTPMethod} from '../../lib/axios';
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, withPageHelpers} from '../../lib/page';
LinkButton,
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../../lib/page';
import { import {
AlignedRow, AlignedRow,
Button, Button,
@ -24,15 +18,10 @@ import {
} from '../../lib/form'; } from '../../lib/form';
import {withErrorHandling} from '../../lib/error-handling'; import {withErrorHandling} from '../../lib/error-handling';
import {RestActionModalDialog} from "../../lib/modals"; import {RestActionModalDialog} from "../../lib/modals";
import interoperableErrors import interoperableErrors from '../../../../shared/interoperable-errors';
from '../../../../shared/interoperable-errors';
import {SubscriptionStatus} from '../../../../shared/lists'; import {SubscriptionStatus} from '../../../../shared/lists';
import { import {getFieldTypes, getSubscriptionStatusLabels} from './helpers';
getFieldTypes, import moment from 'moment-timezone';
getSubscriptionStatusLabels
} from './helpers';
import moment
from 'moment-timezone';
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -1,47 +1,25 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, Toolbar, withPageHelpers} from '../../lib/page';
LinkButton,
requiresAuthenticatedUser,
Title,
Toolbar,
withPageHelpers
} from '../../lib/page';
import {withErrorHandling} from '../../lib/error-handling'; import {withErrorHandling} from '../../lib/error-handling';
import {Table} from '../../lib/table'; import {Table} from '../../lib/table';
import {SubscriptionStatus} from '../../../../shared/lists'; import {SubscriptionStatus} from '../../../../shared/lists';
import moment import moment from 'moment';
from 'moment'; import {Dropdown, Form, withForm} from '../../lib/form';
import { import {Button, Icon} from "../../lib/bootstrap-components";
Dropdown,
Form,
withForm
} from '../../lib/form';
import {
Button,
Icon
} from "../../lib/bootstrap-components";
import {HTTPMethod} from '../../lib/axios'; import {HTTPMethod} from '../../lib/axios';
import { import {getFieldTypes, getSubscriptionStatusLabels} from './helpers';
getFieldTypes, import {getPublicUrl, getUrl} from "../../lib/urls";
getSubscriptionStatusLabels
} from './helpers';
import {
getPublicUrl,
getUrl
} from "../../lib/urls";
import { import {
tableAddDeleteButton, tableAddDeleteButton,
tableAddRestActionButton, tableAddRestActionButton,
tableRestActionDialogInit, tableRestActionDialogInit,
tableRestActionDialogRender tableRestActionDialogRender
} from "../../lib/modals"; } from "../../lib/modals";
import listStyles import listStyles from "../styles.scss";
from "../styles.scss";
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -1,7 +1,7 @@
'use strict'; 'use strict';
import React from "react"; import React from "react";
import {SubscriptionStatus} from "../../../../shared/lists"; import {getFieldColumn, SubscriptionStatus} from "../../../../shared/lists";
import { import {
ACEEditor, ACEEditor,
CheckBox, CheckBox,
@ -13,7 +13,6 @@ import {
TextArea TextArea
} from "../../lib/form"; } from "../../lib/form";
import {formatBirthday, formatDate, parseBirthday, parseDate} from "../../../../shared/date"; import {formatBirthday, formatDate, parseBirthday, parseDate} from "../../../../shared/date";
import {getFieldColumn} from '../../../../shared/lists';
import 'brace/mode/json'; import 'brace/mode/json';
export function getSubscriptionStatusLabels(t) { export function getSubscriptionStatusLabels(t) {

View file

@ -1,16 +1,10 @@
'use strict'; 'use strict';
import React, { Component } from 'react'; import React, {Component} from 'react';
import { withTranslation } from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {Title, withPageHelpers} from '../lib/page'
withPageHelpers, import {Button, ButtonRow, Form, FormSendMethod, InputField, withForm, withFormErrorHandlers} from '../lib/form';
Title, import {withErrorHandling} from '../lib/error-handling';
requiresAuthenticatedUser
} from '../lib/page'
import {
withForm, Form, FormSendMethod, InputField, ButtonRow, Button
} from '../lib/form';
import { withErrorHandling, withAsyncErrorHandler } from '../lib/error-handling';
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([
@ -45,6 +39,7 @@ export default class Forget extends Component {
} }
} }
@withFormErrorHandlers
async submitHandler() { async submitHandler() {
const t = this.props.t; const t = this.props.t;

View file

@ -2,10 +2,7 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {Title, withPageHelpers} from '../lib/page'
Title,
withPageHelpers
} from '../lib/page'
import {Link} from 'react-router-dom' import {Link} from 'react-router-dom'
import { import {
Button, Button,
@ -14,15 +11,13 @@ import {
Form, Form,
FormSendMethod, FormSendMethod,
InputField, InputField,
withForm withForm,
withFormErrorHandlers
} from '../lib/form'; } from '../lib/form';
import {withErrorHandling} from '../lib/error-handling'; import {withErrorHandling} from '../lib/error-handling';
import qs import qs from 'querystringify';
from 'querystringify'; import interoperableErrors from '../../../shared/interoperable-errors';
import interoperableErrors import mailtrainConfig from 'mailtrainConfig';
from '../../../shared/interoperable-errors';
import mailtrainConfig
from 'mailtrainConfig';
import {getUrl} from "../lib/urls"; import {getUrl} from "../lib/urls";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
@ -67,6 +62,7 @@ export default class Login extends Component {
} }
} }
@withFormErrorHandlers
async submitHandler() { async submitHandler() {
const t = this.props.t; const t = this.props.t;

View file

@ -2,29 +2,13 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {Title, withPageHelpers} from '../lib/page'
Title,
withPageHelpers
} from '../lib/page'
import {Link} from 'react-router-dom' import {Link} from 'react-router-dom'
import { import {Button, ButtonRow, Form, FormSendMethod, InputField, withForm, withFormErrorHandlers} from '../lib/form';
Button, import {withAsyncErrorHandler, withErrorHandling} from '../lib/error-handling';
ButtonRow, import passwordValidator from '../../../shared/password-validator';
Form, import axios from '../lib/axios';
FormSendMethod, import interoperableErrors from '../../../shared/interoperable-errors';
InputField,
withForm
} from '../lib/form';
import {
withAsyncErrorHandler,
withErrorHandling
} from '../lib/error-handling';
import passwordValidator
from '../../../shared/password-validator';
import axios
from '../lib/axios';
import interoperableErrors
from '../../../shared/interoperable-errors';
import {getUrl} from "../lib/urls"; import {getUrl} from "../lib/urls";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
@ -102,6 +86,7 @@ export default class Account extends Component {
state.setIn(['password2', 'error'], password !== password2 ? t('passwordsMustMatch') : null); state.setIn(['password2', 'error'], password !== password2 ? t('passwordsMustMatch') : null);
} }
@withFormErrorHandlers
async submitHandler() { async submitHandler() {
const t = this.props.t; const t = this.props.t;

View file

@ -1,15 +1,10 @@
'use strict'; 'use strict';
import React import React from 'react';
from 'react'; import Login from './Login';
import Login import Reset from './Forgot';
from './Login'; import ResetLink from './Reset';
import Reset import mailtrainConfig from 'mailtrainConfig';
from './Forgot';
import ResetLink
from './Reset';
import mailtrainConfig
from 'mailtrainConfig';
function getMenus(t) { function getMenus(t) {

View file

@ -1,36 +1,15 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, withPageHelpers} from '../lib/page';
LinkButton, import {Button, ButtonRow, Form, FormSendMethod, InputField, TextArea, TreeTableSelect, withForm} from '../lib/form';
requiresAuthenticatedUser, import axios from '../lib/axios';
Title, import {withAsyncErrorHandler, withErrorHandling} from '../lib/error-handling';
withPageHelpers import interoperableErrors from '../../../shared/interoperable-errors';
} from '../lib/page';
import {
Button,
ButtonRow,
Form,
FormSendMethod,
InputField,
TextArea,
TreeTableSelect,
withForm
} from '../lib/form';
import axios
from '../lib/axios';
import {
withAsyncErrorHandler,
withErrorHandling
} from '../lib/error-handling';
import interoperableErrors
from '../../../shared/interoperable-errors';
import {DeleteModalDialog} from "../lib/modals"; import {DeleteModalDialog} from "../lib/modals";
import mailtrainConfig import mailtrainConfig from 'mailtrainConfig';
from 'mailtrainConfig';
import {getGlobalNamespaceId} from "../../../shared/namespaces"; import {getGlobalNamespaceId} from "../../../shared/namespaces";
import {getUrl} from "../lib/urls"; import {getUrl} from "../lib/urls";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";

View file

@ -2,25 +2,12 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, Toolbar, withPageHelpers} from '../lib/page';
LinkButton,
requiresAuthenticatedUser,
Title,
Toolbar,
withPageHelpers
} from '../lib/page';
import {TreeTable} from '../lib/tree'; import {TreeTable} from '../lib/tree';
import { import {withAsyncErrorHandler, withErrorHandling} from '../lib/error-handling';
withAsyncErrorHandler,
withErrorHandling
} from '../lib/error-handling';
import {Icon} from "../lib/bootstrap-components"; import {Icon} from "../lib/bootstrap-components";
import {checkPermissions} from "../lib/permissions"; import {checkPermissions} from "../lib/permissions";
import { import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../lib/modals";
tableAddDeleteButton,
tableRestActionDialogInit,
tableRestActionDialogRender
} from "../lib/modals";
import {getGlobalNamespaceId} from "../../../shared/namespaces"; import {getGlobalNamespaceId} from "../../../shared/namespaces";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";

View file

@ -1,15 +1,9 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, withPageHelpers} from '../lib/page';
LinkButton,
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../lib/page';
import { import {
Button, Button,
ButtonRow, ButtonRow,
@ -22,21 +16,12 @@ import {
TextArea, TextArea,
withForm withForm
} from '../lib/form'; } from '../lib/form';
import axios import axios from '../lib/axios';
from '../lib/axios'; import {withAsyncErrorHandler, withErrorHandling} from '../lib/error-handling';
import { import moment from 'moment';
withAsyncErrorHandler, import {NamespaceSelect, validateNamespace} from '../lib/namespace';
withErrorHandling
} from '../lib/error-handling';
import moment
from 'moment';
import {
NamespaceSelect,
validateNamespace
} from '../lib/namespace';
import {DeleteModalDialog} from "../lib/modals"; import {DeleteModalDialog} from "../lib/modals";
import mailtrainConfig import mailtrainConfig from 'mailtrainConfig';
from 'mailtrainConfig';
import {getUrl} from "../lib/urls"; import {getUrl} from "../lib/urls";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";

View file

@ -2,31 +2,16 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, Toolbar, withPageHelpers} from '../lib/page';
LinkButton,
requiresAuthenticatedUser,
Title,
Toolbar,
withPageHelpers
} from '../lib/page';
import {Table} from '../lib/table'; import {Table} from '../lib/table';
import { import {withAsyncErrorHandler, withErrorHandling} from '../lib/error-handling';
withAsyncErrorHandler, import moment from 'moment';
withErrorHandling import axios from '../lib/axios';
} from '../lib/error-handling';
import moment
from 'moment';
import axios
from '../lib/axios';
import {ReportState} from '../../../shared/reports'; import {ReportState} from '../../../shared/reports';
import {Icon} from "../lib/bootstrap-components"; import {Icon} from "../lib/bootstrap-components";
import {checkPermissions} from "../lib/permissions"; import {checkPermissions} from "../lib/permissions";
import {getUrl} from "../lib/urls"; import {getUrl} from "../lib/urls";
import { import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../lib/modals";
tableAddDeleteButton,
tableRestActionDialogInit,
tableRestActionDialogRender
} from "../lib/modals";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -2,24 +2,13 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {requiresAuthenticatedUser, Title, Toolbar, withPageHelpers} from '../lib/page'
requiresAuthenticatedUser, import {withAsyncErrorHandler, withErrorHandling} from '../lib/error-handling';
Title, import axios from '../lib/axios';
Toolbar,
withPageHelpers
} from '../lib/page'
import {
withAsyncErrorHandler,
withErrorHandling
} from '../lib/error-handling';
import axios
from '../lib/axios';
import {ReportState} from '../../../shared/reports'; import {ReportState} from '../../../shared/reports';
import {getUrl} from "../lib/urls"; import {getUrl} from "../lib/urls";
import {Button} from "../lib/bootstrap-components"; import {Button} from "../lib/bootstrap-components";
import {Link} from "react-router-dom"; import PropTypes from "prop-types";
import PropTypes
from "prop-types";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -1,16 +1,10 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {Trans} from 'react-i18next'; import {Trans} from 'react-i18next';
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, withPageHelpers} from '../../lib/page'
LinkButton,
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../../lib/page'
import { import {
ACEEditor, ACEEditor,
Button, Button,
@ -23,13 +17,9 @@ import {
withForm withForm
} from '../../lib/form'; } from '../../lib/form';
import {withErrorHandling} from '../../lib/error-handling'; import {withErrorHandling} from '../../lib/error-handling';
import { import {NamespaceSelect, validateNamespace} from '../../lib/namespace';
NamespaceSelect,
validateNamespace
} from '../../lib/namespace';
import {DeleteModalDialog} from "../../lib/modals"; import {DeleteModalDialog} from "../../lib/modals";
import mailtrainConfig import mailtrainConfig from 'mailtrainConfig';
from 'mailtrainConfig';
import 'brace/mode/javascript'; import 'brace/mode/javascript';
import 'brace/mode/json'; import 'brace/mode/json';
import 'brace/mode/handlebars'; import 'brace/mode/handlebars';

View file

@ -2,33 +2,14 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {ButtonDropdown, Icon} from '../../lib/bootstrap-components';
ButtonDropdown, import {DropdownLink, requiresAuthenticatedUser, Title, Toolbar, withPageHelpers} from '../../lib/page';
Icon import {withAsyncErrorHandler, withErrorHandling} from '../../lib/error-handling';
} from '../../lib/bootstrap-components';
import {
DropdownLink,
NavDropdown,
requiresAuthenticatedUser,
Title,
Toolbar,
withPageHelpers
} from '../../lib/page';
import {
withAsyncErrorHandler,
withErrorHandling
} from '../../lib/error-handling';
import {Table} from '../../lib/table'; import {Table} from '../../lib/table';
import moment import moment from 'moment';
from 'moment'; import mailtrainConfig from 'mailtrainConfig';
import mailtrainConfig
from 'mailtrainConfig';
import {checkPermissions} from "../../lib/permissions"; import {checkPermissions} from "../../lib/permissions";
import { import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../../lib/modals";
tableAddDeleteButton,
tableRestActionDialogInit,
tableRestActionDialogRender
} from "../../lib/modals";
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -3,52 +3,27 @@
import './lib/public-path'; import './lib/public-path';
import React, {Component} from 'react'; import React, {Component} from 'react';
import ReactDOM import ReactDOM from 'react-dom';
from 'react-dom';
import {I18nextProvider} from 'react-i18next'; import {I18nextProvider} from 'react-i18next';
import i18n, {withTranslation} from './lib/i18n'; import i18n, {withTranslation} from './lib/i18n';
import account import account from './account/root';
from './account/root'; import login from './login/root';
import login import blacklist from './blacklist/root';
from './login/root'; import lists from './lists/root';
import blacklist import namespaces from './namespaces/root';
from './blacklist/root'; import reports from './reports/root';
import lists import campaigns from './campaigns/root';
from './lists/root'; import templates from './templates/root';
import namespaces import users from './users/root';
from './namespaces/root'; import sendConfigurations from './send-configurations/root';
import reports import settings from './settings/root';
from './reports/root';
import campaigns
from './campaigns/root';
import templates
from './templates/root';
import users
from './users/root';
import sendConfigurations
from './send-configurations/root';
import settings
from './settings/root';
import { import {DropdownLink, getLanguageChooser, NavDropdown, NavLink, Section} from "./lib/page";
DropdownLink,
getLanguageChooser,
NavDropdown,
NavLink,
Section
} from "./lib/page";
import mailtrainConfig import mailtrainConfig from 'mailtrainConfig';
from 'mailtrainConfig'; import Home from "./Home";
import Home import {DropdownActionLink, Icon} from "./lib/bootstrap-components";
from "./Home"; import axios from './lib/axios';
import {
DropdownActionLink,
Icon
} from "./lib/bootstrap-components";
import {Link} from "react-router-dom";
import axios
from './lib/axios';
import {getUrl} from "./lib/urls"; import {getUrl} from "./lib/urls";
import {withComponentMixins} from "./lib/decorator-helpers"; import {withComponentMixins} from "./lib/decorator-helpers";

View file

@ -1,16 +1,10 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {Trans} from 'react-i18next'; import {Trans} from 'react-i18next';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, withPageHelpers} from '../lib/page'
LinkButton,
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../lib/page'
import { import {
Button, Button,
ButtonRow, ButtonRow,
@ -24,26 +18,18 @@ import {
withForm withForm
} from '../lib/form'; } from '../lib/form';
import {withErrorHandling} from '../lib/error-handling'; import {withErrorHandling} from '../lib/error-handling';
import { import {NamespaceSelect, validateNamespace} from '../lib/namespace';
NamespaceSelect,
validateNamespace
} from '../lib/namespace';
import {DeleteModalDialog} from "../lib/modals"; import {DeleteModalDialog} from "../lib/modals";
import {getMailerTypes} from "./helpers"; import {getMailerTypes} from "./helpers";
import { import {getSystemSendConfigurationId, MailerType} from "../../../shared/send-configurations";
getSystemSendConfigurationId,
MailerType
} from "../../../shared/send-configurations";
import styles import styles from "../lib/styles.scss";
from "../lib/styles.scss";
import sendConfigurationsStyles from "./styles.scss"; import sendConfigurationsStyles from "./styles.scss";
import mailtrainConfig import mailtrainConfig from 'mailtrainConfig';
from 'mailtrainConfig';
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";

View file

@ -3,27 +3,13 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import {Icon} from '../lib/bootstrap-components'; import {Icon} from '../lib/bootstrap-components';
import { import {LinkButton, requiresAuthenticatedUser, Title, Toolbar, withPageHelpers} from '../lib/page';
LinkButton, import {withAsyncErrorHandler, withErrorHandling} from '../lib/error-handling';
requiresAuthenticatedUser,
Title,
Toolbar,
withPageHelpers
} from '../lib/page';
import {
withAsyncErrorHandler,
withErrorHandling
} from '../lib/error-handling';
import {Table} from '../lib/table'; import {Table} from '../lib/table';
import moment import moment from 'moment';
from 'moment';
import {getMailerTypes} from './helpers'; import {getMailerTypes} from './helpers';
import {checkPermissions} from "../lib/permissions"; import {checkPermissions} from "../lib/permissions";
import { import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../lib/modals";
tableAddDeleteButton,
tableRestActionDialogInit,
tableRestActionDialogRender
} from "../lib/modals";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";

View file

@ -3,13 +3,7 @@
import React from "react"; import React from "react";
import {MailerType, ZoneMTAType} from "../../../shared/send-configurations"; import {MailerType, ZoneMTAType} from "../../../shared/send-configurations";
import { import {CheckBox, Dropdown, Fieldset, InputField, TextArea} from "../lib/form";
CheckBox,
Dropdown,
Fieldset,
InputField,
TextArea
} from "../lib/form";
import {Trans} from "react-i18next"; import {Trans} from "react-i18next";
import styles from "./styles.scss"; import styles from "./styles.scss";
import mailtrainConfig from 'mailtrainConfig'; import mailtrainConfig from 'mailtrainConfig';

View file

@ -1,15 +1,10 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {Trans} from 'react-i18next'; import {Trans} from 'react-i18next';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {requiresAuthenticatedUser, Title, withPageHelpers} from '../lib/page';
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../lib/page';
import { import {
Button, Button,
ButtonRow, ButtonRow,
@ -18,7 +13,8 @@ import {
FormSendMethod, FormSendMethod,
InputField, InputField,
TextArea, TextArea,
withForm withForm,
withFormErrorHandlers
} from '../lib/form'; } from '../lib/form';
import {withErrorHandling} from '../lib/error-handling'; import {withErrorHandling} from '../lib/error-handling';
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
@ -51,6 +47,7 @@ export default class Update extends Component {
const t = this.props.t; const t = this.props.t;
} }
@withFormErrorHandlers
async submitHandler() { async submitHandler() {
const t = this.props.t; const t = this.props.t;

View file

@ -1,31 +1,14 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {requiresAuthenticatedUser, Title, withPageHelpers} from '../lib/page';
requiresAuthenticatedUser, import {withAsyncErrorHandler, withErrorHandling} from '../lib/error-handling';
Title, import {Button, ButtonRow, Form, FormSendMethod, TableSelect, withForm, withFormErrorHandlers} from '../lib/form';
withPageHelpers
} from '../lib/page';
import {
withAsyncErrorHandler,
withErrorHandling
} from '../lib/error-handling';
import {
Button,
ButtonRow,
Form,
FormSendMethod,
TableSelect,
withForm
} from '../lib/form';
import {Table} from '../lib/table'; import {Table} from '../lib/table';
import axios import axios from '../lib/axios';
from '../lib/axios'; import mailtrainConfig from 'mailtrainConfig';
import mailtrainConfig
from 'mailtrainConfig';
import {getUrl} from "../lib/urls"; import {getUrl} from "../lib/urls";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
@ -91,6 +74,7 @@ export default class Share extends Component {
} }
} }
@withFormErrorHandlers
async submitHandler() { async submitHandler() {
const t = this.props.t; const t = this.props.t;

View file

@ -1,21 +1,12 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {requiresAuthenticatedUser, Title, withPageHelpers} from '../lib/page';
requiresAuthenticatedUser, import {withAsyncErrorHandler, withErrorHandling} from '../lib/error-handling';
Title,
withPageHelpers
} from '../lib/page';
import {
withAsyncErrorHandler,
withErrorHandling
} from '../lib/error-handling';
import {Table} from '../lib/table'; import {Table} from '../lib/table';
import axios import axios from '../lib/axios';
from '../lib/axios';
import {Icon} from "../lib/bootstrap-components"; import {Icon} from "../lib/bootstrap-components";
import {getUrl} from "../lib/urls"; import {getUrl} from "../lib/urls";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";

View file

@ -8,14 +8,16 @@ import {
Button, Button,
ButtonRow, ButtonRow,
CheckBox, CheckBox,
Dropdown, filterData, Dropdown,
filterData,
Form, Form,
FormSendMethod, FormSendMethod,
InputField, InputField,
StaticField, StaticField,
TableSelect, TableSelect,
TextArea, TextArea,
withForm, withFormErrorHandlers withForm,
withFormErrorHandlers
} from '../lib/form'; } from '../lib/form';
import {withErrorHandling} from '../lib/error-handling'; import {withErrorHandling} from '../lib/error-handling';
import {NamespaceSelect, validateNamespace} from '../lib/namespace'; import {NamespaceSelect, validateNamespace} from '../lib/namespace';
@ -28,7 +30,6 @@ import {getUrl} from "../lib/urls";
import {TestSendModalDialog} from "./TestSendModalDialog"; import {TestSendModalDialog} from "./TestSendModalDialog";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
import moment from 'moment'; import moment from 'moment';
import {FieldWizard} from "../../../shared/lists";
@withComponentMixins([ @withComponentMixins([

View file

@ -3,27 +3,13 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import {Icon} from '../lib/bootstrap-components'; import {Icon} from '../lib/bootstrap-components';
import { import {LinkButton, requiresAuthenticatedUser, Title, Toolbar, withPageHelpers} from '../lib/page';
LinkButton, import {withAsyncErrorHandler, withErrorHandling} from '../lib/error-handling';
requiresAuthenticatedUser,
Title,
Toolbar,
withPageHelpers
} from '../lib/page';
import {
withAsyncErrorHandler,
withErrorHandling
} from '../lib/error-handling';
import {Table} from '../lib/table'; import {Table} from '../lib/table';
import moment import moment from 'moment';
from 'moment';
import {getTemplateTypes} from './helpers'; import {getTemplateTypes} from './helpers';
import {checkPermissions} from "../lib/permissions"; import {checkPermissions} from "../lib/permissions";
import { import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../lib/modals";
tableAddDeleteButton,
tableRestActionDialogInit,
tableRestActionDialogRender
} from "../lib/modals";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -2,24 +2,14 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {ModalDialog} from "../lib/bootstrap-components"; import {ModalDialog} from "../lib/bootstrap-components";
import { import {requiresAuthenticatedUser, withPageHelpers} from "../lib/page";
requiresAuthenticatedUser, import {Form, TableSelect, withForm} from "../lib/form";
withPageHelpers
} from "../lib/page";
import {
Form,
TableSelect,
withForm
} from "../lib/form";
import {withErrorHandling} from "../lib/error-handling"; import {withErrorHandling} from "../lib/error-handling";
import moment import moment from "moment";
from "moment";
import {getMailerTypes} from "../send-configurations/helpers"; import {getMailerTypes} from "../send-configurations/helpers";
import axios import axios from '../lib/axios';
from '../lib/axios';
import {getUrl} from "../lib/urls"; import {getUrl} from "../lib/urls";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";

View file

@ -1,14 +1,7 @@
'use strict'; 'use strict';
import React import React from "react";
from "react"; import {ACEEditor, AlignedRow, Dropdown, StaticField, TableSelect} from "../lib/form";
import {
ACEEditor,
AlignedRow,
Dropdown,
StaticField,
TableSelect
} from "../lib/form";
import 'brace/mode/text'; import 'brace/mode/text';
import 'brace/mode/html'; import 'brace/mode/html';
@ -17,36 +10,17 @@ import {CKEditorHost} from "../lib/sandboxed-ckeditor";
import {GrapesJSHost} from "../lib/sandboxed-grapesjs"; import {GrapesJSHost} from "../lib/sandboxed-grapesjs";
import {CodeEditorHost} from "../lib/sandboxed-codeeditor"; import {CodeEditorHost} from "../lib/sandboxed-codeeditor";
import { import {getGrapesJSSourceTypeOptions, GrapesJSSourceType} from "../lib/sandboxed-grapesjs-shared";
getGrapesJSSourceTypeOptions,
GrapesJSSourceType
} from "../lib/sandboxed-grapesjs-shared";
import { import {CodeEditorSourceType, getCodeEditorSourceTypeOptions} from "../lib/sandboxed-codeeditor-shared";
CodeEditorSourceType,
getCodeEditorSourceTypeOptions
} from "../lib/sandboxed-codeeditor-shared";
import {getTemplateTypes as getMosaicoTemplateTypes} from './mosaico/helpers'; import {getTemplateTypes as getMosaicoTemplateTypes} from './mosaico/helpers';
import { import {getSandboxUrl} from "../lib/urls";
getPublicUrl, import mailtrainConfig from 'mailtrainConfig';
getSandboxUrl, import {ActionLink, Button} from "../lib/bootstrap-components";
getTrustedUrl
} from "../lib/urls";
import mailtrainConfig
from 'mailtrainConfig';
import {
ActionLink,
Button
} from "../lib/bootstrap-components";
import {Trans} from "react-i18next"; import {Trans} from "react-i18next";
import styles import styles from "../lib/styles.scss";
from "../lib/styles.scss";
import {
base,
unbase
} from "../../../shared/templates";
export const ResourceType = { export const ResourceType = {
TEMPLATE: 'template', TEMPLATE: 'template',

View file

@ -1,37 +1,28 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, withPageHelpers} from '../../lib/page'
LinkButton,
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../../lib/page'
import { import {
Button, Button,
ButtonRow, ButtonRow,
Dropdown, Dropdown,
filterData,
Form, Form,
FormSendMethod, FormSendMethod,
InputField, StaticField, InputField,
StaticField,
TextArea, TextArea,
withForm withForm,
withFormErrorHandlers
} from '../../lib/form'; } from '../../lib/form';
import {withErrorHandling} from '../../lib/error-handling'; import {withErrorHandling} from '../../lib/error-handling';
import { import {NamespaceSelect, validateNamespace} from '../../lib/namespace';
NamespaceSelect,
validateNamespace
} from '../../lib/namespace';
import {DeleteModalDialog} from "../../lib/modals"; import {DeleteModalDialog} from "../../lib/modals";
import {getVersafix, getMJMLSample} from "../../../../shared/mosaico-templates"; import {getMJMLSample, getVersafix} from "../../../../shared/mosaico-templates";
import { import {getTemplateTypes, getTemplateTypesOrder} from "./helpers";
getTemplateTypes,
getTemplateTypesOrder
} from "./helpers";
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";
import styles from "../../lib/styles.scss"; import styles from "../../lib/styles.scss";
@ -58,7 +49,10 @@ export default class CUD extends Component {
this.state = {}; this.state = {};
this.initForm(); this.initForm({
loadMutator: ::this.getFormValuesMutator,
submitMutator: ::this.submitFormValuesMutator
});
} }
static propTypes = { static propTypes = {
@ -71,9 +65,14 @@ export default class CUD extends Component {
this.templateTypes[data.type].afterLoad(this, data); this.templateTypes[data.type].afterLoad(this, data);
} }
submitFormValuesMutator(data) {
this.templateTypes[data.type].beforeSave(this, data);
return filterData(data, ['name', 'description', 'type', 'data', 'namespace']);
}
componentDidMount() { componentDidMount() {
if (this.props.entity) { if (this.props.entity) {
this.getFormValuesFromEntity(this.props.entity, ::this.getFormValuesMutator); this.getFormValuesFromEntity(this.props.entity);
} else { } else {
const wizard = this.props.wizard; const wizard = this.props.wizard;
@ -126,6 +125,7 @@ export default class CUD extends Component {
validateNamespace(t, state); validateNamespace(t, state);
} }
@withFormErrorHandlers
async submitHandler(submitAndLeave) { async submitHandler(submitAndLeave) {
const t = this.props.t; const t = this.props.t;
@ -141,16 +141,14 @@ export default class CUD extends Component {
this.disableForm(); this.disableForm();
this.setFormStatusMessage('info', t('saving')); this.setFormStatusMessage('info', t('saving'));
const submitResult = await this.validateAndSendFormValuesToURL(sendMethod, url, data => { const submitResult = await this.validateAndSendFormValuesToURL(sendMethod, url);
this.templateTypes[data.type].beforeSave(this, data);
});
if (submitResult) { if (submitResult) {
if (this.props.entity) { if (this.props.entity) {
if (submitAndLeave) { if (submitAndLeave) {
this.navigateToWithFlashMessage('/templates/mosaico', 'success', t('Mosaico template updated')); this.navigateToWithFlashMessage('/templates/mosaico', 'success', t('Mosaico template updated'));
} else { } else {
await this.getFormValuesFromURL(`rest/mosaico-templates/${this.props.entity.id}`, ::this.getFormValuesMutator); await this.getFormValuesFromURL(`rest/mosaico-templates/${this.props.entity.id}`);
this.enableForm(); this.enableForm();
this.setFormStatusMessage('success', t('Mosaico template updated')); this.setFormStatusMessage('success', t('Mosaico template updated'));
} }

View file

@ -2,32 +2,14 @@
import React, {Component} from 'react'; import React, {Component} from 'react';
import {withTranslation} from '../../lib/i18n'; import {withTranslation} from '../../lib/i18n';
import { import {ButtonDropdown, Icon} from '../../lib/bootstrap-components';
ButtonDropdown, import {DropdownLink, requiresAuthenticatedUser, Title, Toolbar, withPageHelpers} from '../../lib/page';
Icon import {withAsyncErrorHandler, withErrorHandling} from '../../lib/error-handling';
} from '../../lib/bootstrap-components';
import {
DropdownLink,
NavDropdown,
requiresAuthenticatedUser,
Title,
Toolbar,
withPageHelpers
} from '../../lib/page';
import {
withAsyncErrorHandler,
withErrorHandling
} from '../../lib/error-handling';
import {Table} from '../../lib/table'; import {Table} from '../../lib/table';
import moment import moment from 'moment';
from 'moment';
import {getTemplateTypes} from './helpers'; import {getTemplateTypes} from './helpers';
import {checkPermissions} from "../../lib/permissions"; import {checkPermissions} from "../../lib/permissions";
import { import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../../lib/modals";
tableAddDeleteButton,
tableRestActionDialogInit,
tableRestActionDialogRender
} from "../../lib/modals";
import {withComponentMixins} from "../../lib/decorator-helpers"; import {withComponentMixins} from "../../lib/decorator-helpers";

View file

@ -2,7 +2,7 @@
import htmlparser from 'htmlparser2' import htmlparser from 'htmlparser2'
import min from 'lodash/min'; import min from 'lodash/min';
import mjml, {MJML, BodyComponent, HeadComponent} from "../../lib/mjml"; import {BodyComponent, HeadComponent, MJML} from "../../lib/mjml";
import shortid from "shortid"; import shortid from "shortid";
function getId() { function getId() {

View file

@ -1,35 +1,25 @@
'use strict'; 'use strict';
import React, {Component} from 'react'; import React, {Component} from 'react';
import PropTypes import PropTypes from 'prop-types';
from 'prop-types';
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, withPageHelpers} from '../lib/page';
LinkButton,
requiresAuthenticatedUser,
Title,
withPageHelpers
} from '../lib/page';
import { import {
Button, Button,
ButtonRow, ButtonRow,
filterData,
Form, Form,
FormSendMethod, FormSendMethod,
InputField, InputField,
TableSelect, TableSelect,
withForm withForm,
withFormErrorHandlers
} from '../lib/form'; } from '../lib/form';
import {withErrorHandling} from '../lib/error-handling'; import {withErrorHandling} from '../lib/error-handling';
import interoperableErrors import interoperableErrors from '../../../shared/interoperable-errors';
from '../../../shared/interoperable-errors'; import passwordValidator from '../../../shared/password-validator';
import passwordValidator import mailtrainConfig from 'mailtrainConfig';
from '../../../shared/password-validator'; import {NamespaceSelect, validateNamespace} from '../lib/namespace';
import mailtrainConfig
from 'mailtrainConfig';
import {
NamespaceSelect,
validateNamespace
} from '../lib/namespace';
import {DeleteModalDialog} from "../lib/modals"; import {DeleteModalDialog} from "../lib/modals";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
@ -49,6 +39,8 @@ export default class CUD extends Component {
this.state = {}; this.state = {};
this.initForm({ this.initForm({
loadMutator: ::this.getFormValuesMutator,
submitMutator: ::this.submitFormValuesMutator,
serverValidation: { serverValidation: {
url: 'rest/users-validate', url: 'rest/users-validate',
changed: mailtrainConfig.isAuthMethodLocal ? ['username', 'email'] : ['username'], changed: mailtrainConfig.isAuthMethodLocal ? ['username', 'email'] : ['username'],
@ -67,9 +59,13 @@ export default class CUD extends Component {
data.password2 = ''; data.password2 = '';
} }
submitFormValuesMutator(data) {
return filterData(data, ['username', 'name', 'email', 'password', 'namespace', 'role']);
}
componentDidMount() { componentDidMount() {
if (this.props.entity) { if (this.props.entity) {
this.getFormValuesFromEntity(this.props.entity, ::this.getFormValuesMutator); this.getFormValuesFromEntity(this.props.entity);
} else { } else {
this.populateFormValues({ this.populateFormValues({
username: '', username: '',
@ -158,6 +154,7 @@ export default class CUD extends Component {
validateNamespace(t, state); validateNamespace(t, state);
} }
@withFormErrorHandlers
async submitHandler(submitAndLeave) { async submitHandler(submitAndLeave) {
const t = this.props.t; const t = this.props.t;
@ -174,16 +171,14 @@ export default class CUD extends Component {
this.disableForm(); this.disableForm();
this.setFormStatusMessage('info', t('saving')); this.setFormStatusMessage('info', t('saving'));
const submitResult = await this.validateAndSendFormValuesToURL(sendMethod, url, data => { const submitResult = await this.validateAndSendFormValuesToURL(sendMethod, url);
delete data.password2;
});
if (submitResult) { if (submitResult) {
if (this.props.entity) { if (this.props.entity) {
if (submitAndLeave) { if (submitAndLeave) {
this.navigateToWithFlashMessage('/users', 'success', t('User updated')); this.navigateToWithFlashMessage('/users', 'success', t('User updated'));
} else { } else {
await this.getFormValuesFromURL(`rest/users/${this.props.entity.id}`, ::this.getFormValuesMutator); await this.getFormValuesFromURL(`rest/users/${this.props.entity.id}`);
this.enableForm(); this.enableForm();
this.setFormStatusMessage('success', t('User updated')); this.setFormStatusMessage('success', t('User updated'));
} }

View file

@ -2,22 +2,11 @@
import React, {Component} from "react"; import React, {Component} from "react";
import {withTranslation} from '../lib/i18n'; import {withTranslation} from '../lib/i18n';
import { import {LinkButton, requiresAuthenticatedUser, Title, Toolbar, withPageHelpers} from "../lib/page";
LinkButton,
requiresAuthenticatedUser,
Title,
Toolbar,
withPageHelpers
} from "../lib/page";
import {Table} from "../lib/table"; import {Table} from "../lib/table";
import mailtrainConfig import mailtrainConfig from "mailtrainConfig";
from "mailtrainConfig";
import {Icon} from "../lib/bootstrap-components"; import {Icon} from "../lib/bootstrap-components";
import { import {tableAddDeleteButton, tableRestActionDialogInit, tableRestActionDialogRender} from "../lib/modals";
tableAddDeleteButton,
tableRestActionDialogInit,
tableRestActionDialogRender
} from "../lib/modals";
import {withComponentMixins} from "../lib/decorator-helpers"; import {withComponentMixins} from "../lib/decorator-helpers";
@withComponentMixins([ @withComponentMixins([

View file

@ -1,13 +1,9 @@
'use strict'; 'use strict';
import React import React from 'react';
from 'react'; import CUD from './CUD';
import CUD import List from './List';
from './CUD'; import UserShares from '../shares/UserShares';
import List
from './List';
import UserShares
from '../shares/UserShares';
import {ellipsizeBreadcrumbLabel} from "../lib/helpers"; import {ellipsizeBreadcrumbLabel} from "../lib/helpers";
function getMenus(t) { function getMenus(t) {