improve delete modal and add log message
This commit is contained in:
		| @@ -98,30 +98,33 @@ | ||||
|     <tr data-for-device="[% d.dns || d.ip %]"> | ||||
|       <td>Admin Tasks</td> | ||||
|       <td> | ||||
|         <input type="hidden" data-form="discover" value="[% d.ip %]" name="device" type="text"/> | ||||
|         <button class="btn btn-info btn-small nd_adminbutton" name="discover" type="submit">Discover</button> | ||||
|         <input type="hidden" data-form="arpnip" value="[% d.ip %]" name="device" type="text"/> | ||||
|         <button class="btn btn-info btn-small nd_adminbutton" name="arpnip" type="submit">Arpnip</button> | ||||
|         <input type="hidden" data-form="macsuck" value="[% d.ip %]" name="device" type="text"/> | ||||
|         <button class="btn btn-info btn-small nd_adminbutton" name="macsuck" type="submit">Macsuck</button> | ||||
|         <input type="hidden" data-form="discover" value="[% d.ip %]" name="device"/> | ||||
|         <button class="btn btn-info btn-small nd_adminbutton" name="discover">Discover</button> | ||||
|         <input type="hidden" data-form="arpnip" value="[% d.ip %]" name="device"/> | ||||
|         <button class="btn btn-info btn-small nd_adminbutton" name="arpnip">Arpnip</button> | ||||
|         <input type="hidden" data-form="macsuck" value="[% d.ip %]" name="device"/> | ||||
|         <button class="btn btn-info btn-small nd_adminbutton" name="macsuck">Macsuck</button> | ||||
|  | ||||
|         <input type="hidden" data-form="delete" value="[% d.ip %]" name="device" type="text"/> | ||||
|         <button class="btn btn-danger btn-small pull-right" | ||||
|           data-toggle="modal" data-target="#deleteConfirm" type="button">Delete</button> | ||||
|  | ||||
|         <div id="deleteConfirm" class="modal hide fade" tabindex="-1" | ||||
|         <div id="deleteConfirm" class="nd_modal modal hide fade" tabindex="-1" | ||||
|           role="dialog" aria-labelledby="deleteConfirmLabel" aria-hidden="true"> | ||||
|  | ||||
|           <div class="modal-header"> | ||||
|             <button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button> | ||||
|             <h3 id="deleteConfirmLabel">Confirm Delete</h3> | ||||
|             <h3 id="deleteConfirmLabel">Confirm Delete: [% d.dns || d.ip | html_entity %]</h3> | ||||
|           </div> | ||||
|           <div class="modal-body"> | ||||
|             <p>Deleting device "[% d.dns || d.ip | html_entity %]" is not reversible | ||||
|             and will also remove all associated Nodes from the database.</p> | ||||
|             <ul> | ||||
|               <li>This action is not reversible</li> | ||||
|               <li>All associated Nodes will be removed from the database</li> | ||||
|             </ul> | ||||
|             <p>Log message:</p> | ||||
|             <textarea class="input-block-level" rows="2" data-form="delete" name="log"></textarea> | ||||
|             <input type="hidden" data-form="delete" value="[% d.ip %]" name="device"/> | ||||
|           </div> | ||||
|           <div class="modal-footer"> | ||||
|             <button class="btn" data-dismiss="modal" aria-hidden="true">No!</button> | ||||
|             <button class="btn btn-success" data-dismiss="modal" aria-hidden="true">No !</button> | ||||
|             <button class="btn btn-danger nd_adminbutton" name="delete" data-dismiss="modal">Really Delete</button> | ||||
|           </div> | ||||
|         </div> | ||||
|   | ||||
| @@ -27,7 +27,8 @@ | ||||
|       $('#nd_netmap-help').hide(); | ||||
|     } | ||||
|  | ||||
|     // activate tooltips and popovers | ||||
|     // activate modals, tooltips and popovers | ||||
|     $('.nd_modal').modal({show: false}); | ||||
|     $("[rel=tooltip]").tooltip({live: true}); | ||||
|     $("[rel=popover]").popover({live: true}); | ||||
|   } | ||||
| @@ -37,7 +38,7 @@ | ||||
|     var tab = '[% tab.tag %]' | ||||
|     var target = '#' + tab + '_pane'; | ||||
|  | ||||
|     // sidebar form fields should change colour and have bin/copy icon | ||||
|     // sidebar form fields should change colour and have trash/copy icon | ||||
|     form_inputs.each(function() {device_form_state($(this))}); | ||||
|     form_inputs.change(function() {device_form_state($(this))}); | ||||
|  | ||||
| @@ -52,7 +53,7 @@ | ||||
|         .toggleClass('icon-chevron-up icon-chevron-down'); | ||||
|     }); | ||||
|  | ||||
|     // handler for bin icon in port filter box | ||||
|     // handler for trashcan icon in port filter box | ||||
|     var portfilter = $('#ports_form').find("input[name=f]"); | ||||
|     $('.nd_field-clear-icon').click(function() { | ||||
|       portfilter.val(''); | ||||
| @@ -86,8 +87,6 @@ | ||||
|         } | ||||
|     }); | ||||
|  | ||||
|     $('#deleteConfirm').modal(); | ||||
|  | ||||
|     // activity for admin tasks in device details | ||||
|     $('#details_pane').on('click', '.nd_adminbutton', function(event) { | ||||
|       // stop form from submitting normally | ||||
| @@ -103,7 +102,7 @@ | ||||
|         ,async: true | ||||
|         ,dataType: 'html' | ||||
|         ,url: uri_base + '/ajax/control/admin/' + mode | ||||
|         ,data: tr.find('input[data-form="' + mode + '"]').serializeArray() | ||||
|         ,data: tr.find('input[data-form="' + mode + '"],textarea[data-form="' + mode + '"]').serializeArray() | ||||
|         ,success: function() { | ||||
|           toastr.info('Queued '+ mode +' for device '+ tr.attr('data-for-device')); | ||||
|         } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user