|
@@ -154,6 +154,7 @@ type State = AsyncView['state'] & {
|
|
|
issueCount: number;
|
|
|
loadingPreview: boolean;
|
|
|
previewCursor: string | null | undefined;
|
|
|
+ previewEndpoint: null | string;
|
|
|
previewError: boolean;
|
|
|
previewGroups: string[] | null;
|
|
|
previewPage: number;
|
|
@@ -251,6 +252,7 @@ class IssueRuleEditor extends AsyncView<Props, State> {
|
|
|
sendingNotification: false,
|
|
|
incompatibleConditions: null,
|
|
|
incompatibleFilters: null,
|
|
|
+ previewEndpoint: null,
|
|
|
};
|
|
|
|
|
|
const projectTeamIds = new Set(project.teams.map(({id}) => id));
|
|
@@ -365,7 +367,7 @@ class IssueRuleEditor extends AsyncView<Props, State> {
|
|
|
|
|
|
fetchPreview = (resetCursor = false) => {
|
|
|
const {organization} = this.props;
|
|
|
- const {project, rule, previewCursor} = this.state;
|
|
|
+ const {project, rule, previewCursor, previewEndpoint} = this.state;
|
|
|
|
|
|
if (!rule || !organization.features.includes('issue-alert-preview')) {
|
|
|
return;
|
|
@@ -390,6 +392,7 @@ class IssueRuleEditor extends AsyncView<Props, State> {
|
|
|
actionMatch: rule?.actionMatch || 'all',
|
|
|
filterMatch: rule?.filterMatch || 'all',
|
|
|
frequency: rule?.frequency || 60,
|
|
|
+ endpoint: previewEndpoint,
|
|
|
},
|
|
|
})
|
|
|
.then(([data, _, resp]) => {
|
|
@@ -397,6 +400,7 @@ class IssueRuleEditor extends AsyncView<Props, State> {
|
|
|
|
|
|
const pageLinks = resp?.getResponseHeader('Link');
|
|
|
const hits = resp?.getResponseHeader('X-Hits');
|
|
|
+ const endpoint = resp?.getResponseHeader('Endpoint');
|
|
|
const issueCount =
|
|
|
typeof hits !== 'undefined' && hits ? parseInt(hits, 10) || 0 : 0;
|
|
|
this.setState({
|
|
@@ -405,6 +409,7 @@ class IssueRuleEditor extends AsyncView<Props, State> {
|
|
|
pageLinks: pageLinks ?? '',
|
|
|
issueCount,
|
|
|
loadingPreview: false,
|
|
|
+ previewEndpoint: endpoint ?? null,
|
|
|
});
|
|
|
})
|
|
|
.catch(_ => {
|