Fix for #659
This commit is contained in:
parent
ebb6c2ff74
commit
a17ee3d9bf
3 changed files with 46 additions and 16 deletions
|
@ -35,6 +35,7 @@ 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";
|
||||||
|
import interoperableErrors from "../../../shared/interoperable-errors";
|
||||||
|
|
||||||
@withComponentMixins([
|
@withComponentMixins([
|
||||||
withTranslation,
|
withTranslation,
|
||||||
|
@ -157,6 +158,7 @@ export default class CUD extends Component {
|
||||||
if (sendConfigurationId) {
|
if (sendConfigurationId) {
|
||||||
this.fetchSendConfigurationId = sendConfigurationId;
|
this.fetchSendConfigurationId = sendConfigurationId;
|
||||||
|
|
||||||
|
try {
|
||||||
const result = await axios.get(getUrl(`rest/send-configurations-public/${sendConfigurationId}`));
|
const result = await axios.get(getUrl(`rest/send-configurations-public/${sendConfigurationId}`));
|
||||||
|
|
||||||
if (sendConfigurationId === this.fetchSendConfigurationId) {
|
if (sendConfigurationId === this.fetchSendConfigurationId) {
|
||||||
|
@ -164,6 +166,15 @@ export default class CUD extends Component {
|
||||||
sendConfiguration: result.data
|
sendConfiguration: result.data
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof interoperableErrors.PermissionDeniedError) {
|
||||||
|
this.setState({
|
||||||
|
sendConfiguration: null
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -490,7 +490,8 @@ export default class Status extends Component {
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
entity: props.entity,
|
entity: props.entity,
|
||||||
sendConfiguration: null
|
sendConfiguration: null,
|
||||||
|
sendConfigurationNotPermitted: false
|
||||||
};
|
};
|
||||||
|
|
||||||
const { campaignTypeLabels, campaignStatusLabels } = getCampaignLabels(t);
|
const { campaignTypeLabels, campaignStatusLabels } = getCampaignLabels(t);
|
||||||
|
@ -507,18 +508,26 @@ export default class Status extends Component {
|
||||||
|
|
||||||
@withAsyncErrorHandler
|
@withAsyncErrorHandler
|
||||||
async refreshEntity() {
|
async refreshEntity() {
|
||||||
|
const newState = {}
|
||||||
|
|
||||||
let resp;
|
let resp;
|
||||||
|
|
||||||
resp = await axios.get(getUrl(`rest/campaigns-stats/${this.props.entity.id}`));
|
resp = await axios.get(getUrl(`rest/campaigns-stats/${this.props.entity.id}`));
|
||||||
const entity = resp.data;
|
newState.entity = resp.data;
|
||||||
|
|
||||||
resp = await axios.get(getUrl(`rest/send-configurations-public/${entity.send_configuration}`));
|
try {
|
||||||
const sendConfiguration = resp.data;
|
resp = await axios.get(getUrl(`rest/send-configurations-public/${newState.entity.send_configuration}`));
|
||||||
|
newState.sendConfiguration = resp.data;
|
||||||
|
} catch (err) {
|
||||||
|
if (err instanceof interoperableErrors.PermissionDeniedError) {
|
||||||
|
newState.sendConfiguration = null;
|
||||||
|
newState.sendConfigurationNotPermitted = true;
|
||||||
|
} else {
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.setState({
|
this.setState(newState);
|
||||||
entity,
|
|
||||||
sendConfiguration
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async periodicRefreshTask() {
|
async periodicRefreshTask() {
|
||||||
|
@ -562,9 +571,13 @@ export default class Status extends Component {
|
||||||
addOverridable('from_email', t('fromEmailAddress'));
|
addOverridable('from_email', t('fromEmailAddress'));
|
||||||
addOverridable('reply_to', t('replytoEmailAddress'));
|
addOverridable('reply_to', t('replytoEmailAddress'));
|
||||||
sendSettings.push(<AlignedRow key="subject" label={t('subjectLine')}>{entity.subject}</AlignedRow>);
|
sendSettings.push(<AlignedRow key="subject" label={t('subjectLine')}>{entity.subject}</AlignedRow>);
|
||||||
|
} else {
|
||||||
|
if (this.state.sendConfigurationNotPermitted) {
|
||||||
|
sendSettings = null;
|
||||||
} else {
|
} else {
|
||||||
sendSettings = <AlignedRow>{t('loadingSendConfiguration')}</AlignedRow>
|
sendSettings = <AlignedRow>{t('loadingSendConfiguration')}</AlignedRow>
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const listsColumns = [
|
const listsColumns = [
|
||||||
{ data: 1, title: t('name') },
|
{ data: 1, title: t('name') },
|
||||||
|
|
|
@ -150,12 +150,18 @@ class Table extends Component {
|
||||||
values: keysToFetch
|
values: keysToFetch
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const oldSelectionMap = this.selectionMap;
|
||||||
|
this.selectionMap = new Map();
|
||||||
for (const row of response.data) {
|
for (const row of response.data) {
|
||||||
const key = row[this.props.selectionKeyIndex];
|
const key = row[this.props.selectionKeyIndex];
|
||||||
if (this.selectionMap.has(key)) {
|
if (oldSelectionMap.has(key)) {
|
||||||
this.selectionMap.set(key, row);
|
this.selectionMap.set(key, row)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.selectionMap.size !== oldSelectionMap.size) {
|
||||||
|
this.notifySelection(this.props.onSelectionChangedAsync, this.selectionMap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue