add v14 iso for download erease settings

This commit is contained in:
Cayo Puigdefabregas 2022-08-05 11:07:54 +02:00
parent 43da3f0a4f
commit 8c1ea5786e
5 changed files with 97 additions and 40 deletions

View File

@ -1 +0,0 @@
868e59911be73a941938644143d81f21a2fdbe82ea0841493c2d9fc04701e058334af5fecd69c1a1525ebd5c8c17ac3f49d8ecc53bbfc8a018f169be48fe79d6 USODY_2022.5.2-beta.iso

View File

@ -11,6 +11,7 @@
</div><!-- End Page Title --> </div><!-- End Page Title -->
<section class="section profile"> <section class="section profile">
{% if demo %}
<div class="row"> <div class="row">
<div class="col-xl-6"> <div class="col-xl-6">
@ -19,29 +20,6 @@
<div class="pt-6 pb-2"> <div class="pt-6 pb-2">
<h5 class="card-title text-center pb-0 fs-4">Workbench 2022</h5> <h5 class="card-title text-center pb-0 fs-4">Workbench 2022</h5>
{% if not demo %}
<div class="row pt-3">
<div class="col-5">
<a href="{{ url_for('workbench.settings') }}?opt=register" class="btn btn-primary">Get settings for register devices</a>
</div>
<div class="col">
</div>
</div>
{% if 2022_iso %}
<div class="row pt-3">
<div class="col-5">
<a href="/static/iso/2022/{{ 2022_iso }}" class="btn btn-primary">Get {{ 2022_iso }}</a>
</div>
<div class="col">
<p class="small">
Download Checksum: <a style="color: #993365;" href="/static/iso/2022/SHA512SUMS">SHA512SUMS</a> |
</p>
</div>
</div>
{% endif %}
{% else %}
{% if iso %} {% if iso %}
<div class="row pt-3"> <div class="row pt-3">
<div class="col-5"> <div class="col-5">
@ -53,18 +31,80 @@
</p> </p>
</div> </div>
</div> </div>
{% endif %} </div>
{% endif %}
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="col-xl-8"> <div class="col-xl-8">
</div> </div>
</div> </div>
{% endif %}
{% else %}
{% for d, v in iso.items() %}
{% if d != 'demo' %}
<div class="row">
<div class="col-xl-6">
<div class="card">
<div class="card-body">
<div class="pt-6 pb-2">
<h5 class="card-title text-center pb-0 fs-4">Workbench {{ d }}</h5>
<h4>Settings</h4>
{% if d == 'v14' %}
<div class="row">
<div class="col-5">
<a href="{{ url_for('workbench.settings') }}?opt=erease_basic" class="btn btn-primary">Get settings for basic erease</a>
</div>
<div class="col">
</div>
</div>
<div class="row pt-2">
<div class="col-5">
<a href="{{ url_for('workbench.settings') }}?opt=erease_sectors" class="btn btn-primary">Get settings for erease by sectors</a>
</div>
<div class="col">
</div>
</div>
{% else %}
<div class="row">
<div class="col-5">
<a href="{{ url_for('workbench.settings') }}?opt=register" class="btn btn-primary">Get settings for register devices</a>
</div>
<div class="col">
</div>
</div>
{% endif %}
{% if iso %}
<h4 class="pt-3">iso</h4>
<div class="row">
<div class="col-5">
<a href="/static/iso/{{ d }}/{{ v }}" class="btn btn-primary">Get {{ v }}</a>
</div>
<div class="col">
<p class="small">
Download Checksum: <a style="color: #993365;" href="/static/iso/{{ d }}/SHA512SUMS">SHA512SUMS</a> |
</p>
</div>
</div>
{% endif %}
</div>
</div>
</div>
</div>
<div class="col-xl-8">
</div>
</div>
{% endif %}
{% endfor %}
{% endif %}
</section> </section>
{% endblock main %} {% endblock main %}

View File

@ -2,3 +2,9 @@
DH_TOKEN = {{ token }} DH_TOKEN = {{ token }}
DH_URL = {{ url }} DH_URL = {{ url }}
{% if erease_basic %}
EREASE_BASIC = True
{% endif %}
{% if erease_sectors %}
EREASE_SECTORS = True
{% endif %}

View File

@ -33,7 +33,7 @@ class SettingsView(GenericMixin):
self.get_iso() self.get_iso()
self.opt = request.values.get('opt') self.opt = request.values.get('opt')
if self.opt in ['register']: if self.opt in ['register', 'erease_basic', 'erease_sectors']:
return self.download() return self.download()
return flask.render_template(self.template_name, **self.context) return flask.render_template(self.template_name, **self.context)
@ -44,27 +44,39 @@ class SettingsView(GenericMixin):
if self.context.get('demo'): if self.context.get('demo'):
uri = f'{path}/static/iso/demo/' uri = f'{path}/static/iso/demo/'
files = [ self.context['iso'] = {}
f for f in os.listdir(uri) if f[-3:].lower() == 'iso'
]
self.context['2022_iso'] = '' versions = os.listdir(f'{path}/static/iso/')
self.context['2022_iso_sha'] = '' versions.sort()
for d in versions:
dir_iso = f'{uri}/{d}'
if not os.path.isdir(dir_iso):
continue
files = [f for f in os.listdir(dir_iso) if f[-3:].lower() == 'iso']
if files: if files:
self.context['iso'] = files[0] self.context['iso'][f'{d}'] = files[0]
self.context['iso_sha'] = 'aaa'
def download(self): def download(self):
url = "https://{}/api/inventory/".format(app.config['HOST']) url = "https://{}/api/inventory/".format(app.config['HOST'])
self.wbContext = { self.wbContext = {
'token': self.get_token(), 'token': self.get_token(),
'url': url, 'url': url,
'erease_basic': None,
'erease_sectors': None,
} }
options = {"register": self.register} # if is a v14 version
return options[self.opt]() # TODO when not use more v14, we can remove this if
if 'erease' in self.opt:
url = "https://{}/actions/".format(app.config['HOST'])
self.wbContext['url'] = url
if self.opt == 'erease_basic':
self.wbContext['erease_basic'] = True
if self.opt == 'erease_sectors':
self.wbContext['erease_sectors'] = True
def register(self):
data = flask.render_template('workbench/wbSettings.ini', **self.wbContext) data = flask.render_template('workbench/wbSettings.ini', **self.wbContext)
return self.response_download(data) return self.response_download(data)