Skip to content

Commit

Permalink
Fix "mark planned"/"mark installed" button on device component table …
Browse files Browse the repository at this point in the history
…views (nautobot#5863)
  • Loading branch information
glennmatthews authored Jun 28, 2024
1 parent 408452e commit 2c8b28d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions changes/5804.fixed
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed operation of "Mark planned"/"Mark installed" button in Device component table views.
2 changes: 1 addition & 1 deletion nautobot/core/celery/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def _import_jobs_from_git_repositories():
and not GitRepository.objects.filter(slug=filename).exists()
):
logger.warning("Deleting unmanaged (leftover?) Git repository clone at %s", filepath)
shutil.rmtree(filepath)
shutil.rmtree(filepath, ignore_errors=True)

# Make sure all GitRepository records that include Jobs have up-to-date git clones, and load their jobs
for repo in GitRepository.objects.filter(provided_contents__contains="extras.job"):
Expand Down
13 changes: 7 additions & 6 deletions nautobot/project-static/js/connection_toggles.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,42 @@
function toggleConnection(elem) {
var url = nautobot_api_path + "dcim/cables/" + elem.attr('data') + "/";
elem.tooltip("destroy");
if (elem.hasClass('connected')) {
$.ajax({
url: url,
method: 'PATCH',
contentType: "application/json",
dataType: 'json',
beforeSend: function(xhr, settings) {
xhr.setRequestHeader("X-CSRFToken", nautobot_csrf_token);
},
data: {
'status': 'planned'
},
data: JSON.stringify({'status': 'Planned'}),
context: this,
success: function() {
elem.parents('tr').removeClass('success').addClass('info');
elem.removeClass('connected btn-warning').addClass('btn-success');
elem.attr('title', 'Mark installed');
elem.children('i').removeClass('mdi mdi-lan-disconnect').addClass('mdi mdi-lan-connect')
elem.tooltip("show");
}
});
} else {
$.ajax({
url: url,
method: 'PATCH',
contentType: "application/json",
dataType: 'json',
beforeSend: function(xhr, settings) {
xhr.setRequestHeader("X-CSRFToken", nautobot_csrf_token);
},
data: {
'status': 'connected'
},
data: JSON.stringify({'status': 'Connected'}),
context: this,
success: function() {
elem.parents('tr').removeClass('info').addClass('success');
elem.removeClass('btn-success').addClass('connected btn-warning');
elem.attr('title', 'Mark planned');
elem.children('i').removeClass('mdi mdi-lan-connect').addClass('mdi mdi-lan-disconnect')
elem.tooltip("show");
}
});
}
Expand Down

0 comments on commit 2c8b28d

Please sign in to comment.