Skip to content

Commit

Permalink
feat: Added demo mode
Browse files Browse the repository at this point in the history
  • Loading branch information
onuratakan committed Nov 4, 2024
1 parent c5a056e commit ce5db08
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 1 deletion.
8 changes: 8 additions & 0 deletions upsonic_on_prem/dash/app/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ <h1 class="uk-h2 uk-margin text-foreground">Your Libraries</h1>
{% include 'home/tableview.html' %}
{% endif %}




{% demo_mode as demo_mode %}

{% if not demo_mode %}
<div uk-grid class="uk-margin-medium-bottom uk-margin-large-top">
<div class="uk-width-expand">
<h1 class="uk-h2 uk-margin text-foreground">Connection Code</h1>
Expand All @@ -54,6 +60,8 @@ <h1 class="uk-h2 uk-margin text-foreground">Connection Code</h1>
</div>
</div>

{% endif %}



{% else %}
Expand Down
7 changes: 7 additions & 0 deletions upsonic_on_prem/dash/app/templates/libraries/element.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,18 @@ <h3 class="uk-card-title">Object</h3>

</div>


{% debug_mode as debug_mode %}
{% if not debug_mode %}
<div class="custom_code_block uk-card">
<div class="custom_code_block_code">
<div class="highlight"><pre><code class="language-python">{{using_code}}</code></pre></div>
</div>
</div>

{% endif %}


{% if requirements != "" %}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ <h3 class="uk-card-title">Run History</h3>




{% demo_mode as demo_mode %}
{% if not demo_mode %}
<div class=" uk-card" style="padding-left: 0px;">
<div class="uk-card-header">
<h3 class="uk-card-title">Object Settings</h3>
Expand All @@ -73,6 +74,7 @@ <h3 class="uk-card-title">Object Settings</h3>
<a href="{% url 'delete_scope' id=control_library %}"class="uk-button uk-button-danger">Delete Object</a>
</div>
</div>
{% endif %}



Expand Down
5 changes: 5 additions & 0 deletions upsonic_on_prem/dash/app/templatetags/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ def debug_mode():
return settings.DEBUG


@register.simple_tag(name="demo_mode")
def demo_mode():
return settings.DEMO_MODE


@register.simple_tag(name="sentry")
def sentry():
return settings.sentry
Expand Down
3 changes: 3 additions & 0 deletions upsonic_on_prem/dash/dash/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,9 @@
debug_mode = os.environ.get("debug", "false").lower() == "true"
DEBUG = debug_mode

DEMO_MODE = os.environ.get("demo_mode", "false").lower() == "true"


# TODO: Adding csrf protection

AUTHENTICATION_BACKENDS = [
Expand Down

0 comments on commit ce5db08

Please sign in to comment.