summaryrefslogtreecommitdiffstats
path: root/ogcp/static/js
diff options
context:
space:
mode:
Diffstat (limited to 'ogcp/static/js')
-rw-r--r--ogcp/static/js/ogcp.js22
1 files changed, 15 insertions, 7 deletions
diff --git a/ogcp/static/js/ogcp.js b/ogcp/static/js/ogcp.js
index 0ac67fe..3c53035 100644
--- a/ogcp/static/js/ogcp.js
+++ b/ogcp/static/js/ogcp.js
@@ -300,15 +300,23 @@ function AddPartition(evt) {
function RemovePartition(evt) {
const target = $(evt).parent().parent();
const table = target.parent();
- target.remove();
- // Reassign rows ids
- table.find('tr').each(function(index) {
- $(this).find('.form-control').each(function() {
- const id = $(this).attr('id').replace(/(.*)-(\d{1,4})-(.*)/, `$1-${index}-$3`);
- $(this).attr('name', id).attr('id', id);
+ if (table[0].children.length > 1) {
+ target.remove();
+ // Reassign rows ids
+ table.find('tr').each(function(index) {
+ $(this).find('.form-control').each(function() {
+ const id = $(this).attr('id').replace(/(.*)-(\d{1,4})-(.*)/, `$1-${index}-$3`);
+ $(this).attr('name', id).attr('id', id);
+ });
});
- });
+ } else {
+ table.find('tr').each(function(index) {
+ $(this).find('.form-control').each(function() {
+ $(this).val('').removeAttr("checked");
+ });
+ });
+ }
}
function checkImageServer() {