mirror of
https://github.com/prymitive/karma
synced 2026-05-19 04:26:41 +00:00
fix(ui): render correct link after adding new silence to Alertmanager
This commit is contained in:
@@ -46,7 +46,8 @@ const SilenceSubmitProgress = observer(
|
||||
static propTypes = {
|
||||
name: PropTypes.string.isRequired,
|
||||
uri: PropTypes.string.isRequired,
|
||||
payload: PropTypes.object.isRequired
|
||||
payload: PropTypes.object.isRequired,
|
||||
alertStore: PropTypes.object.isRequired
|
||||
};
|
||||
|
||||
submitState = observable(
|
||||
@@ -83,13 +84,22 @@ const SilenceSubmitProgress = observer(
|
||||
};
|
||||
|
||||
parseAlertmanagerResponse = response => {
|
||||
const { uri } = this.props;
|
||||
const { name, alertStore } = this.props;
|
||||
|
||||
const alertmanager = alertStore.data.getAlertmanagerByName(name);
|
||||
|
||||
if (response.status === "success") {
|
||||
const link = (
|
||||
<SilenceLink uri={uri} silenceId={response.data.silenceId} />
|
||||
);
|
||||
this.submitState.markDone(link);
|
||||
if (alertmanager) {
|
||||
const link = (
|
||||
<SilenceLink
|
||||
uri={alertmanager.uri}
|
||||
silenceId={response.data.silenceId}
|
||||
/>
|
||||
);
|
||||
this.submitState.markDone(link);
|
||||
} else {
|
||||
this.submitState.markDone(response.data.silenceId);
|
||||
}
|
||||
} else if (response.status === "error") {
|
||||
this.submitState.markFailed(response.error);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user