Campaign status show send settings Bug
This commit is contained in:
parent
4b1b1a380d
commit
1a61067ff9
9 changed files with 119 additions and 26 deletions
|
@ -12,7 +12,8 @@ import {
|
|||
requiresAuthenticatedUser,
|
||||
Title,
|
||||
Toolbar,
|
||||
withPageHelpers
|
||||
withPageHelpers,
|
||||
getNamespaceChooser
|
||||
} from '../lib/page';
|
||||
import {
|
||||
withAsyncErrorHandler,
|
||||
|
@ -75,8 +76,12 @@ export default class List extends Component {
|
|||
}
|
||||
|
||||
render() {
|
||||
|
||||
const t = this.props.t;
|
||||
|
||||
var pathname = window.location.href;
|
||||
var url = new URL(pathname);
|
||||
var namespace = url.searchParams.get("namespace");
|
||||
|
||||
const columns = [
|
||||
{ data: 1, title: t('name') },
|
||||
{ data: 2, title: t('id'), render: data => <code>{data}</code> },
|
||||
|
@ -108,6 +113,7 @@ export default class List extends Component {
|
|||
const status = data[5];
|
||||
const campaignSource = data[7];
|
||||
|
||||
|
||||
if (perms.includes('viewStats')) {
|
||||
actions.push({
|
||||
label: <Icon icon="envelope" title={t('status')}/>,
|
||||
|
@ -172,6 +178,7 @@ export default class List extends Component {
|
|||
return (
|
||||
<div>
|
||||
{tableRestActionDialogRender(this)}
|
||||
|
||||
<Toolbar>
|
||||
{this.state.createPermitted &&
|
||||
<ButtonDropdown buttonClassName="btn-primary" menuClassName="dropdown-menu-right" label={t('createCampaign')}>
|
||||
|
@ -182,10 +189,19 @@ export default class List extends Component {
|
|||
}
|
||||
</Toolbar>
|
||||
|
||||
<Title>{t('campaigns')}</Title>
|
||||
<Toolbar>
|
||||
{getNamespaceChooser(t)}
|
||||
</Toolbar>
|
||||
|
||||
<Table ref={node => this.table = node} withHeader dataUrl="rest/campaigns-table" columns={columns} />
|
||||
<Title>{t('campaigns')}</Title>
|
||||
{!namespace &&
|
||||
<Table ref={node => this.table = node} withHeader dataUrl="rest/campaigns-table" columns={columns} />
|
||||
}
|
||||
{!!namespace &&
|
||||
<Table ref={node => this.table = node} withHeader dataUrl={`rest/campaigns-namespace/${namespace}`} columns={columns} />
|
||||
}
|
||||
</div>
|
||||
);
|
||||
|
||||
}
|
||||
}
|
|
@ -443,11 +443,17 @@ export default class Status extends Component {
|
|||
let sendSettings;
|
||||
if (this.state.sendConfiguration) {
|
||||
sendSettings = [];
|
||||
|
||||
|
||||
const addOverridable = (id, label) => {
|
||||
sendSettings.push(<AlignedRow key={id} label={label}>{entity[id + '_override'] === null ? this.state.sendConfiguration[id] : entity[id + '_override']}</AlignedRow>);
|
||||
if(this.state.sendConfiguration[id + '_overridable'] == 1){
|
||||
sendSettings.push(<AlignedRow key={id} label={label}>{entity[id + '_override']}</AlignedRow>);
|
||||
}
|
||||
else{
|
||||
sendSettings.push(<AlignedRow key={id} label={label}>{this.state.sendConfiguration[id]}</AlignedRow>);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
addOverridable('from_name', t('fromName'));
|
||||
addOverridable('from_email', t('fromEmailAddress'));
|
||||
addOverridable('reply_to', t('replytoEmailAddress'));
|
||||
|
|
|
@ -23,6 +23,7 @@ import {
|
|||
Button,
|
||||
DismissibleAlert,
|
||||
DropdownActionLink,
|
||||
ButtonDropdown,
|
||||
Icon
|
||||
} from "./bootstrap-components";
|
||||
import mailtrainConfig
|
||||
|
@ -696,4 +697,22 @@ export function getLanguageChooser(t) {
|
|||
);
|
||||
|
||||
return languageChooser;
|
||||
}
|
||||
|
||||
export function getNamespaceChooser(t) {
|
||||
|
||||
const namespaceOptions = [];
|
||||
namespaceOptions.push(
|
||||
<DropdownLink to={`/campaigns`}>{t('All')}</DropdownLink>,
|
||||
<DropdownLink to={`/campaigns?namespace=1`}>{t('Root')}</DropdownLink>
|
||||
)
|
||||
|
||||
|
||||
const namespaceChooser = (
|
||||
<ButtonDropdown buttonClassName="btn-primary" menuClassName="dropdown-menu-right" label={t('namespaceFilter')}>
|
||||
{namespaceOptions}
|
||||
</ButtonDropdown>
|
||||
);
|
||||
|
||||
return namespaceChooser;
|
||||
}
|
|
@ -198,6 +198,7 @@
|
|||
"triggers": "Triggers",
|
||||
"share": "Share",
|
||||
"createCampaign": "Create Campaign",
|
||||
"namespaceFilter": "Namespace filtering",
|
||||
"regular": "Regular",
|
||||
"rss": "RSS",
|
||||
"triggered": "Triggered",
|
||||
|
|
|
@ -1,26 +1,26 @@
|
|||
{
|
||||
"welcomeToMailtrain": "Bienvenido a Mailtrain...",
|
||||
"personalAccessToken": "Personal access token",
|
||||
"accessTokenNotYetGenerated": "Access token not yet generated",
|
||||
"personalAccessToken": "Token de acceso personal",
|
||||
"accessTokenNotYetGenerated": "El token de acceso aun no se ha generado",
|
||||
"api": "API",
|
||||
"resetAccessToken": "Reset Access Token",
|
||||
"generateAccessToken": "Generate Access Token",
|
||||
"notesAboutTheApi": "Notes about the API",
|
||||
"addSubscription": "Add subscription",
|
||||
"thisApiCallEitherInsertsANewSubscription": "This API call either inserts a new subscription or updates existing. Fields not included are left as is, so if you update only LAST_NAME value, then FIRST_NAME is kept untouched for an existing subscription.",
|
||||
"arguments": "arguments",
|
||||
"yourPersonalAccessToken": "your personal access token",
|
||||
"subscribersEmailAddress": "subscriber's email address",
|
||||
"required": "required",
|
||||
"subscribersFirstName": "subscriber's first name",
|
||||
"subscribersLastName": "subscriber's last name",
|
||||
"subscribersTimezoneEgEuropeTallinnPstOr": "subscriber's timezone (eg. \"Europe/Tallinn\", \"PST\" or \"UTC\"). If not set defaults to \"UTC\"",
|
||||
"customFieldValueUseYesnoForOptionGroup": "custom field value. Use yes/no for option group values (checkboxes, radios, drop downs)",
|
||||
"additionalPostArguments": "Additional POST arguments",
|
||||
"resetAccessToken": "Reiniciar token de acceso",
|
||||
"generateAccessToken": "Generar token de acceso",
|
||||
"notesAboutTheApi": "Notas sobre la API",
|
||||
"addSubscription": "Añadir suscripcion",
|
||||
"thisApiCallEitherInsertsANewSubscription": "Esta llamada a la API inserta una nueva suscripción o actualiza las existentes. Los campos no incluidos se dejan como están, por lo que si actualiza solo el valor de LAST_NAME, FIRST_NAME se mantiene intacto para una suscripción existente.",
|
||||
"arguments": "argumentos",
|
||||
"yourPersonalAccessToken": "tu token de acceso personal",
|
||||
"subscribersEmailAddress": "email del suscriptor",
|
||||
"required": "requerido",
|
||||
"subscribersFirstName": "nombre del suscriptor",
|
||||
"subscribersLastName": "apellidos del suscriptor",
|
||||
"subscribersTimezoneEgEuropeTallinnPstOr": "zona horaria del suscriptor (eg. \"Europe/Tallinn\", \"PST\" or \"UTC\"). Si no, asigna por defecto a \"UTC\"",
|
||||
"customFieldValueUseYesnoForOptionGroup": "valor de campo personalizado. Usa si/no para opciones grupales (checkboxes, radios, drop downs)",
|
||||
"additionalPostArguments": "argumentos POST adicionales",
|
||||
"setToYesIfYouWantToMakeSureTheEmailIs": "set to \"yes\" if you want to make sure the email is marked as subscribed even if it was previously marked as unsubscribed. If the email was already unsubscribed/blocked then subscription status is not changed",
|
||||
"setToYesIfYouWantToSendConfirmationEmail": "set to \"yes\" if you want to send confirmation email to the subscriber before actually marking as subscribed",
|
||||
"example": "Example",
|
||||
"removeSubscription": "Remove subscription",
|
||||
"example": "Ejemplo",
|
||||
"removeSubscription": "Eliminar suscripción",
|
||||
"thisApiCallMarksASubscriptionAs": "This API call marks a subscription as unsubscribed",
|
||||
"deleteSubscription": "Delete subscription",
|
||||
"thisApiCallDeletesASubscription": "This API call deletes a subscription",
|
||||
|
@ -198,6 +198,7 @@
|
|||
"triggers": "Triggers",
|
||||
"share": "Share",
|
||||
"createCampaign": "Create Campaign",
|
||||
"namespaceFilter": "Namespace filtering",
|
||||
"regular": "Regular",
|
||||
"rss": "RSS",
|
||||
"triggered": "Triggered",
|
||||
|
|
|
@ -76,6 +76,19 @@ async function listDTAjax(context, 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']
|
||||
);
|
||||
}
|
||||
|
||||
async function listChildrenDTAjax(context, campaignId, params) {
|
||||
return await dtHelpers.ajaxListWithPermissions(
|
||||
context,
|
||||
|
@ -730,9 +743,9 @@ async function changeStatusByCampaignCidAndSubscriptionIdTx(tx, context, campaig
|
|||
])
|
||||
.first();
|
||||
|
||||
if (!message) {
|
||||
//if (!message) {
|
||||
throw new Error('Invalid campaign.')
|
||||
}
|
||||
//}
|
||||
|
||||
await _changeStatusByMessageTx(tx, context, message, subscriptionStatus);
|
||||
}
|
||||
|
@ -934,6 +947,7 @@ module.exports.Content = Content;
|
|||
module.exports.hash = hash;
|
||||
|
||||
module.exports.listDTAjax = listDTAjax;
|
||||
module.exports.listByNamespaceDTAjax = listByNamespaceDTAjax;
|
||||
module.exports.listChildrenDTAjax = listChildrenDTAjax;
|
||||
module.exports.listWithContentDTAjax = listWithContentDTAjax;
|
||||
module.exports.listOthersWhoseListsAreIncludedDTAjax = listOthersWhoseListsAreIncludedDTAjax;
|
||||
|
|
|
@ -53,6 +53,33 @@ async function listDTAjax(context, params) {
|
|||
);
|
||||
}
|
||||
|
||||
async function listByNamespaceDTAjax(context, 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'),
|
||||
['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 listWithSegmentByCampaignDTAjax(context, campaignId, params) {
|
||||
return await dtHelpers.ajaxListWithPermissions(
|
||||
context,
|
||||
|
@ -260,6 +287,7 @@ async function remove(context, id) {
|
|||
module.exports.UnsubscriptionMode = UnsubscriptionMode;
|
||||
module.exports.hash = hash;
|
||||
module.exports.listDTAjax = listDTAjax;
|
||||
module.exports.listByNamespaceDTAjax = listByNamespaceDTAjax;
|
||||
module.exports.listWithSegmentByCampaignDTAjax = listWithSegmentByCampaignDTAjax;
|
||||
module.exports.getByIdTx = getByIdTx;
|
||||
module.exports.getById = getById;
|
||||
|
|
|
@ -19,6 +19,10 @@ 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) => {
|
||||
return res.json(await campaigns.listByNamespaceDTAjax(req.context, castToInteger(req.params.namespaceId), req.body));
|
||||
});
|
||||
|
||||
router.postAsync('/campaigns-children/:campaignId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await campaigns.listChildrenDTAjax(req.context, castToInteger(req.params.campaignId), req.body));
|
||||
});
|
||||
|
|
|
@ -11,6 +11,10 @@ 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) => {
|
||||
return res.json(await lists.listDTAjax(req.context, 1));
|
||||
});
|
||||
|
||||
router.postAsync('/lists-with-segment-by-campaign-table/:campaignId', passport.loggedIn, async (req, res) => {
|
||||
return res.json(await lists.listWithSegmentByCampaignDTAjax(req.context, castToInteger(req.params.campaignId), req.body));
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue