This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
devicehub-teal/ereuse_devicehub/templates/inventory/erasure_list.html

328 lines
15 KiB
HTML
Raw Normal View History

2022-09-20 08:27:02 +00:00
{% extends "ereuse_devicehub/base_site.html" %}
{% block main %}
<div class="pagetitle">
<h1>Inventory</h1>
<nav>
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ url_for('inventory.devicelist')}}">Inventory</a></li>
2023-03-20 16:32:58 +00:00
<li class="breadcrumb-item active">Drive Sanitization</li>
2022-09-20 08:27:02 +00:00
</ol>
</nav>
</div><!-- End Page Title -->
<section class="section profile">
<div class="row">
<div class="col-xl-12">
<div class="card">
<div class="card-body pt-3" style="min-height: 650px;">
2022-11-18 17:46:10 +00:00
<ul class="nav nav-tabs nav-tabs-bordered">
<li class="nav-item">
2022-11-21 12:24:56 +00:00
<a href="{{ url_for('inventory.device_erasure_list') }}" class="nav-link{% if not orphans %} active{% endif %}">
2023-03-20 17:08:37 +00:00
All drives
2022-11-21 12:24:56 +00:00
</a>
2022-11-18 17:46:10 +00:00
</li>
<li class="nav-item">
2022-11-21 12:24:56 +00:00
<a href="{{ url_for('inventory.device_erasure_list_orphans', orphans=1) }}" class="nav-link{% if orphans %} active{% endif %}">
2023-03-20 17:08:37 +00:00
Drives without device
2022-11-21 12:24:56 +00:00
</a>
2022-11-18 17:46:10 +00:00
</li>
</ul>
<div class="tab-content pt-2">
2022-09-20 08:27:02 +00:00
<div id="devices-list" class="tab-pane fade devices-list active show">
<label class="btn btn-primary " for="SelectAllBTN"><input type="checkbox" id="SelectAllBTN" autocomplete="off"></label>
2022-11-21 12:24:56 +00:00
{% if orphans %}
<div class="btn-group dropdown ml-1">
<button id="btnLots" type="button" onclick="processSelectedDevices()" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-folder2"></i>
Lots
<span class="caret"></span>
</button>
<span class="d-none" id="activeTradeModal" data-bs-toggle="modal" data-bs-target="#tradeLotModal"></span>
<ul class="dropdown-menu" aria-labelledby="btnLots" id="dropDownLotsSelector">
<div class="row w-100">
<div class="input-group mb-3 mx-2">
<div class="input-group-prepend">
<span class="input-group-text" id="basic-addon1"><i class="bi bi-search"></i></span>
</div>
<input type="text" class="form-control" id="lots-search" placeholder="search" aria-label="search" aria-describedby="basic-addon1">
</div>
</div>
<h6 class="dropdown-header">Select lots where to store the selected devices</h6>
<ul class="mx-3" id="LotsSelector"></ul>
<li><hr /></li>
<li>
<a href="#" class="dropdown-item" id="ApplyDeviceLots">
<i class="bi bi-check"></i>
Apply
</a>
</li>
</ul>
</div>
{% endif %}
2022-09-20 08:27:02 +00:00
<div class="btn-group dropdown m-1" uib-dropdown="">
<button id="btnExport" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-reply"></i>
Exports
</button>
<span class="d-none" id="exportAlertModal" data-bs-toggle="modal" data-bs-target="#exportErrorModal"></span>
<ul class="dropdown-menu" aria-labelledby="btnExport">
<li>
2022-09-21 09:35:31 +00:00
<a href="javascript:export_actions_erasure('actions_erasures')" class="dropdown-item">
2022-09-20 08:27:02 +00:00
<i class="bi bi-file-spreadsheet"></i>
2022-09-20 15:36:09 +00:00
Data Storage Spreadsheet
2022-09-20 08:27:02 +00:00
</a>
</li>
<li>
<a href="javascript:export_file('certificates')" class="dropdown-item">
<i class="bi bi-eraser-fill"></i>
2023-03-20 16:32:58 +00:00
Device Sanitization
2022-09-20 08:27:02 +00:00
</a>
</li>
</ul>
</div>
2022-11-21 12:24:56 +00:00
{% if orphans %}
<div class="btn-group dropdown m-1" uib-dropdown="">
<button id="btnTags" type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-tag"></i>
Labels
</button>
<ul class="dropdown-menu" aria-labelledby="btnTags">
<li>
<form id="print_labels" method="post" action="{{ url_for('labels.print_labels') }}">
{% for f in form_print_labels %}
{{ f }}
{% endfor %}
<a href="javascript:$('#print_labels').submit()" class="dropdown-item">
<i class="bi bi-printer"></i>
Print labels
</a>
</form>
</li>
</ul>
</div>
{% endif %}
2022-09-20 08:27:02 +00:00
2022-11-23 18:22:49 +00:00
<div id="select-devices-info" class="alert alert-info mb-0 mt-3 d-none" role="alert">
If this text is showing is because there are an error
</div>
2022-09-20 08:27:02 +00:00
<div class="tab-content pt-2">
2022-11-23 18:22:49 +00:00
<div class="dataTable-top" style="float: left;">
2022-11-23 12:36:34 +00:00
<div class="dataTable-dropdown">
<label>
<select class="dataTable-selector">
<option value="5"{% if erasure.per_page == 5 %} selected="selected"{% endif %}>
5
</option>
<option value="10"{% if erasure.per_page == 10 %} selected="selected"{% endif %}>
10
</option>
<option value="15"{% if erasure.per_page == 15 %} selected="selected"{% endif %}>
15
</option>
<option value="20"{% if erasure.per_page == 20 %} selected="selected"{% endif %}>
20
</option>
<option value="25"{% if erasure.per_page == 25 %} selected="selected"{% endif %}>
25
</option>
<option value="50"{% if erasure.per_page == 50 %} selected="selected"{% endif %}>
50
</option>
<option value="100"{% if erasure.per_page == 100 %} selected="selected"{% endif %}>
100
</option>
</select> entries per page
</label>
</div>
<div class="dataTable-search">
</div>
</div>
2022-11-23 15:13:30 +00:00
<div class="dataTable-container">
2022-09-20 08:27:02 +00:00
<table class="table">
<thead>
<tr>
<th scope="col">Select</th>
<th scope="col">Data Storage Serial</th>
2022-10-26 09:26:09 +00:00
<th scope="col">DHID</th>
2022-09-20 08:27:02 +00:00
<th scope="col">Snapshot ID</th>
2022-09-20 15:36:09 +00:00
<th scope="col">Type of Erasure</th>
<th scope="col">PHID Erasure Host</th>
<th scope="col">Result</th>
2022-09-20 08:27:02 +00:00
<th scope="col" data-type="date" data-format="YYYY-MM-DD hh:mm:ss">Time</th>
<th scope="col"></th>
</tr>
</thead>
<tbody>
2022-11-23 12:36:34 +00:00
{% for ac in erasure.items %}
2023-06-13 06:53:17 +00:00
{% if not ac.device.is_mobile() %}
2022-09-20 08:27:02 +00:00
<tr>
<td>
<input type="checkbox" class="deviceSelect" data="{{ ac.device.my_partner.id }}"
2022-09-20 08:27:02 +00:00
data-device-type="{{ ac.device.type }}" data-device-manufacturer="{{ ac.device.manufacturer }}"
data-device-dhid="{{ ac.device.dhid }}" data-device-vname="{{ ac.device.verbose_name }}"
2022-09-21 09:35:31 +00:00
data-action-erasure="{{ ac.id }}"
2022-09-20 08:27:02 +00:00
{% if form_new_allocate.type.data and ac.device.id in list_devices %}
checked="checked"
{% endif %}
/>
</td>
<td>
2022-10-25 09:10:39 +00:00
{% if ac.device.phid() %}
2022-09-20 08:27:02 +00:00
<a href="{{ url_for('inventory.device_details', id=ac.device.dhid)}}">
2022-11-21 14:14:02 +00:00
{% if ac.device.get_type_logo() %}
<i class="{{ ac.device.get_type_logo() }}" title="{{ ac.device.type }}"></i>
{% endif %}
2022-09-20 08:27:02 +00:00
{{ ac.device.serial_number.upper() }}
</a>
2022-10-25 09:10:39 +00:00
{% else %}
2022-11-21 14:14:02 +00:00
{% if ac.device.get_type_logo() %}
<i class="{{ ac.device.get_type_logo() }}" title="{{ ac.device.type }}"></i>
{% endif %}
2022-10-25 09:10:39 +00:00
{{ ac.device.serial_number.upper() }}
{% endif %}
2023-03-09 17:38:54 +00:00
{% if ac.device.get_lots_for_template() | length > 0 %}
2022-11-21 14:14:02 +00:00
<h6 class="d-inline">
2023-03-09 17:38:54 +00:00
{% for lot in ac.device.get_lots_for_template() %}
2022-11-21 14:14:02 +00:00
<span class="badge rounded-pill bg-light text-dark">{{ lot }}</span>
{% endfor %}
</h6>
{% endif %}
2022-10-26 09:26:09 +00:00
</td>
<td>
{% if ac.device.phid() %}
<a href="{{ url_for('inventory.device_details', id=ac.device.dhid)}}">
{{ ac.device.dhid }}
</a>
{% else %}
{{ ac.device.dhid }}
{% endif %}
2022-09-20 08:27:02 +00:00
</td>
<td>
2022-09-20 10:43:04 +00:00
<a href="{{ url_for('inventory.export', export_id='snapshot') }}?id={{ ac.snapshot.uuid }}">
2022-11-23 12:36:34 +00:00
{{ ac.snapshot.uuid }}
2022-09-20 08:27:02 +00:00
</a>
</td>
<td>
{{ ac.type or '' }}
</td>
<td>
<a href="{{ url_for('inventory.device_details', id=ac.device.parent.dhid) }}">
2022-09-20 11:31:21 +00:00
{{ ac.get_phid() }}
2022-09-20 08:27:02 +00:00
</a>
</td>
<td>
{{ ac.severity }}
</td>
2022-09-21 09:35:31 +00:00
<td>{{ ac.created.strftime('%Y-%m-%d %H:%M:%S') }}</td>
2022-09-20 08:27:02 +00:00
<td>
2022-09-20 10:43:04 +00:00
<a href="{{ url_for('inventory.export', export_id='snapshot') }}?id={{ ac.snapshot.uuid }}">
2022-09-20 08:27:02 +00:00
<i class="bi bi-box-arrow-up-right"></i>
</a>
</td>
</tr>
2023-06-13 06:53:17 +00:00
{% endif %}
2022-09-20 08:27:02 +00:00
{% endfor %}
</tbody>
</table>
</div>
2022-11-23 12:36:34 +00:00
<div class="dataTable-bottom">
<div class="dataTable-info">
Showing {{ erasure.first }} to {{ erasure.last }} of {{ erasure.total }} entries
2022-09-20 08:27:02 +00:00
</div>
2022-11-23 12:36:34 +00:00
<nav class="dataTable-pagination">
<ul class="dataTable-pagination-list">
{% if erasure.has_prev %}
<li class="pager">
2022-11-23 18:22:49 +00:00
{% if orphans %}
<a href="{{ url_for('inventory.device_erasure_list_orphans', orphans=1, page=erasure.prev_num, per_page=erasure.per_page) }}"></a>
{% else %}
2022-11-23 12:36:34 +00:00
<a href="{{ url_for('inventory.device_erasure_list', page=erasure.prev_num, per_page=erasure.per_page) }}"></a>
2022-11-23 18:22:49 +00:00
{% endif %}
2022-11-23 12:36:34 +00:00
</li>
2022-09-20 08:27:02 +00:00
{% endif %}
2022-11-23 12:36:34 +00:00
{% for page in erasure.iter_pages() %}
{% if page %}
{% if page == erasure.page %}
<li class="active"><a href="javascript:void()">{{ page }}</a></li>
{% else %}
<li class="">
2022-11-23 18:22:49 +00:00
{% if orphans %}
<a href="{{ url_for('inventory.device_erasure_list_orphans', orphans=1, page=page, per_page=erasure.per_page) }}">
{{ page }}
</a>
{% else %}
2022-11-23 12:36:34 +00:00
<a href="{{ url_for('inventory.device_erasure_list', page=page, per_page=erasure.per_page) }}">
{{ page }}
</a>
2022-11-23 18:22:49 +00:00
{% endif %}
2022-11-23 12:36:34 +00:00
</li>
{% endif %}
2022-09-20 08:27:02 +00:00
{% endif %}
2022-11-23 12:36:34 +00:00
{% endfor %}
{% if erasure.has_next %}
<li class="pager">
2022-11-23 18:22:49 +00:00
{% if orphans %}
<a href="{{ url_for('inventory.device_erasure_list_orphans', orphans=1, page=erasure.next_num, per_page=erasure.per_page) }}"></a>
{% else %}
2022-11-23 12:36:34 +00:00
<a href="{{ url_for('inventory.device_erasure_list', page=erasure.next_num, per_page=erasure.per_page) }}"></a>
2022-11-23 18:22:49 +00:00
{% endif %}
2022-11-23 12:36:34 +00:00
</li>
2022-09-20 08:27:02 +00:00
{% endif %}
2022-11-23 12:36:34 +00:00
</ul>
</nav>
</div>
2022-09-20 08:27:02 +00:00
</div>
</div><!-- End Bordered Tabs -->
</div>
</div>
</div>
<div id="NotificationsContainer" style="position: absolute; bottom: 0; right: 0; margin: 10px; margin-top: 70px; width: calc(100% - 310px);"></div>
</div>
</div>
</section>
{% include "inventory/alert_export_error.html" %}
{% include "inventory/alert_lots_changes.html" %}
<!-- Custom Code -->
<script>
2022-11-23 12:36:34 +00:00
$(document).ready(() => {
$(".dataTable-selector").on("change", function() {
const per_page = $('.dataTable-selector').val();
2022-11-23 18:22:49 +00:00
{% if orphans %}
window.location.href = "{{ url_for('inventory.device_erasure_list_orphans', orphans=1, page=1) }}&per_page="+per_page;
{% else %}
2022-11-23 12:36:34 +00:00
window.location.href = "{{ url_for('inventory.device_erasure_list', page=1) }}&per_page="+per_page;
2022-11-23 18:22:49 +00:00
{% endif %}
2022-11-23 12:36:34 +00:00
});
});
2022-09-20 08:27:02 +00:00
</script>
<script>
let table = new simpleDatatables.DataTable("table", {
2022-11-23 18:22:49 +00:00
//perPageSelect: [5, 10, 15, 20, 25, 50, 100],
//perPage: 20,
footer: false,
paging: false,
2022-09-20 08:27:02 +00:00
})
</script>
2022-11-23 12:36:34 +00:00
2022-09-20 08:27:02 +00:00
{% if config['DEBUG'] %}
<script src="{{ url_for('static', filename='js/main_inventory.js') }}"></script>
{% else %}
<script src="{{ url_for('static', filename='js/main_inventory.build.js') }}"></script>
{% endif %}
{% endblock main %}