diff --git a/index.html b/index.html index e32e628f..58e12adf 100755 --- a/index.html +++ b/index.html @@ -242,7 +242,7 @@ { text: ' Assign template', className: 'btn-info', - enabled: true, + enabled: false, action: function () { $.ajax({ type: "GET", @@ -292,14 +292,14 @@ if (arrayLength > 0 ) { $('#templateEditorSave').prop('disabled', false); - $('#templateEditorDelete').prop('disabled', false); + $('#templateEditorDeleteDialog').prop('disabled', false); $('#templateSelector').html(htmlContent); $('#templateSelector').selectpicker('refresh'); $('#templateSelector').trigger('change'); } else { $('#templateEditorSave').prop('disabled', true); - $('#templateEditorDelete').prop('disabled', true); + $('#templateEditorDeleteDialog').prop('disabled', true); } $('#templateEditor').modal('show'); @@ -513,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(); @@ -522,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']; @@ -858,6 +868,20 @@ } }); } + + function deleteTemplateConfig(templateId) { + $.ajax({ + url: "/admin/deleteClientConfig?clientId=template_" + templateId, + type: 'POST', + dataType: "text", + success: function(data){ + setSuccess('Successfully deleted template: ' + templateId + ''); + }, + error: function (data) { + setError('Failed to delete template: ' + templateId + ' \nError: ' + JSON.stringify(data,undefined, 2)); + } + }); + } @@ -982,10 +1006,10 @@ @@ -1006,7 +1030,27 @@ + + + + +