Skip to content

Commit

Permalink
use PUT instead of DELETE for disk removal. rockstor#299
Browse files Browse the repository at this point in the history
  • Loading branch information
schakrava committed Nov 1, 2014
1 parent 626f3bc commit 48666e3
Showing 1 changed file with 41 additions and 18 deletions.
@@ -1,27 +1,27 @@
/*
*
* @licstart The following is the entire license notice for the
* @licstart The following is the entire license notice for the
* JavaScript code in this page.
*
*
* Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com>
* This file is part of RockStor.
*
*
* RockStor 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 2 of the License,
* or (at your option) any later version.
*
*
* RockStor is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*
* @licend The above is the entire license notice
* for the JavaScript code in this page.
*
*
*/

PoolDetailsLayoutView = RockstorLayoutView.extend({
Expand Down Expand Up @@ -72,10 +72,10 @@ PoolDetailsLayoutView = RockstorLayoutView.extend({
error: function(xhr, status, error) {
var buttons = _this.$('.scrub_button');
disableButton(buttons);
}
}
});
};
}(), this.statusPollInterval);
};
}(), this.statusPollInterval);
},

renderSubViews: function() {
Expand All @@ -88,7 +88,7 @@ PoolDetailsLayoutView = RockstorLayoutView.extend({
this.$('#ph-pool-usage').append(this.subviews['pool-usage'].render().el);
this.attachActions();
},

attachActions: function() {
var _this = this;
this.$('#resize-pool-popup').click(function() {
Expand All @@ -99,14 +99,38 @@ PoolDetailsLayoutView = RockstorLayoutView.extend({
_this.$('#alert-msg').empty();
_this.$('#resize-pool').click(function() {
var disk_names = '';
var err_msg = "Please select atleast one disk";
var n = $("input:checked").length;
if(n > 0){
$("input:checked").each(function(i) {
if (i < n-1) {
disk_names += $(this).val() + ',';
} else {
disk_names += $(this).val();
}
});
$.ajax({
url: "/api/pools/"+_this.pool.get('name')+'/add',
type: "PUT",
dataType: "json",
data: {"disks": disk_names},
success: function() {
_this.$('#resize-pool-form').overlay().close();
_this.pool.fetch();
},
error: function(request, status, error) {
_this.$('#alert-msg').html("<font color='red'>"+request.responseText+"</font>");
}
});
}else{
var err_msg = "No change has been made.";
var n = $(".disknew:checked").length;
if(n > 0) {
$(".disknew:checked").each(function(i) {
if (i < n-1) {
disk_names += $(this).val() + ',';
} else {
disk_names += $(this).val();
disk_names += $(this).val();
}
});
$.ajax({
Expand All @@ -129,12 +153,12 @@ PoolDetailsLayoutView = RockstorLayoutView.extend({
if (i < m-1) {
disk_names += $(this).val() + ',';
} else {
disk_names += $(this).val();
disk_names += $(this).val();
}
});
$.ajax({
url: "/api/pools/"+_this.pool.get('name')+'/remove',
type: "DELETE",
type: "PUT",
dataType: "json",
data: {"disks": disk_names},
success: function() {
Expand All @@ -150,11 +174,11 @@ PoolDetailsLayoutView = RockstorLayoutView.extend({
}
});
$('#resize-pool-form').overlay().load();

}});
});
_this.$('#resize-pool-form').overlay({ load: false });


},

Expand Down Expand Up @@ -198,8 +222,7 @@ PoolDetailsLayoutView = RockstorLayoutView.extend({
}
},

scrubPoolStop: function() {
scrubPoolStop: function() {
},

});

0 comments on commit 48666e3

Please sign in to comment.