fixed xml export for site + location (#317)
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -145,9 +145,33 @@ downloadXmlButton.addEventListener('click', (e) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function performXmlDownload() {
|
function performXmlDownload() {
|
||||||
|
|
||||||
const tempDownloadLink = document.createElement('a');
|
const tempDownloadLink = document.createElement('a');
|
||||||
|
|
||||||
fetch('/api/plugins/netbox_topology_views/xml-export/?' + new URLSearchParams(window.location.search)).then(response => response.text())
|
let xml_search_options = '';
|
||||||
|
|
||||||
|
if (typeof is_htmx !== 'undefined') {
|
||||||
|
var curr_url = window.location.href;
|
||||||
|
const sites_prefix = '/sites/'
|
||||||
|
const location_prefix = '/locations/'
|
||||||
|
if (curr_url.includes(sites_prefix)) {
|
||||||
|
var site_id = curr_url.split(sites_prefix)[1];
|
||||||
|
site_id = site_id.split('/')[0]
|
||||||
|
xml_search_options = 'site_id=' + site_id + '&show_cables=on&show_unconnected=on'
|
||||||
|
}
|
||||||
|
else if (curr_url.includes(location_prefix)) {
|
||||||
|
var location_id = curr_url.split(location_prefix)[1];
|
||||||
|
location_id = location_id.split('/')[0]
|
||||||
|
xml_search_options = 'location_id=' + location_id + '&show_cables=on&show_unconnected=on'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
xml_search_options = new URLSearchParams(window.location.search);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
fetch('/api/plugins/netbox_topology_views/xml-export/?' + xml_search_options).then(response => response.text())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
var blob = new Blob([data ], { type: "text/plain" });
|
var blob = new Blob([data ], { type: "text/plain" });
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,8 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
const brokenImage = '{{ broken_image }}';
|
var is_htmx = true;
|
||||||
const topologyData = {{ topology_data | safe }};
|
var brokenImage = '{{ broken_image }}';
|
||||||
|
var topologyData = {{ topology_data | safe }};
|
||||||
</script>
|
</script>
|
||||||
<script src="{% static 'netbox_topology_views/js/app.js' %}?ver={{ epoch }} " defer></script>
|
<script src="{% static 'netbox_topology_views/js/app.js' %}?ver={{ epoch }} " defer></script>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<a role="button" class="btn btn-sm btn-primary" title="Topology" href="#" hx-get="/plugins/netbox_topology_views/topology/?location_id={{ object.id }}&show_cables=on&show_logical_connections=on&show_neighbors=on" hx-target="#htmx-modal-content" data-bs-toggle="modal" data-bs-target="#htmx-modal">
|
<a role="button" class="btn btn-sm btn-primary" title="Topology" href="#" hx-get="/plugins/netbox_topology_views/topology/?location_id={{ object.id }}&show_cables=on&show_unconnected=on" hx-target="#htmx-modal-content" data-bs-toggle="modal" data-bs-target="#htmx-modal">
|
||||||
<i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i>
|
<i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i>
|
||||||
Topology
|
Topology
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<a role="button" class="btn btn-sm btn-primary" title="Topology" href="#" hx-get="/plugins/netbox_topology_views/topology/?site_id={{ object.id }}&show_cables=on" hx-target="#htmx-modal-content" data-bs-toggle="modal" data-bs-target="#htmx-modal">
|
<a role="button" class="btn btn-sm btn-primary" title="Topology" href="#" hx-get="/plugins/netbox_topology_views/topology/?site_id={{ object.id }}&show_cables=on&show_unconnected=on" hx-target="#htmx-modal-content" data-bs-toggle="modal" data-bs-target="#htmx-modal">
|
||||||
<i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i>
|
<i class="mdi mdi-transit-connection-variant" aria-hidden="true"></i>
|
||||||
Topology
|
Topology
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
Reference in New Issue
Block a user