minimalistic settings
This commit is contained in:
parent
b927e1ac54
commit
763d2d1361
|
@ -28,22 +28,6 @@
|
||||||
<p class="small">Download the settings only for register devices.</p>
|
<p class="small">Download the settings only for register devices.</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row pt-4">
|
|
||||||
<div class="col-5">
|
|
||||||
<a href="{{ url_for('workbench.settings') }}?opt=soft" class="btn btn-primary">Register and erase disks Basic</a>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<p class="small">Download the settings for register devices and erase disks. This is less safe and more fast.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row pt-3">
|
|
||||||
<div class="col-5">
|
|
||||||
<a href="{{ url_for('workbench.settings') }}?opt=hard" class="btn btn-primary">Register and erase disks for Sectors</a>
|
|
||||||
</div>
|
|
||||||
<div class="col">
|
|
||||||
<p class="small">Download the settings for register devices and erase disks. This is more safe and more slow.</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,18 +1,4 @@
|
||||||
[settings]
|
[settings]
|
||||||
|
|
||||||
DH_TOKEN = {{token}}
|
TOKEN = {{ token }}
|
||||||
|
URL = {{ url }}
|
||||||
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
|
|
||||||
|
|
|
@ -35,36 +35,18 @@ class SettingsView(GenericMixView):
|
||||||
return flask.render_template(self.template_name, **self.context)
|
return flask.render_template(self.template_name, **self.context)
|
||||||
|
|
||||||
def download(self):
|
def download(self):
|
||||||
|
url = "https://{}/api/".format(app.config['HOST'])
|
||||||
self.wbContext = {
|
self.wbContext = {
|
||||||
'token': self.get_token(),
|
'token': self.get_token(),
|
||||||
'host': app.config['HOST'],
|
'url': url,
|
||||||
'inventory': app.config['SCHEMA'],
|
|
||||||
'benchmark': False,
|
|
||||||
'stress_test': 1,
|
|
||||||
'erase': '',
|
|
||||||
'steps': 0,
|
|
||||||
'leading_zeros': False,
|
|
||||||
}
|
}
|
||||||
options = {"register": self.register, "soft": self.soft, "hard": self.hard}
|
options = {"register": self.register}
|
||||||
return options[self.opt]()
|
return options[self.opt]()
|
||||||
|
|
||||||
def register(self):
|
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)
|
||||||
|
|
||||||
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):
|
def response_download(self, data):
|
||||||
bfile = str.encode(data)
|
bfile = str.encode(data)
|
||||||
output = make_response(bfile)
|
output = make_response(bfile)
|
||||||
|
|
Reference in New Issue