Merge pull request #601 from grafana/rares/fix-schedule-id=new
fix for webhook
This commit is contained in:
commit
565c1dc201
2 changed files with 12 additions and 8 deletions
|
|
@ -60,14 +60,19 @@ class OutgoingWebhooks extends React.Component<OutgoingWebhooksProps, OutgoingWe
|
|||
query: { id },
|
||||
} = this.props;
|
||||
|
||||
if (id) {
|
||||
const outgoingWebhook = await store.outgoingWebhookStore
|
||||
if (!id) {return;}
|
||||
|
||||
let outgoingWebhook: OutgoingWebhook | void = undefined;
|
||||
const isNewWebhook = id === 'new';
|
||||
|
||||
if (!isNewWebhook) {
|
||||
outgoingWebhook = await store.outgoingWebhookStore
|
||||
.loadItem(id, true)
|
||||
.catch((error) => this.setState({ errorData: { ...getWrongTeamResponseInfo(error) } }));
|
||||
}
|
||||
|
||||
if (outgoingWebhook) {
|
||||
this.setState({ outgoingWebhookIdToEdit: id });
|
||||
}
|
||||
if (outgoingWebhook || isNewWebhook) {
|
||||
this.setState({ outgoingWebhookIdToEdit: id });
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -87,8 +87,8 @@ class SchedulesPage extends React.Component<SchedulesPageProps, SchedulesPageSta
|
|||
|
||||
if (!id) {return;}
|
||||
|
||||
let scheduleId: string = undefined;
|
||||
const isNewSchedule = id === 'new';
|
||||
let scheduleId = undefined;
|
||||
|
||||
if (!isNewSchedule) {
|
||||
// load schedule only for valid id
|
||||
|
|
@ -99,8 +99,7 @@ class SchedulesPage extends React.Component<SchedulesPageProps, SchedulesPageSta
|
|||
return;
|
||||
}
|
||||
|
||||
const schedules = store.scheduleStore.getSearchResult();
|
||||
scheduleId = schedules && schedules.find((res) => res.id === id)?.id;
|
||||
scheduleId = schedule.id;
|
||||
}
|
||||
|
||||
if (scheduleId || isNewSchedule) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue