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