Merge and cleanup of PR #564
The namespace filter in campaigns was dropped (i.e. "Work with campaign's namespace"). Instead, we need a universal solution. For instance a namespace slector somewhere in the top-right corner, which should apply to everything (not just campaigns). Nevertheless, I kept the ...-by-namespace rest endpoints and related functions in models because they will be useful for implementing the universal namespace selection feature.
This commit is contained in:
parent
dcb7168322
commit
2fe7f82be3
18 changed files with 1104 additions and 1143 deletions
|
@ -229,7 +229,6 @@ export default class CUD extends Component {
|
|||
[lstPrefix + 'list']: null,
|
||||
[lstPrefix + 'segment']: null,
|
||||
[lstPrefix + 'useSegmentation']: false,
|
||||
[lstPrefix + 'work_list_current_namespace']: false,
|
||||
lists: [lstUid],
|
||||
|
||||
send_configuration: null,
|
||||
|
@ -237,8 +236,6 @@ export default class CUD extends Component {
|
|||
|
||||
click_tracking_disabled: false,
|
||||
open_tracking_disabled: false,
|
||||
work_send_config_current_namespace: false,
|
||||
work_template_current_namespace: false,
|
||||
|
||||
unsubscribe_url: '',
|
||||
|
||||
|
@ -524,17 +521,11 @@ export default class CUD extends Component {
|
|||
const lstsEditEntries = [];
|
||||
const lsts = this.getFormValue('lists') || [];
|
||||
let lstOrderIdx = 0;
|
||||
|
||||
const currentNamespace = this.getFormValue('namespace');
|
||||
const useNamespaceSendConfig = this.getFormValue('work_send_config_current_namespace');
|
||||
const useNamespaceTemplate = this.getFormValue('work_template_current_namespace');
|
||||
|
||||
for (const lstUid of lsts) {
|
||||
const prefix = 'lists_' + lstUid + '_';
|
||||
const lstOrderIdxClosure = lstOrderIdx;
|
||||
|
||||
const selectedList = this.getFormValue(prefix + 'list');
|
||||
const useNamespaceLists = this.getFormValue(prefix + 'work_list_current_namespace');
|
||||
|
||||
lstsEditEntries.push(
|
||||
<div key={lstUid} className={campaignsStyles.entry + ' ' + campaignsStyles.entryWithButtons}>
|
||||
|
@ -571,13 +562,8 @@ export default class CUD extends Component {
|
|||
}
|
||||
</div>
|
||||
<div className={campaignsStyles.entryContent}>
|
||||
<CheckBox id={prefix + "work_list_current_namespace"} label={t('namespaceFiltering')} text={t('workWithCampaignNamespace')}/>
|
||||
{useNamespaceLists &&
|
||||
<TableSelect id={prefix + 'list'} label={t('list')} withHeader dropdown dataUrl={`rest/users-table-byNamespace/${currentNamespace}`} columns={listsColumns} selectionLabelIndex={1} />
|
||||
}
|
||||
{!useNamespaceLists &&
|
||||
<TableSelect id={prefix + 'list'} label={t('list')} withHeader dropdown dataUrl={`rest/lists-table`} columns={listsColumns} selectionLabelIndex={1} />
|
||||
}
|
||||
<TableSelect id={prefix + 'list'} label={t('list')} withHeader dropdown dataUrl='rest/lists-table' columns={listsColumns} selectionLabelIndex={1} />
|
||||
|
||||
{(campaignTypeKey === CampaignType.REGULAR || campaignTypeKey === CampaignType.RSS) &&
|
||||
<div>
|
||||
<CheckBox id={prefix + 'useSegmentation'} label={t('segment')} text={t('useAParticularSegment')}/>
|
||||
|
@ -622,7 +608,7 @@ export default class CUD extends Component {
|
|||
sendSettings = [];
|
||||
|
||||
const addOverridable = (id, label) => {
|
||||
if(this.state.sendConfiguration[id + '_overridable'] == 1){
|
||||
if(this.state.sendConfiguration[id + '_overridable']){
|
||||
if (this.getFormValue(id + '_overriden')) {
|
||||
sendSettings.push(<InputField label={t(label)} key={id + '_override'} id={id + '_override'}/>);
|
||||
} else {
|
||||
|
@ -632,7 +618,7 @@ export default class CUD extends Component {
|
|||
</StaticField>
|
||||
);
|
||||
}
|
||||
sendSettings.push(<CheckBox key={id + '_overriden'} id={id + '_overriden'} text={t('override')} overrideFormat={true}/>);
|
||||
sendSettings.push(<CheckBox key={id + '_overriden'} id={id + '_overriden'} text={t('override')} className={campaignsStyles.overrideCheckbox}/>);
|
||||
}
|
||||
else{
|
||||
sendSettings.push(
|
||||
|
@ -681,13 +667,7 @@ export default class CUD extends Component {
|
|||
|
||||
// The "key" property here and in the TableSelect below is to tell React that these tables are different and should be rendered by different instances. Otherwise, React will use
|
||||
// only one instance, which fails because Table does not handle updates in "columns" property
|
||||
if(useNamespaceTemplate){
|
||||
templateEdit = <TableSelect key="templateSelect" id="data_sourceTemplate" label={t('template')} withHeader dropdown dataUrl={`rest/templates-table-byNamespace/${currentNamespace}`} columns={templatesColumns} selectionLabelIndex={1} help={help}/>;
|
||||
}
|
||||
else{
|
||||
templateEdit = <TableSelect key="templateSelect" id="data_sourceTemplate" label={t('template')} withHeader dropdown dataUrl='rest/templates-table' columns={templatesColumns} selectionLabelIndex={1} help={help}/>;
|
||||
}
|
||||
|
||||
templateEdit = <TableSelect key="templateSelect" id="data_sourceTemplate" label={t('template')} withHeader dropdown dataUrl='rest/templates-table' columns={templatesColumns} selectionLabelIndex={1} help={help}/>;
|
||||
|
||||
} else if (!isEdit && sourceTypeKey === CampaignSource.CUSTOM_FROM_CAMPAIGN) {
|
||||
const campaignsColumns = [
|
||||
|
@ -759,32 +739,34 @@ export default class CUD extends Component {
|
|||
|
||||
{lstsEdit}
|
||||
|
||||
<Title>{t('sendSettings')}</Title>
|
||||
<hr/>
|
||||
|
||||
<CheckBox id="work_send_config_current_namespace" label={t('namespaceFiltering')} text={t('workWithCampaignNamespace')}/>
|
||||
<Fieldset label={t('sendSettings')}>
|
||||
|
||||
{useNamespaceSendConfig &&
|
||||
<TableSelect id="send_configuration" label={t('sendConfiguration')} withHeader dropdown dataUrl={`rest/send-configurations-table-byNamespace/${currentNamespace}`} columns={sendConfigurationsColumns} selectionLabelIndex={1} />
|
||||
}
|
||||
{!useNamespaceSendConfig &&
|
||||
<TableSelect id="send_configuration" label={t('sendConfiguration')} withHeader dropdown dataUrl={`rest/send-configurations-table`} columns={sendConfigurationsColumns} selectionLabelIndex={1} />
|
||||
}
|
||||
<TableSelect id="send_configuration" label={t('sendConfiguration')} withHeader dropdown dataUrl='rest/send-configurations-table' columns={sendConfigurationsColumns} selectionLabelIndex={1} />
|
||||
|
||||
{sendSettings}
|
||||
|
||||
{sendSettings}
|
||||
|
||||
<InputField id="unsubscribe_url" label={t('customUnsubscribeUrl')}/>
|
||||
<InputField id="unsubscribe_url" label={t('customUnsubscribeUrl')}/>
|
||||
</Fieldset>
|
||||
|
||||
<hr/>
|
||||
|
||||
<CheckBox id="open_tracking_disabled" text={t('disableOpenedTracking')}/>
|
||||
<CheckBox id="click_tracking_disabled" text={t('disableClickedTracking')}/>
|
||||
<Fieldset label={t('Tracking')}>
|
||||
<CheckBox id="open_tracking_disabled" text={t('disableOpenedTracking')}/>
|
||||
<CheckBox id="click_tracking_disabled" text={t('disableClickedTracking')}/>
|
||||
</Fieldset>
|
||||
|
||||
<Title>{t('template')}</Title>
|
||||
{sourceEdit &&
|
||||
<>
|
||||
<hr/>
|
||||
<Fieldset label={t('template')}>
|
||||
{sourceEdit}
|
||||
</Fieldset>
|
||||
</>
|
||||
}
|
||||
|
||||
{sourceEdit}
|
||||
|
||||
<CheckBox id="work_template_current_namespace" label={t('namespaceFiltering')} text={t('workWithCampaignNamespace')}/>
|
||||
|
||||
{templateEdit}
|
||||
|
||||
|
|
|
@ -89,4 +89,6 @@
|
|||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
|
||||
.overrideCheckbox{
|
||||
margin-top: -8px !important;
|
||||
}
|
||||
|
|
|
@ -340,7 +340,7 @@ class CheckBox extends Component {
|
|||
label: PropTypes.string,
|
||||
help: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
|
||||
format: PropTypes.string,
|
||||
overrideFormat: PropTypes.bool
|
||||
className: PropTypes.string
|
||||
}
|
||||
|
||||
render() {
|
||||
|
@ -348,28 +348,15 @@ class CheckBox extends Component {
|
|||
const owner = this.getFormStateOwner();
|
||||
const id = this.props.id;
|
||||
const htmlId = 'form_' + id;
|
||||
const overrideFormat = this.props.overrideFormat;
|
||||
|
||||
const className = owner.addFormValidationClass('form-check-input', id);
|
||||
const inputClassName = owner.addFormValidationClass('form-check-input', id);
|
||||
|
||||
if(overrideFormat){
|
||||
return wrapInput(id, htmlId, owner, props.format, '', props.label, props.help,
|
||||
<div className={styles.overrideCheckboxForm}>
|
||||
<input className={className} type="checkbox" checked={owner.getFormValue(id)} id={htmlId} aria-describedby={htmlId + '_help'} onChange={evt => owner.updateFormValue(id, !owner.getFormValue(id))}/>
|
||||
return wrapInput(id, htmlId, owner, props.format, '', props.label, props.help,
|
||||
<div className={`form-group form-check my-2 ${this.props.className}`}>
|
||||
<input className={inputClassName} type="checkbox" checked={owner.getFormValue(id)} id={htmlId} aria-describedby={htmlId + '_help'} onChange={evt => owner.updateFormValue(id, !owner.getFormValue(id))}/>
|
||||
<label className={styles.checkboxText} htmlFor={htmlId}>{props.text}</label>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
else{
|
||||
return wrapInput(id, htmlId, owner, props.format, '', props.label, props.help,
|
||||
<div className="form-group form-check my-2">
|
||||
<input className={className} type="checkbox" checked={owner.getFormValue(id)} id={htmlId} aria-describedby={htmlId + '_help'} onChange={evt => owner.updateFormValue(id, !owner.getFormValue(id))}/>
|
||||
<label className={styles.checkboxText} htmlFor={htmlId}>{props.text}</label>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import {
|
|||
Button,
|
||||
DismissibleAlert,
|
||||
DropdownActionLink,
|
||||
ButtonDropdown,
|
||||
Icon
|
||||
} from "./bootstrap-components";
|
||||
import mailtrainConfig
|
||||
|
@ -698,4 +697,3 @@ export function getLanguageChooser(t) {
|
|||
|
||||
return languageChooser;
|
||||
}
|
||||
|
||||
|
|
|
@ -127,12 +127,6 @@
|
|||
.checkboxText{
|
||||
padding-top: 3px;
|
||||
}
|
||||
.overrideCheckboxForm{
|
||||
position: relative;
|
||||
margin-top: -15px;
|
||||
margin-bottom: 30px;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.dropZone{
|
||||
padding-top: 20px;
|
||||
|
|
|
@ -108,7 +108,7 @@ class Root extends Component {
|
|||
<ul className="navbar-nav mt-navbar-nav-left">
|
||||
{topLevelMenu}
|
||||
<NavDropdown label={t('administration')}>
|
||||
{mailtrainConfig.globalPermissions.manageUserList && <DropdownLink to="/users">{t('users')}</DropdownLink>}
|
||||
{mailtrainConfig.globalPermissions.displayManageUsers && <DropdownLink to="/users">{t('users')}</DropdownLink>}
|
||||
<DropdownLink to="/namespaces">{t('namespaces')}</DropdownLink>
|
||||
{mailtrainConfig.globalPermissions.manageSettings && <DropdownLink to="/settings">{t('globalSettings')}</DropdownLink>}
|
||||
<DropdownLink to="/send-configurations">{t('sendConfigurations')}</DropdownLink>
|
||||
|
|
|
@ -40,6 +40,8 @@ import {
|
|||
import styles
|
||||
from "../lib/styles.scss";
|
||||
|
||||
import sendConfigurationsStyles from "./styles.scss";
|
||||
|
||||
import mailtrainConfig
|
||||
from 'mailtrainConfig';
|
||||
import {withComponentMixins} from "../lib/decorator-helpers";
|
||||
|
@ -231,13 +233,13 @@ export default class CUD extends Component {
|
|||
|
||||
<Fieldset label={t('emailHeader')}>
|
||||
<InputField id="from_email" label={t('defaultFromEmail')}/>
|
||||
<CheckBox id="from_email_overridable" text={t('overridable')} overrideFormat={true}/>
|
||||
<CheckBox id="from_email_overridable" text={t('overridable')} className={sendConfigurationsStyles.overridableCheckbox}/>
|
||||
<InputField id="from_name" label={t('defaultFromName')}/>
|
||||
<CheckBox id="from_name_overridable" text={t('overridable')} overrideFormat={true}/>
|
||||
<CheckBox id="from_name_overridable" text={t('overridable')} className={sendConfigurationsStyles.overridableCheckbox}/>
|
||||
<InputField id="reply_to" label={t('defaultReplytoEmail')}/>
|
||||
<CheckBox id="reply_to_overridable" text={t('overridable')} overrideFormat={true}/>
|
||||
<CheckBox id="reply_to_overridable" text={t('overridable')} className={sendConfigurationsStyles.overridableCheckbox}/>
|
||||
<InputField id="subject" label={t('subject')}/>
|
||||
<CheckBox id="subject_overridable" text={t('overridable')} overrideFormat={true}/>
|
||||
<CheckBox id="subject_overridable" text={t('overridable')} className={sendConfigurationsStyles.overridableCheckbox}/>
|
||||
<InputField id="x_mailer" label={t('xMailer')}/>
|
||||
</Fieldset>
|
||||
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
textarea.dkimPrivateKey {
|
||||
height: 200px;
|
||||
}
|
||||
|
||||
.overridableCheckbox {
|
||||
margin-top: -8px !important;
|
||||
}
|
|
@ -231,7 +231,7 @@ roles:
|
|||
name: Global Master
|
||||
admin: true
|
||||
description: All permissions
|
||||
permissions: [rebuildPermissions, createJavascriptWithROAccess, manageUserList, manageBlacklist, manageSettings, setupAutomation]
|
||||
permissions: [rebuildPermissions, createJavascriptWithROAccess, displayManageUsers, manageBlacklist, manageSettings, setupAutomation]
|
||||
rootNamespaceRole: master
|
||||
campaignsAdmin:
|
||||
name: Campaigns Admin
|
||||
|
|
|
@ -64,29 +64,30 @@ function hash(entity, content) {
|
|||
return hasher.hash(filteredEntity);
|
||||
}
|
||||
|
||||
async function listDTAjax(context, params) {
|
||||
async function _listDTAjax(context, namespaceId, params) {
|
||||
return await dtHelpers.ajaxListWithPermissions(
|
||||
context,
|
||||
[{ entityTypeId: 'campaign', requiredOperations: ['view'] }],
|
||||
params,
|
||||
builder => builder.from('campaigns')
|
||||
.innerJoin('namespaces', 'namespaces.id', 'campaigns.namespace')
|
||||
.whereNull('campaigns.parent'),
|
||||
builder => {
|
||||
builder = builder.from('campaigns')
|
||||
.innerJoin('namespaces', 'namespaces.id', 'campaigns.namespace')
|
||||
.whereNull('campaigns.parent');
|
||||
if (namespaceId) {
|
||||
builder = builder.where('namespaces.id', namespaceId);
|
||||
}
|
||||
return builder;
|
||||
},
|
||||
['campaigns.id', 'campaigns.name', 'campaigns.cid', 'campaigns.description', 'campaigns.type', 'campaigns.status', 'campaigns.scheduled', 'campaigns.source', 'campaigns.created', 'namespaces.name']
|
||||
);
|
||||
}
|
||||
|
||||
async function listDTAjax(context, params) {
|
||||
return await _listDTAjax(context, undefined, params);
|
||||
}
|
||||
|
||||
async function listByNamespaceDTAjax(context, namespaceId, params) {
|
||||
return await dtHelpers.ajaxListWithPermissions(
|
||||
context,
|
||||
[{ entityTypeId: 'campaign', requiredOperations: ['view'] }],
|
||||
params,
|
||||
builder => builder.from('campaigns')
|
||||
.innerJoin('namespaces', 'namespaces.id', 'campaigns.namespace')
|
||||
.where('namespaces.id', namespaceId)
|
||||
.whereNull('campaigns.parent'),
|
||||
['campaigns.id', 'campaigns.name', 'campaigns.cid', 'campaigns.description', 'campaigns.type', 'campaigns.status', 'campaigns.scheduled', 'campaigns.source', 'campaigns.created', 'namespaces.name']
|
||||
);
|
||||
return await _listDTAjax(context, namespaceId, params);
|
||||
}
|
||||
|
||||
async function listChildrenDTAjax(context, campaignId, params) {
|
||||
|
@ -556,7 +557,7 @@ async function updateWithConsistencyCheck(context, entity, content) {
|
|||
|
||||
} else if (content === Content.WITHOUT_SOURCE_CUSTOM) {
|
||||
filteredEntity.data.sourceCustom = existing.data.sourceCustom;
|
||||
await namespaceHelpers.validateMove(context, entity, existing, 'campaign', 'createCampaign', 'delete'); //Doesn't works with filteredEntity
|
||||
await namespaceHelpers.validateMove(context, filteredEntity, existing, 'campaign', 'createCampaign', 'delete'); // XXX TB - try with entity
|
||||
|
||||
} else if (content === Content.ONLY_SOURCE_CUSTOM) {
|
||||
const data = existing.data;
|
||||
|
@ -743,9 +744,9 @@ async function changeStatusByCampaignCidAndSubscriptionIdTx(tx, context, campaig
|
|||
])
|
||||
.first();
|
||||
|
||||
//if (!message) {
|
||||
throw new Error('Invalid campaign.')
|
||||
//}
|
||||
if (!message) {
|
||||
throw new Error('Invalid campaign.');
|
||||
}
|
||||
|
||||
await _changeStatusByMessageTx(tx, context, message, subscriptionStatus);
|
||||
}
|
||||
|
|
|
@ -26,16 +26,22 @@ function hash(entity) {
|
|||
}
|
||||
|
||||
|
||||
async function listDTAjax(context, params) {
|
||||
async function _listDTAjax(context, namespaceId, params) {
|
||||
const campaignEntityType = entitySettings.getEntityType('campaign');
|
||||
|
||||
return await dtHelpers.ajaxListWithPermissions(
|
||||
context,
|
||||
[{ entityTypeId: 'list', requiredOperations: ['view'] }],
|
||||
params,
|
||||
builder => builder
|
||||
.from('lists')
|
||||
.innerJoin('namespaces', 'namespaces.id', 'lists.namespace'),
|
||||
builder => {
|
||||
builder = builder
|
||||
.from('lists')
|
||||
.innerJoin('namespaces', 'namespaces.id', 'lists.namespace');
|
||||
if (namespaceId) {
|
||||
builder = builder.where('lists.namespace', namespaceId);
|
||||
}
|
||||
return builder;
|
||||
},
|
||||
['lists.id', 'lists.name', 'lists.cid', 'lists.subscribers', 'lists.description', 'namespaces.name',
|
||||
{
|
||||
name: 'triggerCount',
|
||||
|
@ -53,32 +59,12 @@ async function listDTAjax(context, params) {
|
|||
);
|
||||
}
|
||||
|
||||
async function listByNamespaceDTAjax(context, namespaceId, params) {
|
||||
const campaignEntityType = entitySettings.getEntityType('campaign');
|
||||
async function listDTAjax(context, params) {
|
||||
return await _listDTAjax(context, undefined, params);
|
||||
}
|
||||
|
||||
return await dtHelpers.ajaxListWithPermissions(
|
||||
context,
|
||||
[{ entityTypeId: 'list', requiredOperations: ['view'] }],
|
||||
params,
|
||||
builder => builder
|
||||
.from('lists')
|
||||
.innerJoin('namespaces', 'namespaces.id', 'lists.namespace')
|
||||
.where('lists.namespace', namespaceId),
|
||||
['lists.id', 'lists.name', 'lists.cid', 'lists.subscribers', 'lists.description', 'namespaces.name',
|
||||
{
|
||||
name: 'triggerCount',
|
||||
query: builder =>
|
||||
builder.from('campaigns')
|
||||
.innerJoin('campaign_lists', 'campaigns.id', 'campaign_lists.campaign')
|
||||
.innerJoin('triggers', 'campaigns.id', 'triggers.campaign')
|
||||
.innerJoin(campaignEntityType.permissionsTable, 'campaigns.id', `${campaignEntityType.permissionsTable}.entity`)
|
||||
.whereRaw('campaign_lists.list = lists.id')
|
||||
.where(`${campaignEntityType.permissionsTable}.operation`, 'viewTriggers')
|
||||
.count()
|
||||
.as('triggerCount')
|
||||
}
|
||||
]
|
||||
);
|
||||
async function listByNamespaceDTAjax(context, namespaceId, params) {
|
||||
return await _listDTAjax(context, namespaceId, params);
|
||||
}
|
||||
|
||||
async function listWithSegmentByCampaignDTAjax(context, campaignId, params) {
|
||||
|
|
|
@ -22,29 +22,30 @@ function hash(entity) {
|
|||
return hasher.hash(filterObject(entity, allowedKeys));
|
||||
}
|
||||
|
||||
async function listDTAjax(context, params) {
|
||||
async function _listDTAjax(context, namespaceId, params) {
|
||||
return await dtHelpers.ajaxListWithPermissions(
|
||||
context,
|
||||
[{ entityTypeId: 'sendConfiguration', requiredOperations: ['viewPublic'] }],
|
||||
params,
|
||||
builder => builder
|
||||
.from('send_configurations')
|
||||
.innerJoin('namespaces', 'namespaces.id', 'send_configurations.namespace'),
|
||||
builder => {
|
||||
builder = builder
|
||||
.from('send_configurations')
|
||||
.innerJoin('namespaces', 'namespaces.id', 'send_configurations.namespace');
|
||||
if (namespaceId) {
|
||||
builder = builder.where('send_configurations.namespace', namespaceId);
|
||||
}
|
||||
return builder;
|
||||
},
|
||||
['send_configurations.id', 'send_configurations.name', 'send_configurations.cid', 'send_configurations.description', 'send_configurations.mailer_type', 'send_configurations.created', 'namespaces.name']
|
||||
);
|
||||
}
|
||||
|
||||
async function listDTAjaxByNamespace(context, namespaceId, params) {
|
||||
return await dtHelpers.ajaxListWithPermissions(
|
||||
context,
|
||||
[{ entityTypeId: 'sendConfiguration', requiredOperations: ['viewPublic'] }],
|
||||
params,
|
||||
builder => builder
|
||||
.from('send_configurations')
|
||||
.innerJoin('namespaces', 'namespaces.id', 'send_configurations.namespace')
|
||||
.where('send_configurations.namespace', namespaceId),
|
||||
['send_configurations.id', 'send_configurations.name', 'send_configurations.cid', 'send_configurations.description', 'send_configurations.mailer_type', 'send_configurations.created', 'namespaces.name']
|
||||
);
|
||||
async function listDTAjax(context, params) {
|
||||
return await _listDTAjax(context, undefined, params);
|
||||
}
|
||||
|
||||
async function listByNamespaceDTAjax(context, namespaceId, params) {
|
||||
return await _listDTAjax(context, namespaceId, params);
|
||||
}
|
||||
|
||||
async function listWithSendPermissionDTAjax(context, params) {
|
||||
|
@ -188,7 +189,7 @@ async function getSystemSendConfiguration() {
|
|||
|
||||
module.exports.hash = hash;
|
||||
module.exports.listDTAjax = listDTAjax;
|
||||
module.exports.listDTAjaxByNamespace = listDTAjaxByNamespace;
|
||||
module.exports.listByNamespaceDTAjax = listByNamespaceDTAjax;
|
||||
module.exports.listWithSendPermissionDTAjax = listWithSendPermissionDTAjax;
|
||||
module.exports.getByIdTx = getByIdTx;
|
||||
module.exports.getById = getById;
|
||||
|
|
|
@ -36,24 +36,28 @@ async function getById(context, id, withPermissions = true) {
|
|||
});
|
||||
}
|
||||
|
||||
async function listDTAjax(context, params) {
|
||||
async function _listDTAjax(context, namespaceId, params) {
|
||||
return await dtHelpers.ajaxListWithPermissions(
|
||||
context,
|
||||
[{ entityTypeId: 'template', requiredOperations: ['view'] }],
|
||||
params,
|
||||
builder => builder.from('templates').innerJoin('namespaces', 'namespaces.id', 'templates.namespace'),
|
||||
builder => {
|
||||
builder = builder.from('templates').innerJoin('namespaces', 'namespaces.id', 'templates.namespace');
|
||||
if (namespaceId) {
|
||||
builder = builder.where('namespaces.id', namespaceId);
|
||||
}
|
||||
return builder;
|
||||
},
|
||||
[ 'templates.id', 'templates.name', 'templates.description', 'templates.type', 'templates.created', 'namespaces.name' ]
|
||||
);
|
||||
}
|
||||
|
||||
async function listByNamespaceDTAjax(context, params, namespaceId) {
|
||||
return await dtHelpers.ajaxListWithPermissions(
|
||||
context,
|
||||
[{ entityTypeId: 'template', requiredOperations: ['view'] }],
|
||||
params,
|
||||
builder => builder.from('templates').innerJoin('namespaces', 'namespaces.id', 'templates.namespace').where('namespaces.id', namespaceId),
|
||||
[ 'templates.id', 'templates.name', 'templates.description', 'templates.type', 'templates.created', 'namespaces.name' ]
|
||||
);
|
||||
async function listDTAjax(context, params) {
|
||||
return await _listDTAjax(context, undefined, params);
|
||||
}
|
||||
|
||||
async function listByNamespaceDTAjax(context, namespaceId, params) {
|
||||
return await _listDTAjax(context, namespaceId, params);
|
||||
}
|
||||
|
||||
async function _validateAndPreprocess(tx, entity) {
|
||||
|
|
|
@ -19,7 +19,7 @@ router.postAsync('/campaigns-others-by-list-table/:campaignId/:listIds', passpor
|
|||
return res.json(await campaigns.listOthersWhoseListsAreIncludedDTAjax(req.context, castToInteger(req.params.campaignId), req.params.listIds.split(';').map(x => castToInteger(x)), req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/campaigns-namespace/:namespaceId', passport.loggedIn, async (req, res) => {
|
||||
router.postAsync('/campaigns-by-namespace-table/:namespaceId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await campaigns.listByNamespaceDTAjax(req.context, castToInteger(req.params.namespaceId), req.body));
|
||||
});
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ router.postAsync('/lists-table', passport.loggedIn, async (req, res) => {
|
|||
return res.json(await lists.listDTAjax(req.context, req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/users-table-byNamespace/:namespaceId', passport.loggedIn, async (req, res) => {
|
||||
router.postAsync('/lists-by-namespace-table/:namespaceId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await lists.listByNamespaceDTAjax(req.context, castToInteger(req.params.namespaceId), req.body));
|
||||
});
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ router.postAsync('/send-configurations-table', passport.loggedIn, async (req, re
|
|||
return res.json(await sendConfigurations.listDTAjax(req.context, req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/send-configurations-table-byNamespace/:namespaceId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await sendConfigurations.listDTAjaxByNamespace(req.context, castToInteger(req.params.namespaceId), req.body));
|
||||
router.postAsync('/send-configurations-by-namespace-table/:namespaceId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await sendConfigurations.listByNamespaceDTAjax(req.context, castToInteger(req.params.namespaceId), req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/send-configurations-with-send-permission-table', passport.loggedIn, async (req, res) => {
|
||||
|
|
|
@ -35,8 +35,8 @@ router.postAsync('/templates-table', passport.loggedIn, async (req, res) => {
|
|||
return res.json(await templates.listDTAjax(req.context, req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/templates-table-byNamespace/:namespaceId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await templates.listByNamespaceDTAjax(req.context, req.body, castToInteger(req.params.namespaceId)));
|
||||
router.postAsync('/templates-by-namespace-table/:namespaceId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await templates.listByNamespaceDTAjax(req.context, castToInteger(req.params.namespaceId), req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/template-test-send', passport.loggedIn, passport.csrfProtection, async (req, res) => {
|
||||
|
|
|
@ -46,9 +46,9 @@ EOF
|
|||
exit 1
|
||||
fi
|
||||
|
||||
#installPrerequisities
|
||||
installPrerequisities
|
||||
installMailtrain http://localhost:3000 http://localhost:3003 http://localhost:3004 0.0.0.0 false
|
||||
#installService
|
||||
installService
|
||||
|
||||
echo
|
||||
echo "Success!"
|
||||
|
@ -155,11 +155,11 @@ function installMailtrain {
|
|||
mysqlRoPassword=`pwgen 12 -1`
|
||||
|
||||
# Setup MySQL user for Mailtrain
|
||||
#mysql -u root -e "CREATE USER 'mailtrain'@'localhost' IDENTIFIED BY '$mysqlPassword';"
|
||||
#mysql -u root -e "GRANT ALL PRIVILEGES ON mailtrain.* TO 'mailtrain'@'localhost';"
|
||||
#mysql -u root -e "CREATE USER 'mailtrain_ro'@'localhost' IDENTIFIED BY '$mysqlRoPassword';"
|
||||
#mysql -u root -e "GRANT SELECT ON mailtrain.* TO 'mailtrain_ro'@'localhost';"
|
||||
#mysql -u mailtrain --password="$mysqlPassword" -e "CREATE database mailtrain;"
|
||||
mysql -u root -e "CREATE USER 'mailtrain'@'localhost' IDENTIFIED BY '$mysqlPassword';"
|
||||
mysql -u root -e "GRANT ALL PRIVILEGES ON mailtrain.* TO 'mailtrain'@'localhost';"
|
||||
mysql -u root -e "CREATE USER 'mailtrain_ro'@'localhost' IDENTIFIED BY '$mysqlRoPassword';"
|
||||
mysql -u root -e "GRANT SELECT ON mailtrain.* TO 'mailtrain_ro'@'localhost';"
|
||||
mysql -u mailtrain --password="$mysqlPassword" -e "CREATE database mailtrain;"
|
||||
|
||||
# Add new user for the mailtrain daemon to run as
|
||||
useradd mailtrain || true
|
||||
|
@ -181,7 +181,7 @@ www:
|
|||
|
||||
|
||||
mysql:
|
||||
password: "asdf1234"
|
||||
password: "$mysqlPassword"
|
||||
|
||||
redis:
|
||||
enabled: true
|
||||
|
@ -206,7 +206,7 @@ mysql:
|
|||
password: "$mysqlRoPassword"
|
||||
EOT
|
||||
|
||||
#reinstallModules
|
||||
reinstallModules
|
||||
|
||||
(cd client && npm run build)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue