Remove Simulate Incident button (#4479)

# What this PR does

Removes "Simulate Incident" button which is replaced by "Send Demo
Alert" button

Co-authored-by: Joey Orlando <joey.orlando@grafana.com>
This commit is contained in:
Ildar Iskhakov 2024-06-07 21:54:45 +08:00 committed by GitHub
parent a9ff1cbc33
commit 5ffbc18dc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 0 additions and 41 deletions

View file

@ -13,10 +13,6 @@ class BrowsableInstructionMixin:
# TODO Create associative array for integrations
base_integration_docs_url = create_engine_url("/#/integrations/", override_base=settings.DOCS_URL)
docs_url = f'{base_integration_docs_url}{request.get_full_path().split("/")[3]}'
show_button = True
if request.get_full_path().split("/")[3] == "amazon_sns":
show_button = False
source = " ".join(map(lambda x: x.capitalize(), request.get_full_path().split("/")[3].split("_")))
if request.alert_receive_channel.config.example_payload:
payload = request.alert_receive_channel.config.example_payload
payload = json.dumps(payload)
@ -29,8 +25,6 @@ class BrowsableInstructionMixin:
"url": request.get_full_path,
"docs_url": docs_url,
"payload": payload,
"source": source,
"show_button": show_button,
}
)
)

View file

@ -30,13 +30,6 @@
Copy to clipboard
</button>
</p>
{% if show_button %}
<p>
<button class="btn btn-primary" id="post_example">
Simulate incident from {{ source }}
</button>
</p>
{% endif %}
<p>
<a href={{ docs_url }} class="btn btn-success">Go to the Guide</a>
</p>
@ -51,33 +44,5 @@
})
});
</script>
<script>
$("#post_example").click(function(e) {
e.preventDefault();
Cookies.remove('csrftoken');
$.ajax({
type: "POST",
url: "{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.META.HTTP_HOST }}{{ url }}",
data: '{{ payload|safe }}',
contentType: "application/json; charset=utf-8",
success: function(result) {
$('#post_example').attr('title', "Success")
.tooltip({
trigger: 'click',
placement: 'right'
});
},
error: function(result) {
console.log(result)
$('#post_example').attr('title', "Error")
.tooltip({
trigger: 'click',
placement: 'right'
});
},
});
});
</script>
</body>
</html>