From 763d2d13619e777453f04ff0fc93e1de2d89b49a Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 12 May 2022 17:19:22 +0200 Subject: [PATCH] minimalistic settings --- .../templates/workbench/settings.html | 16 ------------- .../templates/workbench/wbSettings.ini | 18 ++------------ ereuse_devicehub/workbench/views.py | 24 +++---------------- 3 files changed, 5 insertions(+), 53 deletions(-) diff --git a/ereuse_devicehub/templates/workbench/settings.html b/ereuse_devicehub/templates/workbench/settings.html index 6fbeb592..6c762f70 100644 --- a/ereuse_devicehub/templates/workbench/settings.html +++ b/ereuse_devicehub/templates/workbench/settings.html @@ -28,22 +28,6 @@

Download the settings only for register devices.

-
- -
-

Download the settings for register devices and erase disks. This is less safe and more fast.

-
-
-
- -
-

Download the settings for register devices and erase disks. This is more safe and more slow.

-
-
diff --git a/ereuse_devicehub/templates/workbench/wbSettings.ini b/ereuse_devicehub/templates/workbench/wbSettings.ini index ea45e547..8ce2cf40 100644 --- a/ereuse_devicehub/templates/workbench/wbSettings.ini +++ b/ereuse_devicehub/templates/workbench/wbSettings.ini @@ -1,18 +1,4 @@ [settings] -DH_TOKEN = {{token}} - -DH_HOST = {{host}} -DH_DATABASE = {{inventory}} -DEVICEHUB_URL = https://${DB_HOST}/${DB_DATABASE}/ - - -WB_BENCHMARK = {{ benchmark }} -WB_STRESS_TEST = {{ stress_test }} -WB_SMART_TEST = short - -WB_ERASE = {{ erase }} -WB_ERASE_STEPS = {{ steps }} -WB_ERASE_LEADING_ZEROS = {{ leading_zeros }} - -WB_DEBUG = True +TOKEN = {{ token }} +URL = {{ url }} diff --git a/ereuse_devicehub/workbench/views.py b/ereuse_devicehub/workbench/views.py index ccbdbdc5..ef0c5f8b 100644 --- a/ereuse_devicehub/workbench/views.py +++ b/ereuse_devicehub/workbench/views.py @@ -35,36 +35,18 @@ class SettingsView(GenericMixView): return flask.render_template(self.template_name, **self.context) def download(self): + url = "https://{}/api/".format(app.config['HOST']) self.wbContext = { 'token': self.get_token(), - 'host': app.config['HOST'], - 'inventory': app.config['SCHEMA'], - 'benchmark': False, - 'stress_test': 1, - 'erase': '', - 'steps': 0, - 'leading_zeros': False, + 'url': url, } - options = {"register": self.register, "soft": self.soft, "hard": self.hard} + options = {"register": self.register} return options[self.opt]() def register(self): data = flask.render_template('workbench/wbSettings.ini', **self.wbContext) return self.response_download(data) - def soft(self): - self.wbContext['erase'] = 'EraseBasic' - self.wbContext['steps'] = 1 - data = flask.render_template('workbench/wbSettings.ini', **self.wbContext) - return self.response_download(data) - - def hard(self): - self.wbContext['erase'] = 'EraseSectors' - self.wbContext['steps'] = 1 - self.wbContext['leading_zeros'] = True - data = flask.render_template('workbench/wbSettings.ini', **self.wbContext) - return self.response_download(data) - def response_download(self, data): bfile = str.encode(data) output = make_response(bfile)