Merge branch 'testing' into new-trublo

This commit is contained in:
Cayo Puigdefabregas 2023-01-19 12:26:29 +01:00
commit 8ed1e2296d
15 changed files with 350 additions and 14 deletions

View File

@ -90,7 +90,9 @@ class SnapshotsLog(Thing):
settings_version = self.snapshot.settings_version or '' settings_version = self.snapshot.settings_version or ''
settings_version = "".join([x[0] for x in settings_version.split(' ') if x]) settings_version = "".join([x[0] for x in settings_version.split(' ') if x])
if settings_version:
return "{} ({})".format(self.version, settings_version) return "{} ({})".format(self.version, settings_version)
return "{}".format(self.version)
class PlaceholdersLog(Thing): class PlaceholdersLog(Thing):

View File

@ -343,6 +343,7 @@ class ParseSnapshotLsHw:
"components": self.components, "components": self.components,
"uuid": snapshot['uuid'], "uuid": snapshot['uuid'],
"version": "14.0.0", "version": "14.0.0",
"settings_version": snapshot.get("settings_version"),
"endTime": snapshot["timestamp"], "endTime": snapshot["timestamp"],
"elapsed": 1, "elapsed": 1,
"sid": snapshot["sid"], "sid": snapshot["sid"],

View File

@ -22,6 +22,7 @@ class Snapshot_lite(Thing):
sid = String(required=True) sid = String(required=True)
type = String(required=True) type = String(required=True)
timestamp = String(required=True) timestamp = String(required=True)
settings_version = String(required=False)
data = Nested(Snapshot_lite_data, required=True) data = Nested(Snapshot_lite_data, required=True)
@validates_schema @validates_schema

View File

@ -781,6 +781,8 @@ class Device(Thing):
def change_owner(self, new_user): def change_owner(self, new_user):
"""util for change the owner one device""" """util for change the owner one device"""
if not new_user:
return
self.owner = new_user self.owner = new_user
if hasattr(self, 'components'): if hasattr(self, 'components'):
for c in self.components: for c in self.components:

View File

@ -0,0 +1,182 @@
.dataTable-wrapper.no-header .dataTable-container {
border-top: 1px solid #d9d9d9;
}
.dataTable-wrapper.no-footer .dataTable-container {
border-bottom: 1px solid #d9d9d9;
}
.dataTable-top,
.dataTable-bottom {
padding: 8px 10px;
}
.dataTable-top > nav:first-child,
.dataTable-top > div:first-child,
.dataTable-bottom > nav:first-child,
.dataTable-bottom > div:first-child {
float: left;
}
.dataTable-top > nav:last-child,
.dataTable-top > div:last-child,
.dataTable-bottom > nav:last-child,
.dataTable-bottom > div:last-child {
float: right;
}
.dataTable-selector {
padding: 6px;
}
.dataTable-input {
padding: 6px 12px;
}
.dataTable-info {
margin: 7px 0;
}
/* PAGER */
.dataTable-pagination ul {
margin: 0;
padding-left: 0;
}
.dataTable-pagination li {
list-style: none;
float: left;
}
.dataTable-pagination a {
border: 1px solid transparent;
float: left;
margin-left: 2px;
padding: 6px 12px;
position: relative;
text-decoration: none;
color: #333;
}
.dataTable-pagination a:hover {
background-color: #d9d9d9;
}
.dataTable-pagination .active a,
.dataTable-pagination .active a:focus,
.dataTable-pagination .active a:hover {
background-color: #d9d9d9;
cursor: default;
}
.dataTable-pagination .ellipsis a,
.dataTable-pagination .disabled a,
.dataTable-pagination .disabled a:focus,
.dataTable-pagination .disabled a:hover {
cursor: not-allowed;
}
.dataTable-pagination .disabled a,
.dataTable-pagination .disabled a:focus,
.dataTable-pagination .disabled a:hover {
cursor: not-allowed;
opacity: 0.4;
}
.dataTable-pagination .pager a {
font-weight: bold;
}
/* TABLE */
.dataTable-table {
max-width: 100%;
width: 100%;
border-spacing: 0;
border-collapse: separate;
}
.dataTable-table > tbody > tr > td,
.dataTable-table > tbody > tr > th,
.dataTable-table > tfoot > tr > td,
.dataTable-table > tfoot > tr > th,
.dataTable-table > thead > tr > td,
.dataTable-table > thead > tr > th {
vertical-align: top;
padding: 8px 10px;
}
.dataTable-table > thead > tr > th {
vertical-align: bottom;
text-align: left;
border-bottom: 1px solid #d9d9d9;
}
.dataTable-table > tfoot > tr > th {
vertical-align: bottom;
text-align: left;
border-top: 1px solid #d9d9d9;
}
.dataTable-table th {
vertical-align: bottom;
text-align: left;
}
.dataTable-table th a {
text-decoration: none;
color: inherit;
}
.dataTable-sorter {
display: inline-block;
height: 100%;
position: relative;
width: 100%;
}
.dataTable-sorter::before,
.dataTable-sorter::after {
content: "";
height: 0;
width: 0;
position: absolute;
right: 4px;
border-left: 4px solid transparent;
border-right: 4px solid transparent;
opacity: 0.2;
}
.dataTable-sorter::before {
border-top: 4px solid #000;
bottom: 0px;
}
.dataTable-sorter::after {
border-bottom: 4px solid #000;
border-top: 4px solid transparent;
top: 0px;
}
.asc .dataTable-sorter::after,
.desc .dataTable-sorter::before {
opacity: 0.6;
}
.dataTables-empty {
text-align: center;
}
.dataTable-top::after, .dataTable-bottom::after {
clear: both;
content: " ";
display: table;
}
table.dataTable-table:focus tr.dataTable-cursor > td:first-child {
border-left: 3px blue solid;
}
table.dataTable-table:focus {
outline: solid 1px black;
outline-offset: -1px;
}

View File

@ -4,7 +4,7 @@ const Api = {
* @returns get lots * @returns get lots
*/ */
async get_lots() { async get_lots() {
const request = await this.doRequest(`${API_URLS.lots}?type=temporary`, "GET", null); const request = await this.doRequest(`${API_URLS.lots}`, "GET", null);
if (request != undefined) return request.items; if (request != undefined) return request.items;
throw request; throw request;
}, },

View File

@ -665,7 +665,7 @@ async function processSelectedDevices() {
}); });
listHTML.html(""); listHTML.html("");
const lot_temporary = lots.filter(lot => !lot.transfer); const lot_temporary = lots.filter(lot => !lot.transfer && !lot.trade);
appendMenu(lot_temporary, listHTML, templateLot, selectedDevices, actions, "Temporary"); appendMenu(lot_temporary, listHTML, templateLot, selectedDevices, actions, "Temporary");
const lot_incoming = lots.filter(lot => lot.transfer && lot.transfer == "Incoming"); const lot_incoming = lots.filter(lot => lot.transfer && lot.transfer == "Incoming");

View File

@ -627,7 +627,7 @@ async function processSelectedDevices() {
}) })
listHTML.html(""); listHTML.html("");
const lot_temporary = lots.filter(lot => !lot.transfer); const lot_temporary = lots.filter(lot => !lot.transfer && !lot.trade);
appendMenu(lot_temporary, listHTML, templateLot, selectedDevices, actions, "Temporary"); appendMenu(lot_temporary, listHTML, templateLot, selectedDevices, actions, "Temporary");
const lot_incoming = lots.filter(lot => lot.transfer && lot.transfer == "Incoming"); const lot_incoming = lots.filter(lot => lot.transfer && lot.transfer == "Incoming");

File diff suppressed because one or more lines are too long

View File

@ -19,12 +19,12 @@
<!-- JS Files --> <!-- JS Files -->
<script src="{{ url_for('static', filename='js/jquery-3.6.0.min.js') }}"></script> <script src="{{ url_for('static', filename='js/jquery-3.6.0.min.js') }}"></script>
<script src="https://cdn.jsdelivr.net/npm/simple-datatables@latest"></script> <script src="{{ url_for('static', filename='js/simple-datatables-5.0.3.js') }}"></script>
<!-- Vendor CSS Files --> <!-- Vendor CSS Files -->
<link href="{{ url_for('static', filename='vendor/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='vendor/bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
<link href="{{ url_for('static', filename='vendor/bootstrap-icons/bootstrap-icons.css') }}" rel="stylesheet"> <link href="{{ url_for('static', filename='vendor/bootstrap-icons/bootstrap-icons.css') }}" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/simple-datatables@latest/dist/style.css" rel="stylesheet" type="text/css"> <link href="{{ url_for('static', filename='css/simple-datatables.css') }}" rel="stylesheet" type="text/css">
<!-- Template Main CSS File --> <!-- Template Main CSS File -->

View File

@ -91,7 +91,7 @@
</td> </td>
<td> <td>
{% if snap.get_device() %} {% if snap.get_device() %}
<a href="{{ url_for('inventory.device_details', id=snap.device) }}"> <a href="{{ url_for('inventory.device_details', id=snap.get_device()) }}">
{{ snap.get_device() }} {{ snap.get_device() }}
</a> </a>
{% endif %} {% endif %}

View File

@ -14,7 +14,7 @@ WB_SMART_TEST = short
WB_ERASE = EraseBasic WB_ERASE = EraseBasic
WB_ERASE_STEPS = 1 WB_ERASE_STEPS = 1
WB_ERASE_LEADING_ZEROS = False WB_ERASE_LEADING_ZEROS = False
VERSION = "Basic Erasure (BE)" VERSION = Basic Erasure (BE)
{% elif baseline_erease %} {% elif baseline_erease %}
DH_HOST = {{ api_host }} DH_HOST = {{ api_host }}
@ -28,11 +28,11 @@ WB_SMART_TEST = short
WB_ERASE = EraseSectors WB_ERASE = EraseSectors
WB_ERASE_STEPS = {{ erase_steps }} WB_ERASE_STEPS = {{ erase_steps }}
WB_ERASE_LEADING_ZEROS = True WB_ERASE_LEADING_ZEROS = True
VERSION = {%if erase_steps < 3 %}"Baseline Secure Erasure (BSE)"{% else %}"Enhanced Secure Erasure (ESE)"{% endif %} VERSION = {%if erase_steps < 3 %}Baseline Secure Erasure (BSE){% else %}Enhanced Secure Erasure (ESE){% endif %}
{% else %} {% else %}
SNAPSHOTS_PATH = /mnt SNAPSHOTS_PATH = /mnt
LOGS_PATH = /mnt LOGS_PATH = /mnt
VERSION = "Basic Metadata (BM)" VERSION = Basic Metadata (BM)
{% endif %} {% endif %}

View File

@ -1,14 +1,14 @@
isos = { isos = {
"demo": { "demo": {
'iso': "USODY_2022.8.0-Demo.iso", 'iso': "USODY_2022.8.0-Demo.iso",
'url': 'http://releases.usody.com/demo/', 'url': 'https://releases.usody.com/demo/',
}, },
"register": { "register": {
'iso': "USODY_2022.8.0-beta.iso", 'iso': "USODY_2022.12.1-beta.iso",
'url': 'http://releases.usody.com/2022/', 'url': 'https://releases.usody.com/2022/',
}, },
"erease": { "erease": {
'iso': "USODY_14.0.0.iso", 'iso': "USODY_14.0.0.iso",
'url': 'http://releases.usody.com/v14/', 'url': 'https://releases.usody.com/v14/',
}, },
} }

View File

@ -6,6 +6,7 @@
"software": "Workbench", "software": "Workbench",
"version": "2022.03.00", "version": "2022.03.00",
"schema_api": "1.0.0", "schema_api": "1.0.0",
"settings_version": "Basic Metadata",
"data": { "data": {
"lspci": "", "lspci": "",
"lshw": { "lshw": {

View File

@ -1413,3 +1413,18 @@ def test_bug_4028_components(user: UserClient):
for c in m.Device.query.filter(): for c in m.Device.query.filter():
assert c.binding or c.placeholder assert c.binding or c.placeholder
@pytest.mark.mvp
@pytest.mark.usefixtures(conftest.app_context.__name__)
def test_settings_version(user: UserClient):
"""Tests when we have one computer and then we change the disk, then
the new disk need to have placeholder too."""
s = file_json("2022-03-31_17h18m51s_ZQMPKKX51K67R68VO2X9RNZL08JPL_snapshot.json")
body, res = user.post(s, uri="/api/inventory/")
assert m.Computer.query.first().dhid == body['dhid']
snapshot = Snapshot.query.first()
log = SnapshotsLog.query.first()
assert log.get_version() == "14.0 (BM)"
assert snapshot.settings_version == "Basic Metadata"