fix(ui): render correct link after adding new silence to Alertmanager

This commit is contained in:
Łukasz Mierzwa
2018-09-18 21:48:25 +01:00
parent f55345437a
commit 052d54c9fe
8 changed files with 78 additions and 12 deletions

View File

@@ -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 {