resolve conflict

This commit is contained in:
Cayo Puigdefabregas 2022-08-04 18:25:02 +02:00
commit 43da3f0a4f
3 changed files with 25 additions and 2 deletions

View File

@ -81,6 +81,7 @@ class DevicehubConfig(Config):
"""Admin email""" """Admin email"""
EMAIL_ADMIN = config('EMAIL_ADMIN', '') EMAIL_ADMIN = config('EMAIL_ADMIN', '')
EMAIL_DEMO = config('EMAIL_DEMO', 'hello@usody.com')
"""Definition of path where save the documents of customers""" """Definition of path where save the documents of customers"""
PATH_DOCUMENTS_STORAGE = config('PATH_DOCUMENTS_STORAGE', '/tmp/') PATH_DOCUMENTS_STORAGE = config('PATH_DOCUMENTS_STORAGE', '/tmp/')

View File

@ -19,6 +19,7 @@
<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="row pt-3">
<div class="col-5"> <div class="col-5">
<a href="{{ url_for('workbench.settings') }}?opt=register" class="btn btn-primary">Get settings for register devices</a> <a href="{{ url_for('workbench.settings') }}?opt=register" class="btn btn-primary">Get settings for register devices</a>
@ -38,6 +39,22 @@
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% else %}
{% if iso %}
<div class="row pt-3">
<div class="col-5">
<a href="/static/iso/demo/{{ iso }}" class="btn btn-primary">{{ iso }}</a>
</div>
<div class="col">
<p class="small">
Download Checksum: <a style="color: #993365;" href="/static/iso/demo/SHA512SUMS">SHA512SUMS</a>
</p>
</div>
</div>
{% endif %}
{% endif %}
</div> </div>
</div> </div>

View File

@ -24,12 +24,13 @@ class SettingsView(GenericMixin):
def dispatch_request(self): def dispatch_request(self):
self.get_context() self.get_context()
self.get_iso()
self.context.update( self.context.update(
{ {
'page_title': self.page_title, 'page_title': self.page_title,
'demo': g.user.email == app.config['EMAIL_DEMO'],
} }
) )
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']:
@ -39,8 +40,12 @@ class SettingsView(GenericMixin):
def get_iso(self): def get_iso(self):
path = Path(__file__).parent.parent path = Path(__file__).parent.parent
uri = f'{path}/static/iso/'
if self.context.get('demo'):
uri = f'{path}/static/iso/demo/'
files = [ files = [
f for f in os.listdir(f'{path}/static/iso/') if f[-3:].lower() == 'iso' f for f in os.listdir(uri) if f[-3:].lower() == 'iso'
] ]
self.context['2022_iso'] = '' self.context['2022_iso'] = ''