Merge pull request #414 from eReuse/feature/3999-setings
Feature/3999 setings
This commit is contained in:
commit
046a902005
|
@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||
ml).
|
||||
|
||||
## testing
|
||||
- [added] #414 add new vars in the settings file for wb.
|
||||
|
||||
## [2.5.0] - 2022-11-30
|
||||
- [added] #407 erasure section with tabs in top.
|
||||
|
|
|
@ -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()}')
|
|
@ -84,6 +84,14 @@ class SnapshotsLog(Thing):
|
|||
except AttributeError:
|
||||
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):
|
||||
"""A Placeholder log."""
|
||||
|
|
|
@ -676,6 +676,7 @@ class Snapshot(JoinedWithOneDeviceMixin, ActionWithOneDevice):
|
|||
of time it took to complete.
|
||||
"""
|
||||
sid = Column(CIText(), nullable=True)
|
||||
settings_version = Column(CIText(), nullable=True)
|
||||
is_server_erase = Column(Boolean(), nullable=True)
|
||||
|
||||
def get_last_lifetimes(self):
|
||||
|
|
|
@ -453,6 +453,7 @@ class Snapshot(ActionWithOneDevice):
|
|||
'Order is preserved, so the component num 0 when'
|
||||
'submitting is the component num 0 when returning it back.',
|
||||
)
|
||||
settings_version = String(required=False)
|
||||
|
||||
@validates_schema
|
||||
def validate_workbench_version(self, data: dict):
|
||||
|
|
|
@ -61,7 +61,6 @@
|
|||
<th scope="col">Snapshot UUID</th>
|
||||
<th scope="col">Version</th>
|
||||
<th scope="col">DHID</th>
|
||||
<th scope="col">System UUID</th>
|
||||
<th scope="col">Status</th>
|
||||
<th scope="col">Type Upload</th>
|
||||
<th scope="col">Type Device</th>
|
||||
|
@ -88,7 +87,7 @@
|
|||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ snap.version }}
|
||||
{{ snap.get_version() }}
|
||||
</td>
|
||||
<td>
|
||||
{% if snap.get_device() %}
|
||||
|
@ -97,9 +96,6 @@
|
|||
</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
{{ snap.get_system_uuid() }}
|
||||
</td>
|
||||
<td>
|
||||
{{ snap.get_status() }}
|
||||
</td>
|
||||
|
|
|
@ -14,8 +14,8 @@ WB_SMART_TEST = short
|
|||
WB_ERASE = EraseBasic
|
||||
WB_ERASE_STEPS = 1
|
||||
WB_ERASE_LEADING_ZEROS = False
|
||||
VERSION = "Basic Erasure (BE)"
|
||||
|
||||
WB_DEBUG = True
|
||||
{% elif baseline_erease %}
|
||||
DH_HOST = {{ api_host }}
|
||||
DH_DATABASE = {{ schema }}
|
||||
|
@ -28,6 +28,11 @@ WB_SMART_TEST = short
|
|||
WB_ERASE = EraseSectors
|
||||
WB_ERASE_STEPS = {{ erase_steps }}
|
||||
WB_ERASE_LEADING_ZEROS = True
|
||||
VERSION = {%if erase_steps < 3 %}"Baseline Secure Erasure (BSE)"{% else %}"Enhanced Secure Erasure (ESE)"{% endif %}
|
||||
|
||||
{% else %}
|
||||
SNAPSHOTS_PATH = /mnt
|
||||
LOGS_PATH = /mnt
|
||||
VERSION = "Basic Metadata (BM)"
|
||||
|
||||
WB_DEBUG = True
|
||||
{% endif %}
|
Reference in a new issue