diff --git a/ereuse_devicehub/static/iso/SHA512SUMS b/ereuse_devicehub/static/iso/SHA512SUMS deleted file mode 100644 index 04c30697..00000000 --- a/ereuse_devicehub/static/iso/SHA512SUMS +++ /dev/null @@ -1 +0,0 @@ -868e59911be73a941938644143d81f21a2fdbe82ea0841493c2d9fc04701e058334af5fecd69c1a1525ebd5c8c17ac3f49d8ecc53bbfc8a018f169be48fe79d6 USODY_2022.5.2-beta.iso diff --git a/ereuse_devicehub/static/iso/SHA512SUMS.sign b/ereuse_devicehub/static/iso/SHA512SUMS.sign deleted file mode 100644 index e69de29b..00000000 diff --git a/ereuse_devicehub/templates/workbench/settings.html b/ereuse_devicehub/templates/workbench/settings.html index b66f5475..6f2b28cd 100644 --- a/ereuse_devicehub/templates/workbench/settings.html +++ b/ereuse_devicehub/templates/workbench/settings.html @@ -11,6 +11,7 @@
+ {% if demo %}
@@ -19,29 +20,6 @@
Workbench 2022
- {% if not demo %} - - {% if 2022_iso %} -
- -
-

- Download Checksum: SHA512SUMS | -

-
-
- {% endif %} - - {% else %} - {% if iso %}
@@ -53,18 +31,80 @@

- {% endif %} - {% endif %}
-
-
+ {% endif %} + + {% else %} + {% for d, v in iso.items() %} + {% if d != 'demo' %} +
+
+ +
+
+ +
+
Workbench {{ d }}
+

Settings

+ {% if d == 'v14' %} + + + {% else %} + + {% endif %} + {% if iso %} +

iso

+
+ +
+

+ Download Checksum: SHA512SUMS | +

+
+
+ {% endif %} +
+
+ +
+ +
+
+
+
+ {% endif %} + {% endfor %} + + {% endif %} + +
{% endblock main %} diff --git a/ereuse_devicehub/templates/workbench/wbSettings.ini b/ereuse_devicehub/templates/workbench/wbSettings.ini index 7d0b9088..8f756c1a 100644 --- a/ereuse_devicehub/templates/workbench/wbSettings.ini +++ b/ereuse_devicehub/templates/workbench/wbSettings.ini @@ -2,3 +2,9 @@ DH_TOKEN = {{ token }} DH_URL = {{ url }} +{% if erease_basic %} +EREASE_BASIC = True +{% endif %} +{% if erease_sectors %} +EREASE_SECTORS = True +{% endif %} diff --git a/ereuse_devicehub/workbench/views.py b/ereuse_devicehub/workbench/views.py index 4b9ec4d0..9ef4d6e6 100644 --- a/ereuse_devicehub/workbench/views.py +++ b/ereuse_devicehub/workbench/views.py @@ -33,7 +33,7 @@ class SettingsView(GenericMixin): self.get_iso() self.opt = request.values.get('opt') - if self.opt in ['register']: + if self.opt in ['register', 'erease_basic', 'erease_sectors']: return self.download() return flask.render_template(self.template_name, **self.context) @@ -44,27 +44,39 @@ class SettingsView(GenericMixin): if self.context.get('demo'): uri = f'{path}/static/iso/demo/' - files = [ - f for f in os.listdir(uri) if f[-3:].lower() == 'iso' - ] + self.context['iso'] = {} - self.context['2022_iso'] = '' - self.context['2022_iso_sha'] = '' + versions = os.listdir(f'{path}/static/iso/') + versions.sort() - if files: - self.context['iso'] = files[0] - self.context['iso_sha'] = 'aaa' + 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: + self.context['iso'][f'{d}'] = files[0] def download(self): url = "https://{}/api/inventory/".format(app.config['HOST']) self.wbContext = { 'token': self.get_token(), 'url': url, + 'erease_basic': None, + 'erease_sectors': None, } - options = {"register": self.register} - return options[self.opt]() + # if is a v14 version + # 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) return self.response_download(data)