summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ogcp/static/js/ogcp.js22
-rw-r--r--ogcp/templates/actions/setup.html2
2 files changed, 16 insertions, 8 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() {
diff --git a/ogcp/templates/actions/setup.html b/ogcp/templates/actions/setup.html
index a2b382a..68aefe9 100644
--- a/ogcp/templates/actions/setup.html
+++ b/ogcp/templates/actions/setup.html
@@ -62,7 +62,7 @@
<td>{{ partition.size(class_="form-control") }}</td>
<td>{{ partition.format_partition(class_="form-control") }}</td>
<td>
- <button class="btn btn-danger" onclick="RemovePartition(this)">
+ <button class="btn btn-danger" type="button" onclick="RemovePartition(this)">
{{ _('Remove') }}
</button>
</td>