Files
librenms-librenms/html/includes/modal/delete_host_dependency.inc.php
Aldemir Akpinar 56561aa4dc feature: Added support for Host dependencies (#7332)
* First draft of the modals and the config interfaces

* GUI part done

* Backend code and db schema addition

* Documentation added, fixed alerting bug

* Fix typos

* Do not try to push an older db_schame.yaml

* Small db fix

* More db fixes

* Travis CI fixes

* missed a line in the travis error

* Fixed dependency clearing bug, Manage Host dependencies button now shows current selections

* Removed unnecessary index

* Correct faulty query

* Fixed sql query as requested, and renamed sql file

* Added requested changes

* Removed debug code

* Renamed sql file

* More fixes as requested

* Trying to fix db_schema.yaml

* adding laf's diff

* Corrected a small bug

* Try to resolve scrutinizer issue

* Main page bootgrid ajax modifications

* Also corrected travis ci errors

* Added select2 for pull downs, removed a redundant debug output. Changed parent_id to text

* Add missing class in the device settings page

* Fix bug where a link wasn't added after save

* Better parent down detection

* Add missing comma

* Behold the multi-parent code

* Added lookup table

* Ready for testing

* Trying to fix documentation conflicts

* Fix copy paste errors, and possible sql injection

* indentation problems

* Modified db_schema.yaml as well

* Typos, typos

* This should correct alerts

* Try to fix travis ci error

* Fix the typo in index.php

* Changed to Tony's query

* function explanation text changed

* Updated db_schema.yaml

* Trying to make automated tests happy

* Changes as requested

* Added acknowledgment for select2

* Added laf's patch

* dbBulkInsert when adding parents
2017-12-20 14:17:52 +00:00

73 lines
2.8 KiB
PHP

<?php
/*
* LibreNMS
*
* Copyright (c) 2017 Aldemir Akpinar <https://github.com/aldemira>
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version. Please see LICENSE.txt at the top level of
* the source code distribution for details.
*/
if (is_admin() === false) {
die('ERROR: You need to be admin');
}
?>
<div class="modal fade" id="confirm-delete" role="dialog" aria-labelledby="Delete" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h5 class="modal-title" id="Delete">Confirm Delete</h5>
</div>
<div class="modal-body">
<p>Clicking Delete will remove device dependency from <strong class="modalhostname"></strong></p>
</div>
<div class="modal-footer">
<form role="form" class="remove_token_form">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="submit" class="btn btn-danger danger" id="hostdep-removal" data-target="hostdep-removal">Delete</button>
<input type="hidden" name="row_id" id="delete-row_id" value="">
<input type="hidden" name="device_id" id="delete-device_id" value="">
<input type="hidden" name="parent_id" id="delete-parent_id" value="">
<input type="hidden" name="confirm" id="confirm" value="yes">
</form>
</div>
</div>
</div>
</div>
<script>
$('#hostdep-removal').click('', function(event) {
event.preventDefault();
var parent_id = $("#delete-parent_id").val();
var device_id = $("#delete-device_id").val();
var row_id = $("#delete-row_id").val();
$("#modal_hostname").text();
$.ajax({
type: 'POST',
url: 'ajax_form.php',
data: { type: "delete-host-dependency", device_id: device_id },
dataType: "json",
success: function(output) {
if (output.status == 0) {
toastr.success(output.message);
$("#confirm-delete").modal('hide');
// Clear the host association from html
$('[data-row-id=' + row_id + ']').find('.parenthost').text('None');
} else {
toastr.error(output.message);
}
},
error: function() {
toastr.error('The device dependency could not be deleted.');
$("#confirm-delete").modal('hide');
}
});
});
</script>