Delete a template from Dashboard (#257)
* Integrated embedded config parsing #245 * cleanup * Cleanup in remotelog * Fixed MS Visual Studio 2019 compatibility * Embedded config parsing only for miner not server * wip * Finished delete template
This commit is contained in:
parent
5b0fed8be9
commit
78809d44bc
3 changed files with 67 additions and 3 deletions
53
index.html
53
index.html
|
@ -292,12 +292,14 @@
|
|||
|
||||
if (arrayLength > 0 ) {
|
||||
$('#templateEditorSave').prop('disabled', false);
|
||||
$('#templateEditorDeleteDialog').prop('disabled', false);
|
||||
|
||||
$('#templateSelector').html(htmlContent);
|
||||
$('#templateSelector').selectpicker('refresh');
|
||||
$('#templateSelector').trigger('change');
|
||||
} else {
|
||||
$('#templateEditorSave').prop('disabled', true);
|
||||
$('#templateEditorDeleteDialog').prop('disabled', true);
|
||||
}
|
||||
|
||||
$('#templateEditor').modal('show');
|
||||
|
@ -511,6 +513,10 @@
|
|||
$('#templateDialogSaveAs').modal('show');
|
||||
});
|
||||
|
||||
$('#templateEditorDeleteDialog').click(function(event) {
|
||||
$('#templateDialogDelete').modal('show');
|
||||
});
|
||||
|
||||
$('#templateEditorSaveAs').click(function(event) {
|
||||
var templateId = $('#templateName').val();
|
||||
var template = $('#template').val();
|
||||
|
@ -520,6 +526,12 @@
|
|||
$('#templateEditor').modal('hide');
|
||||
});
|
||||
|
||||
$('#templateEditorDelete').click(function(event) {
|
||||
var templateId = $('#templateSelector').val();
|
||||
|
||||
deleteTemplateConfig(templateId, template);
|
||||
});
|
||||
|
||||
$('#clientStatusList tbody').on( 'click', 'button#LOG', function () {
|
||||
var data = table.row( $(this).parents('tr') ).data();
|
||||
var clientId = data['client_status']['client_id'];
|
||||
|
@ -856,6 +868,20 @@
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
function deleteTemplateConfig(templateId) {
|
||||
$.ajax({
|
||||
url: "/admin/deleteClientConfig?clientId=template_" + templateId,
|
||||
type: 'POST',
|
||||
dataType: "text",
|
||||
success: function(data){
|
||||
setSuccess('<strong>Successfully deleted template: ' + templateId + '</strong>');
|
||||
},
|
||||
error: function (data) {
|
||||
setError('<strong>Failed to delete template: ' + templateId + '</strong> \nError: ' + JSON.stringify(data,undefined, 2));
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
|
@ -982,7 +1008,8 @@
|
|||
<div class="modal-footer">
|
||||
<button id="templateEditorSave" type="button" class="btn btn-success" data-dismiss="modal">Save</button>
|
||||
<button id="templateEditorSaveAsDialog" type="button" class="btn btn-primary">Save As...</button>
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
|
||||
<button id="templateEditorDeleteDialog" type="button" class="btn btn-danger" data-dismiss="modal">Delete</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1003,7 +1030,27 @@
|
|||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="templateEditorSaveAs" type="button" class="btn btn-success" data-dismiss="modal">Save</button>
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="templateDialogDelete" role="dialog">
|
||||
<div class="modal-dialog modal-lg">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Delete</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group">
|
||||
<label for="templateName">Do you really want to delete this template?</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="templateEditorDelete" type="button" class="btn btn-danger" data-dismiss="modal">Delete</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1034,7 +1081,7 @@
|
|||
</div>
|
||||
<div class="modal-footer">
|
||||
<button id="assignTemplate" type="button" class="btn btn-success" data-dismiss="modal">Assign</button>
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue