Merge pull request #414 from eReuse/feature/3999-setings

Feature/3999 setings
This commit is contained in:
cayop 2022-11-30 17:12:19 +01:00 committed by GitHub
commit 046a902005
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 55 additions and 8 deletions

View File

@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
ml). ml).
## testing ## testing
- [added] #414 add new vars in the settings file for wb.
## [2.5.0] - 2022-11-30 ## [2.5.0] - 2022-11-30
- [added] #407 erasure section with tabs in top. - [added] #407 erasure section with tabs in top.

View File

@ -0,0 +1,35 @@
"""add settings_version to snapshots
Revision ID: af038a8a388c
Revises: 410aadae7652
Create Date: 2022-11-30 16:21:05.768024
"""
import citext
import sqlalchemy as sa
from alembic import context, op
# revision identifiers, used by Alembic.
revision = 'af038a8a388c'
down_revision = '410aadae7652'
branch_labels = None
depends_on = None
def get_inv():
INV = context.get_x_argument(as_dictionary=True).get('inventory')
if not INV:
raise ValueError("Inventory value is not specified")
return INV
def upgrade():
op.add_column(
'snapshot',
sa.Column('settings_version', citext.CIText(), nullable=True),
schema=f'{get_inv()}',
)
def downgrade():
op.drop_column('snapshot', 'settings_version', schema=f'{get_inv()}')

View File

@ -84,6 +84,14 @@ class SnapshotsLog(Thing):
except AttributeError: except AttributeError:
return '' return ''
def get_version(self):
if not self.snapshot:
return self.version
settings_version = self.snapshot.settings_version or ''
settings_version = "".join([x[0] for x in settings_version.split(' ') if x])
return "{} ({})".format(self.version, settings_version)
class PlaceholdersLog(Thing): class PlaceholdersLog(Thing):
"""A Placeholder log.""" """A Placeholder log."""

View File

@ -676,6 +676,7 @@ class Snapshot(JoinedWithOneDeviceMixin, ActionWithOneDevice):
of time it took to complete. of time it took to complete.
""" """
sid = Column(CIText(), nullable=True) sid = Column(CIText(), nullable=True)
settings_version = Column(CIText(), nullable=True)
is_server_erase = Column(Boolean(), nullable=True) is_server_erase = Column(Boolean(), nullable=True)
def get_last_lifetimes(self): def get_last_lifetimes(self):

View File

@ -453,6 +453,7 @@ class Snapshot(ActionWithOneDevice):
'Order is preserved, so the component num 0 when' 'Order is preserved, so the component num 0 when'
'submitting is the component num 0 when returning it back.', 'submitting is the component num 0 when returning it back.',
) )
settings_version = String(required=False)
@validates_schema @validates_schema
def validate_workbench_version(self, data: dict): def validate_workbench_version(self, data: dict):

View File

@ -61,7 +61,6 @@
<th scope="col">Snapshot UUID</th> <th scope="col">Snapshot UUID</th>
<th scope="col">Version</th> <th scope="col">Version</th>
<th scope="col">DHID</th> <th scope="col">DHID</th>
<th scope="col">System UUID</th>
<th scope="col">Status</th> <th scope="col">Status</th>
<th scope="col">Type Upload</th> <th scope="col">Type Upload</th>
<th scope="col">Type Device</th> <th scope="col">Type Device</th>
@ -88,7 +87,7 @@
{% endif %} {% endif %}
</td> </td>
<td> <td>
{{ snap.version }} {{ snap.get_version() }}
</td> </td>
<td> <td>
{% if snap.get_device() %} {% if snap.get_device() %}
@ -97,9 +96,6 @@
</a> </a>
{% endif %} {% endif %}
</td> </td>
<td>
{{ snap.get_system_uuid() }}
</td>
<td> <td>
{{ snap.get_status() }} {{ snap.get_status() }}
</td> </td>

View File

@ -14,8 +14,8 @@ 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)"
WB_DEBUG = True
{% elif baseline_erease %} {% elif baseline_erease %}
DH_HOST = {{ api_host }} DH_HOST = {{ api_host }}
DH_DATABASE = {{ schema }} DH_DATABASE = {{ schema }}
@ -28,6 +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 %}
WB_DEBUG = True {% else %}
{% endif %} SNAPSHOTS_PATH = /mnt
LOGS_PATH = /mnt
VERSION = "Basic Metadata (BM)"
{% endif %}