mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Fixes #840: Correct API path resolution for secrets when BASE_PATH is configured
This commit is contained in:
parent
d36923e47d
commit
1bddd038fe
@ -48,7 +48,7 @@ $(document).ready(function() {
|
||||
$('#generate_keypair').click(function() {
|
||||
$('#new_keypair_modal').modal('show');
|
||||
$.ajax({
|
||||
url: '/api/secrets/generate-keys/',
|
||||
url: netbox_api_path + 'secrets/generate-keys/',
|
||||
type: 'GET',
|
||||
dataType: 'json',
|
||||
success: function (response, status) {
|
||||
@ -75,7 +75,7 @@ $(document).ready(function() {
|
||||
function unlock_secret(secret_id, private_key) {
|
||||
var csrf_token = $('input[name=csrfmiddlewaretoken]').val();
|
||||
$.ajax({
|
||||
url: '/api/secrets/secrets/' + secret_id + '/',
|
||||
url: netbox_api_path + 'secrets/secrets/' + secret_id + '/',
|
||||
type: 'POST',
|
||||
data: {
|
||||
private_key: private_key
|
||||
|
@ -296,6 +296,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
<script type="text/javascript">
|
||||
var netbox_api_path = "/{{ settings.BASE_PATH }}api/";
|
||||
</script>
|
||||
<script src="{% static 'js/jquery-2.1.4.min.js' %}"></script>
|
||||
<script src="{% static 'jquery-ui-1.11.4/jquery-ui.min.js' %}"></script>
|
||||
<script src="{% static 'bootstrap-3.3.6-dist/js/bootstrap.min.js' %}"></script>
|
||||
|
@ -550,7 +550,7 @@
|
||||
function toggleConnection(elem, api_url) {
|
||||
if (elem.hasClass('connected')) {
|
||||
$.ajax({
|
||||
url: api_url + elem.attr('data') + "/",
|
||||
url: netbox_api_path + api_url + elem.attr('data') + "/",
|
||||
method: 'PATCH',
|
||||
dataType: 'json',
|
||||
beforeSend: function(xhr, settings) {
|
||||
@ -590,13 +590,13 @@ function toggleConnection(elem, api_url) {
|
||||
return false;
|
||||
}
|
||||
$(".consoleport-toggle").click(function() {
|
||||
return toggleConnection($(this), "/{{ settings.BASE_PATH }}api/dcim/console-ports/");
|
||||
return toggleConnection($(this), "dcim/console-ports/");
|
||||
});
|
||||
$(".powerport-toggle").click(function() {
|
||||
return toggleConnection($(this), "/{{ settings.BASE_PATH }}api/dcim/power-ports/");
|
||||
return toggleConnection($(this), "dcim/power-ports/");
|
||||
});
|
||||
$(".interface-toggle").click(function() {
|
||||
return toggleConnection($(this), "/{{ settings.BASE_PATH }}api/dcim/interface-connections/");
|
||||
return toggleConnection($(this), "dcim/interface-connections/");
|
||||
});
|
||||
</script>
|
||||
<script src="{% static 'js/graphs.js' %}"></script>
|
||||
|
Loading…
Reference in New Issue
Block a user