Templates namespace filtering & fix

This commit is contained in:
Carlos 2019-03-20 08:57:06 +01:00
parent b6a896558e
commit 444717b4d0
5 changed files with 34 additions and 7 deletions

View file

@ -238,6 +238,7 @@ 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: '',
@ -526,6 +527,7 @@ export default class CUD extends Component {
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 + '_';
@ -569,6 +571,7 @@ 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} />
}
@ -581,7 +584,6 @@ export default class CUD extends Component {
{selectedList && this.getFormValue(prefix + 'useSegmentation') &&
<TableSelect id={prefix + 'segment'} withHeader dropdown dataUrl={`rest/segments-table/${selectedList}`} columns={segmentsColumns} selectionLabelIndex={1} />
}
<CheckBox id={prefix + "work_list_current_namespace"} label={t('namespaceFiltering')} text={t('workWithCurrentNamespace')}/>
</div>
}
</div>
@ -679,7 +681,13 @@ 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
templateEdit = <TableSelect key="templateSelect" id="data_sourceTemplate" label={t('template')} withHeader dropdown dataUrl='rest/templates-table' columns={templatesColumns} selectionLabelIndex={1} help={help}/>;
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}/>;
}
} else if (!isEdit && sourceTypeKey === CampaignSource.CUSTOM_FROM_CAMPAIGN) {
const campaignsColumns = [
@ -753,16 +761,18 @@ export default class CUD extends Component {
<Title>{t('sendSettings')}</Title>
<CheckBox id="work_send_config_current_namespace" label={t('namespaceFiltering')} text={t('workWithCampaignNamespace')}/>
{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} />
}
<CheckBox id="work_send_config_current_namespace" label={t('namespaceFiltering')} text={t('workWithCurrentNamespace')}/>
{sendSettings}
<InputField id="unsubscribe_url" label={t('customUnsubscribeUrl')}/>
<hr/>
@ -770,10 +780,12 @@ export default class CUD extends Component {
<CheckBox id="open_tracking_disabled" text={t('disableOpenedTracking')}/>
<CheckBox id="click_tracking_disabled" text={t('disableClickedTracking')}/>
{sourceEdit && <hr/> }
<Title>{t('template')}</Title>
{sourceEdit}
<CheckBox id="work_template_current_namespace" label={t('namespaceFiltering')} text={t('workWithCampaignNamespace')}/>
{templateEdit}
<ButtonRow>