mirror of https://git.48k.eu/ogcp
templates: show excluded clients from partition operation
Show the list of IPs of the clients withut the selected disk to partition in the partition and format form.master
parent
b433d84095
commit
15f5af00e7
|
@ -1,6 +1,6 @@
|
|||
{% if selected_disk is defined and setup_data is defined %}
|
||||
|
||||
<form class="form-inline" method="POST" id="setupForm">
|
||||
<form class="form-inline mx-5" method="POST" id="setupForm">
|
||||
{{ disk_form.hidden_tag() }}
|
||||
{{ disk_form.ips() }}
|
||||
|
||||
|
@ -85,18 +85,24 @@
|
|||
</table>
|
||||
</form>
|
||||
|
||||
<button class="btn btn-primary" data-target="#partitionsTable" id="addPartButton" onclick="AddPartition(this, true)"
|
||||
{% if readonly_disk_inspector is defined %}style="display: none;"{% endif %}>
|
||||
{{ _('Add a new partition') }}
|
||||
</button>
|
||||
<div class="form-group mx-5">
|
||||
<div id="clientWarningMsg"></div>
|
||||
</div>
|
||||
|
||||
<div class="form-group mx-5">
|
||||
<button class="btn btn-primary" data-target="#partitionsTable" id="addPartButton" onclick="AddPartition(this, true)"
|
||||
{% if readonly_disk_inspector is defined %}style="display: none;"{% endif %}>
|
||||
{{ _('Add a new partition') }}
|
||||
</button>
|
||||
|
||||
{% if not readonly_disk_inspector is defined %}
|
||||
<button class="btn btn-success" form="setupForm">
|
||||
{{ _('Submit') }}
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="card text-center">
|
||||
<div class="card text-center mx-5">
|
||||
<div class="card-header">
|
||||
{{ _('Partition graph') }}
|
||||
</div>
|
||||
|
@ -115,6 +121,10 @@
|
|||
|
||||
let selectedDisk = {{selected_disk}};
|
||||
let setupData = {{setup_data|tojson|safe}}
|
||||
|
||||
{% if excluded_client_disks is defined %}
|
||||
let excludedClientDisks = {{excluded_client_disks|tojson|safe}}
|
||||
{% endif %}
|
||||
let diskSize = 0;
|
||||
|
||||
let chartConfig = {
|
||||
|
@ -291,6 +301,17 @@
|
|||
}
|
||||
|
||||
updatePartitionChart();
|
||||
|
||||
{% if excluded_client_disks is defined %}
|
||||
let missingClientsText = "";
|
||||
if (excludedClientDisks[selectedDisk].length) {
|
||||
missingClientsText = "<p>{{ _('Clients missing the target disk:') }}</p>";
|
||||
}
|
||||
for (const c of excludedClientDisks[selectedDisk]) {
|
||||
missingClientsText += '<div class="card d-inline-block" style="padding: 5px;">' + c + '</div>';
|
||||
}
|
||||
$('#clientWarningMsg').html(missingClientsText);
|
||||
{% endif %}
|
||||
}
|
||||
|
||||
function handleDiskChange(selectElement) {
|
||||
|
|
|
@ -697,9 +697,12 @@ def get_common_disk_data(ips):
|
|||
}
|
||||
break
|
||||
|
||||
for disk_id in disk_data:
|
||||
if disk_id not in setup_data:
|
||||
disk_data[disk_id]['excluded'].append(ip)
|
||||
for disk_id in disk_data:
|
||||
disk_ips = []
|
||||
for disk_size in disk_data[disk_id]['inventory']:
|
||||
disk_ips.extend(disk_data[disk_id]['inventory'][disk_size])
|
||||
|
||||
disk_data[disk_id]['excluded'] = [ip for ip in ips if ip not in disk_ips]
|
||||
|
||||
return disk_data
|
||||
|
||||
|
@ -775,6 +778,10 @@ def action_setup_show():
|
|||
for disk in setup_data:
|
||||
setup_data[disk][0]['size'] = common_disk_data[disk]['common_size']
|
||||
|
||||
excluded_client_disks = {}
|
||||
for disk in common_disk_data:
|
||||
excluded_client_disks[disk] = common_disk_data[disk]['excluded']
|
||||
|
||||
form = SetupForm()
|
||||
form.ips.data = ips_str
|
||||
|
||||
|
@ -785,6 +792,7 @@ def action_setup_show():
|
|||
|
||||
scopes, _clients = get_scopes(ips)
|
||||
return render_template('actions/setup.html',
|
||||
excluded_client_disks=excluded_client_disks,
|
||||
selected_disk=selected_disk,
|
||||
setup_data=setup_data,
|
||||
disk_form=form,
|
||||
|
|
Loading…
Reference in New Issue