Skip to content

Commit

Permalink
feat: Added yc_demo mode
Browse files Browse the repository at this point in the history
  • Loading branch information
onuratakan committed Nov 11, 2024
1 parent 78b8fcd commit 0030ffb
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ <h1 class="uk-h2 uk-margin text-foreground">
<div class="uk-navbar-right ">
<ul class="uk-navbar-nav uk-margin-medium-right" style="gap: 0.5rem;">


{% yc_demo as yc_demo %}
{% if not yc_demo %}

<a href="#" onclick="page_load('{% url 'control_element' id=control_library_with_version %}');event.preventDefault();" class="uk-button uk-button{% if sub_page_title == 'Home' %}-primary{% else %}-default{% endif %}"><span uk-icon="home" class="uk-margin-small-right"></span>Home</a>

Expand All @@ -55,7 +56,7 @@ <h1 class="uk-h2 uk-margin text-foreground">

<a href="#" onclick="page_load('{% url 'control_element_settings' id=control_library_with_version %}');event.preventDefault();" class="uk-button uk-button{% if sub_page_title == 'Settings' %}-primary{% else %}-default{% endif %}"><span uk-icon="settings" class="uk-margin-small-right"></span>Settings</a>


{% endif %}

</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,19 +53,29 @@
<div class="uk-navbar-right">
<ul class="uk-navbar-nav uk-margin-medium-right" style="gap: 0.5rem;">

{% if value == False %}
{% if value == False %}

<a href="#" onclick="page_load('{% url 'control_element' id=key %}');event.preventDefault();" class="uk-button uk-button-default" style="width: 1px;" uk-tooltip="Home"><span uk-icon="home"></span></a>



{% yc_demo as yc_demo %}
{% if not yc_demo %}
<a href="#" onclick="page_load('{% url 'control_element_commits' id=key %}');event.preventDefault();" class="uk-button uk-button-default" style="width: 1px;" uk-tooltip="Commits"><span uk-icon="push"></span></a>
<a href="#" onclick="page_load('{% url 'control_element_runs' id=key %}');event.preventDefault();" class="uk-button uk-button-default" style="width: 1px;" uk-tooltip="Run History"><span uk-icon="server"></span></a>
<a href="#" onclick="page_load('{% url 'control_element_dependency' id=key %}');event.preventDefault();" class="uk-button uk-button-default" style="width: 1px;" uk-tooltip="Dependency"><span uk-icon="thumbnails"></span></a>
<a href="#" onclick="page_load('{% url 'control_element_settings' id=key %}');event.preventDefault();" class="uk-button uk-button-default" style="width: 1px;" uk-tooltip="Settings"><span uk-icon="settings"></span></a>
{% endif %}

{% else %}
<a href="#" onclick="page_load('{% url 'control_library' id=key %}');event.preventDefault();" class="uk-button uk-button-default" style="width: 1px;" uk-tooltip="Home"><span uk-icon="home"></span></a>

{% yc_demo as yc_demo %}
{% if not yc_demo %}
<a href="#" onclick="page_load('{% url 'control_library_settings' id=key %}');event.preventDefault();" class="uk-button uk-button-default" style="width: 1px;" uk-tooltip="Settings"><span uk-icon="settings"></span></a>
{% endif %}

{% endif %}


</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ <h1 class="uk-h2 uk-margin text-foreground">
<div class="uk-navbar-right">
<ul class="uk-navbar-nav uk-margin-medium-right" style="gap: 0.5rem;">

{% yc_demo as yc_demo %}
{% if not yc_demo %}


<a href="#" onclick="page_load('{% url 'control_library' id=control_library_with_version %}');event.preventDefault();" class="uk-button uk-button{% if sub_page_title == 'Home' %}-primary{% else %}-default{% endif %}"><span uk-icon="home" class="uk-margin-small-right"></span>home</a>


Expand All @@ -40,7 +44,7 @@ <h1 class="uk-h2 uk-margin text-foreground">
<a href="#" onclick="page_load('{% url 'control_library_settings' id=control_library_with_version %}');event.preventDefault();" class="uk-button uk-button{% if sub_page_title == 'Settings' %}-primary{% else %}-default{% endif %}"><span uk-icon="settings" class="uk-margin-small-right"></span>Settings</a>



{%endif%}


</ul>
Expand Down
4 changes: 4 additions & 0 deletions upsonic_on_prem/dash/app/templatetags/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def debug_mode():
def demo_mode():
return settings.DEMO_MODE

@register.simple_tag(name="yc_mode")
def yc_mode():
return settings.YC_MODE


@register.simple_tag(name="sentry")
def sentry():
Expand Down
2 changes: 1 addition & 1 deletion upsonic_on_prem/dash/dash/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
DEBUG = debug_mode

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

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

# TODO: Adding csrf protection

Expand Down

0 comments on commit 0030ffb

Please sign in to comment.