diff --git a/README.md b/README.md index 4508cd0..4769731 100644 --- a/README.md +++ b/README.md @@ -27,8 +27,9 @@ Take a look at the github releases for detailed information about the features. ## Bugs in 0.5.2: - [ ] Reload page after session disconnect - [ ] Delete lun: check if line contains default parameter -- [ ] Session: After overwrite, you have to login again - After session expire logout, you have to login twice +- [ ] Session: + - [ ] After overwrite, you have to login again + - [ ] After session expire logout, you have to login twice - [ ] Error while submitting ## Roadmap @@ -105,11 +106,11 @@ In version 0.7: - [ ] Create complete documentation on https://readthedocs.org/ - [ ] Use unity testing -In version 0.8: +* In version 0.8: - [ ] Support for DRBD (show status) - [ ] Support for HA Clusters (Corosync & Pacemaker, only for iet) -In version 0.9: +* In version 0.9: - [ ] Support for nfs ## More diff --git a/app/config.db b/app/config.db deleted file mode 100644 index 3734669..0000000 Binary files a/app/config.db and /dev/null differ diff --git a/app/models/doc/target/add_acl.php b/app/models/doc/target/add_acl.php new file mode 100644 index 0000000..a4f2519 --- /dev/null +++ b/app/models/doc/target/add_acl.php @@ -0,0 +1,7 @@ + +
+
+ + +
+ + +
+ + +
+
+
+ + + + + + + + + + + + + + + + + + +
+ Username
+
+
+
+ + + \ No newline at end of file diff --git a/public/js/pages/adduser.js b/public/js/pages/adduser.js new file mode 100644 index 0000000..1ec453e --- /dev/null +++ b/public/js/pages/adduser.js @@ -0,0 +1,74 @@ +define(['jquery', 'mylibs', 'sweetalert'], function ($, mylibs, swal) { + var methods; + + return methods = { + enable_filter_table_plugin: function() { + $(document).ready(function(){ + // Enable filter table plugin + $('.searchabletable').filterTable({minRows:0}); + }); + }, + add_event_handler_adduserbutton: function () { + $(document).ready(function () { + $(document).once('click', '#adduserbutton', function () { + var selector_targetselection = $('#targetselection'); + var iqn = selector_targetselection.find("option:selected").val(); + var defaultvalue = selector_targetselection.find('#default').val(); + + if (iqn == defaultvalue) { + swal({ + title: 'Error', + type: 'error', + text: 'Please select a iqn!' + }); + } else if (!$(".addusercheckbox:checked").val()) { + swal({ + title: 'Error', + type: 'error', + text: 'Please select a user!' + }); + } else { + // Select radio + var type = $("input[name='type']:checked").val(); + + // loop through checkboxes + $(".addusercheckbox:checked").each(function () { + var $this = $(this); + var id = $this.closest('tr').find('.userid').text(); + + var data = { + "iqn": iqn, + "type": type, + "id": id + }; + + var request = mylibs.doajax("/phpietadmin/permission/adduser", data); + + request.done(function () { + if (request.readyState == 4 && request.status == 200) { + if (request.responseText == "Success") { + // uncheck all the checkbox + $this.removeAttr('checked'); + + swal({ + title: 'Success', + type: 'success' + }); + } else { + swal({ + title: 'Error', + type: 'error', + text: request.responseText + }); + } + mylibs.loadconfiguretargetbody('/phpietadmin/permission/adduser', iqn); + } + }); + }); + + } + }); + }); + } + }; +}); \ No newline at end of file diff --git a/public/js/pages/deletelun.js b/public/js/pages/deletelun.js new file mode 100644 index 0000000..211b43e --- /dev/null +++ b/public/js/pages/deletelun.js @@ -0,0 +1,51 @@ +define(['jquery', 'mylibs', 'sweetalert'], function($, mylibs, swal) { + var Methods; + return Methods = { + add_event_handler_deletelunbutton: function() { + $(document).ready(function(){ + $(document).once('click', '#deletelunbutton', function() { + var deletelunlunselection = $('#deletelunlunselection'); + var iqn = $('#targetselection').find("option:selected").val(); + + var data = { + "iqn": iqn, + "lun": deletelunlunselection.find('option:selected').val(), + "path": deletelunlunselection.find('option:selected').attr('name') + }; + + var request = mylibs.doajax("/phpietadmin/targets/deletelun", data); + + request.done(function () { + if (request.readyState == 4 && request.status == 200) { + if (request.responseText == "Success") { + swal({ + title: 'Success', + type: 'success' + }, + function () { + // remove selected element + deletelunlunselection.find('option:selected').remove(); + + if((deletelunlunselection.has('option').length) == 0) { + $('#configuretargetbody').replaceWith('
' + + '
' + + '' + + '
' + + '
') + } + }); + } else { + swal({ + title: 'Error', + type: 'error', + text: request.responseText + }); + } + + } + }) + }); + }); + } + }; +}); \ No newline at end of file diff --git a/public/js/pages/deletesession.js b/public/js/pages/deletesession.js new file mode 100644 index 0000000..07b3196 --- /dev/null +++ b/public/js/pages/deletesession.js @@ -0,0 +1,71 @@ +define(['jquery', 'mylibs', 'sweetalert', 'qtip'], function($, mylibs, swal, qtip) { + var methods; + + return methods = { + add_qtip_sessiondeletebutton: function() { + $(document).ready(function(){ + $('.sessiondeletebutton').qtip({ + content: { + text: 'Normally the initiator immediately reconnects. ' + + 'To disconnect an initiator permanently you have to deleted the acl allowing the connection ' + + 'before deleting the session.' + }, + style: { + classes: 'qtip-youtube' + } + }); + }); + }, + add_event_handler_sessiondeletebutton: function() { + $(document).ready(function(){ + $(document).once('click', '.sessiondeletebutton', function() { + var data = { + iqn: $('#targetselection').find("option:selected").val(), + cid: $(this).closest('tr').find('.cid').text(), + sid: $(this).closest('tr').find('.sid').text() + }; + + var request = mylibs.doajax('/phpietadmin/targets/deletesession', data); + + request.done(function () { + if (request.readyState == 4 && request.status == 200) { + if (request.responseText == "Success") { + swal({ + title: 'Success', + type: 'success' + }); + } else { + swal({ + title: 'Error', + type: 'error', + text: request.responseText + }); + } + + var url= 'targets/deletesession'; + var page = url.replace('/', '_'); + url = '/phpietadmin/' + url; + + var array = { + iqn: $('#targetselection').find("option:selected").val() + }; + + request = mylibs.doajax(url, array); + + request.done(function () { + if (request.readyState == 4 && request.status == 200) { + var configuretargetbody = $('#configuretargetbody'); + configuretargetbody.html(''); + configuretargetbody.html(request.responseText); + configuretargetbody.removeClass(); + configuretargetbody.addClass(page); + } + }); + + } + }); + }); + }); + } + }; +}); \ No newline at end of file diff --git a/public/js/pages/target/copy_addtarget.js b/public/js/pages/target/copy_addtarget.js new file mode 100644 index 0000000..c5944d1 --- /dev/null +++ b/public/js/pages/target/copy_addtarget.js @@ -0,0 +1,108 @@ +define(['jquery', 'mylibs', 'sweetalert'], function ($, mylibs, swal) { + // Define vars + var methods; + + return methods = { + disable_special_chars: function () { + $(document).ready(function(){ + var iqninput = $('#iqninput'); + + // Save default input for later restore + var data = iqninput.val(); + + // Validates the iqn input field + iqninput.keydown(function (e) { + // Prevent default data from being deleted + var oldvalue = $(this).val(); + var field = this; + setTimeout(function () { + if (field.value.indexOf(data) !== 0) { + $(field).val(oldvalue); + } + }, 1); + + // disable shift button + if (e.shiftKey) { + e.preventDefault(); + } else if (e.which == 8) { + // keydown 8 is the deleted button + return true; + // prevent other special chars + } else if (e.which < 48 || (e.which > 57 && e.which < 65) || (e.which > 90 && e.which < 97) || e.which > 122) { + e.preventDefault(); + } + }); + }); + }, + focus_input: function () { + // html5 autofocus does not work in firefox when loaded via ajax + $(document).ready(function() { + var iqninput = $('#iqninput'); + // Focus the iqninput when the site is loaded + iqninput.focus(); + }); + }, + remove_error: function () { + $(document).ready(function(){ + var iqninput = $('#iqninput'); + /* remove error if field is clicked */ + iqninput.click(function () { + iqninput.removeClass("focusedInputerror"); + }); + }); + }, + add_event_handler_addtargetbutton: function () { + $(document).ready(function () { + $(document).once('click', '#addtargetbutton', function () { + var iqninput = $('#iqninput'); + var def = $('#defaultiqn').val(); + + if (iqninput.val() == "") { + iqninput.addClass("focusedInputerror"); + return false; + } else { + var data = { + "name": def + iqninput.val() + }; + + $.ajax({ + url: '/phpietadmin/targets/addtarget', + data: data, + dataType: 'json', + type: 'post', + success: function(data) { + if (data['status'] == 'Success') { + iqninput.focus(); + swal({ + title: 'Success', + type: 'success', + text: data['message'] + }, + function () { + iqninput.val(''); + }); + } else if (data['status'] == 'Error') { + swal({ + title: 'Error', + type: 'error', + text: data['message'] + }, + function () { + iqninput.addClass("focusedInputerror"); + }); + } + }, + error: function() { + swal({ + title: 'Error', + type: 'error', + text: 'Something went wrong while submitting!' + }); + } + }); + } + }); + }); + } + }; +}); \ No newline at end of file diff --git a/version.json b/version.json index c2b05f1..ea71eeb 100644 --- a/version.json +++ b/version.json @@ -1,8 +1,8 @@ { "version": [ {"name": "phpietadmin"}, - {"version_nr": "0.5.2"}, - {"downloadurl": "https://github.com/MrCrankHank/phpietadmin/archive/v0.5.2.zip"}, + {"version_nr": "0.5.3"}, + {"downloadurl": "https://github.com/MrCrankHank/phpietadmin/archive/v0.5.3.zip"}, {"release": "beta"} ] } \ No newline at end of file