Commit be3e8283 authored by sebastien letort's avatar sebastien letort

Minor: page layout, comments, typo

parent 8215d7d4
......@@ -128,8 +128,9 @@ class RunnerForm(forms.ModelForm):
class WebappForm(forms.ModelForm):
# Basic
name = forms.CharField(label="Application name", label_suffix="")
contact = forms.EmailField(label="Email contact", label_suffix="", required=False, help_text="By default this will be your personnal e-mail address. You may fill this field if you wish to use a different contact address.")
name = forms.CharField(label="Application name", label_suffix="")
contact = forms.EmailField(label="Email contact", label_suffix="",
required=False, help_text="By default this will be your personnal e-mail address. You may fill this field if you wish to use a different contact address.")
description = forms.CharField(widget=forms.Textarea, label="Description", label_suffix="")
private = forms.TypedChoiceField(
coerce=lambda x: x == 'True',
......@@ -158,8 +159,10 @@ class WebappForm(forms.ModelForm):
entrypoint = forms.CharField(label="Entrypoint", label_suffix="",
help_text=mark_safe('This is the <a href="https://allgo.gitlabpages.inria.fr/doc/deploy.html#entrypoint">command executed when allgo runs a job</a> for this app.'),
initial="/home/allgo/entrypoint")
owner = forms.CharField(required=False, label="Owner", label_suffix='', help_text="Username of the new owner of the application. You will immediately loose access to the application.")
tags = TagField(required=False, label_suffix='', help_text="Tags are separated by a comma.")
owner = forms.CharField(required=False, label="Owner", label_suffix='',
help_text="Username of the new owner of the application. You will immediately loose access to the application.")
tags = TagField(required=False, label_suffix='',
help_text="Tags are separated by a comma.")
def __init__(self, *args, **kwargs):
super(WebappForm, self).__init__(*args, **kwargs)
......
......@@ -211,5 +211,3 @@ def query_webapps_for_user(user):
# select webapps that are either public or owned by the user
return Webapp.objects.filter(Q(private=False) | Q(user_id=user.id))
......@@ -226,10 +226,11 @@ class Webapp(TimeStampModel):
private = models.BooleanField(default=1)
#FIXME: unused field
access_token = models.CharField(max_length=255, blank=True, null=True,
access_token = models.CharField(max_length=255, blank=True, null=True,
validators=[token_validator])
sandbox_state = models.IntegerField(null=True, choices=SANDBOX_STATE_CHOICES, default=IDLE)
sandbox_version = models.ForeignKey('WebappVersion', null=True, blank=True, related_name='webappversions')
sandbox_version = models.ForeignKey('WebappVersion', null=True, blank=True,
related_name='webappversions')
notebook_gitrepo = models.CharField(max_length=255, blank=True, null=True)
memory_limit = models.BigIntegerField(null=True,
......
......@@ -282,10 +282,10 @@ class WebappCreate(ProviderAccessMixin, SuccessMessageMixin, CreateView):
group_required: groups that user must belong to.
"""
model = Webapp
model = Webapp
form_class = WebappForm
success_message = 'Webapp created successfully.'
template_name = 'webapp_add_update.html'
template_name = 'webapp_add_update.html'
# group_required = ['inria', ]
def get_success_url(self):
......@@ -1104,7 +1104,7 @@ class JobDetail(JobAuthMixin, DetailView):
class JobCreate(AllAccessMixin, SuccessMessageMixin, CreateView):
""" Display the data related a specific web and create a job instance
""" Display the data related a specific app and create a job instance
into the database
Attributes:
......
......@@ -16,30 +16,42 @@
<div class="card-body">
<nav class="navbar">
<ul class="nav nav-bar mx-auto">
<li class="nav-item">
<li class="nav-item"><!-- Run a job -->
<a
class="nav-link"
href="{% url 'main:webapp_detail' webapp.docker_name %}"
title="Start a job"
data-toggle="tooltip"
data-placement="bottom" ><i class="fas fa-play" data-fa-transform="shrink-10 up-.5" data-fa-mask="fas fa-circle"></i><span class="text-hide">Run a job</a></li>
data-placement="bottom" >
<i class="fas fa-play" data-fa-transform="shrink-10 up-.5" data-fa-mask="fas fa-circle"></i>
<span class="text-hide">Run a job</span>
</a>
</li>
{% if webapp.notebook_gitrepo %}
<li class="nav-item">
<li class="nav-item"><!-- Run a Notebook -->
<a
class="nav-link"
href="/jupyter?repo={{ webapp.notebook_gitrepo }}"
title="Start a Jupyter notebook"
data-toggle="tooltip"
data-placement="bottom"><i class="fas fa-sticky-note" data-fa-transform="shrink-10 up-.5" data-fa-mask="fas fa-circle"></i><span class="text-hide">Run notebook</a></li>
{% endif %}
data-placement="bottom">
<i class="fas fa-sticky-note" data-fa-transform="shrink-10 up-.5" data-fa-mask="fas fa-circle"></i>
<span class="text-hide">Run notebook</span>
</a>
</li>
{% endif %}
{% if webapp.user == user and webapp.sandbox_state != webapp.IDLE %}
<li class="nav-item">
<li class="nav-item"><!-- sandbox -->
<a
class="nav-link app-unfinished"
href="{% url 'main:webapp_sandbox_panel' webapp.docker_name %}"
title="There is an active sandbox"
data-toggle="tooltip"
data-placement="bottom"><i class="fas fa-exclamation-circle"></i><span class="text-hide">There is an active sandbox</span></a></li>
data-placement="bottom">
<i class="fas fa-exclamation-circle"></i>
<span class="text-hide">There is an active sandbox</span>
</a>
</li>
{% endif %}
</ul>
</nav>
......
......@@ -27,17 +27,14 @@
{% endif %}
</div>
</div>
<div class="col">
<div class="form-group">
{{ form.contact.label_tag }}
{{ form.contact | attr:"placeholder:john.smith@example.net" | add_class:"form-control" }}
<small class="form-text text-muted">{{ form.contact.help_text }}</small>
</div>
</div>
</div>
</div><!--form-row-->
<div class="form-group">
{{ form.description.label_tag }}
......@@ -48,20 +45,20 @@
<div class="form-group">
{{ form.private.label_tag }}
<div class="btn-group btn-group-toggle" data-toggle="buttons">
{% for private_field in form.private %}
<label class="btn btn-secondary {% if private_field.data.selected %}active{% endif %}">
<input
type="{{ private_field.data.type }}"
id="{{ private_field.id_for_label }}"
value="{{ private_field.data.value }}"
name="{{ private_field.data.name }}"
{% if private_field.data.selected %}checked{% endif %}>
{{ private_field.choice_label }}
</label>
{% endfor %}
{% for private_field in form.private %}
<label class="btn btn-secondary {% if private_field.data.selected %}active{% endif %}">
<input
type="{{ private_field.data.type }}"
id="{{ private_field.id_for_label }}"
value="{{ private_field.data.value }}"
name="{{ private_field.data.name }}"
{% if private_field.data.selected %}checked{% endif %}>
{{ private_field.choice_label }}
</label>
{% endfor %}
</div>
<small class="form-text text-muted">{{ form.private.help_text }}</small>
</div>
</div><!--form-group-->
<div class="card">
<div class="card-header">
......@@ -98,7 +95,6 @@
<div class="form-row">
<div class="form-group col-md-6">
{{ form.job_queue.label_tag }}
<select name="{{ form.job_queue.name }}" id="{{ form.job_queue.id_for_label }}" class="form-control">
{% for choice in form.job_queue.field.queryset %}
<option value="{{ choice.pk }}"
......@@ -113,7 +109,7 @@
{{ form.tags | attr:"placeholder:comma, separated, tags" | add_class:"form-control" }}
<small class="form-text text-muted">{{ form.tags.help_text }}</small>
</div>
</div>
</div><!-- form-group col-md-6 -->
<div class="form-group col-md-6">
{{ form.entrypoint.label_tag }}
......@@ -122,15 +118,15 @@
</div>
<small class="form-text text-muted">{{ form.entrypoint.help_text }}</small>
{% if action != "Create" %}
<div class="form-group">
{{ form.owner.label_tag }}
{{ form.owner | attr:"placeholder:Enter the new owner username" | add_class:"form-control" }}
<small class="form-text text-muted">{{ form.owner.help_text }}</small>
</div>
{% endif %}
</div>
{% if action != "Create" %}
<div class="form-group">
{{ form.owner.label_tag }}
{{ form.owner | attr:"placeholder:Enter the new owner username" | add_class:"form-control" }}
<small class="form-text text-muted">{{ form.owner.help_text }}</small>
</div>
{% endif %}
</div><!-- form-group col-md-6 -->
</div>
</div>
</div>
......
# code from https://github.com/opendns/registry-oauth-server/blob/master/tokens.py
import time
import hashlib
import base64
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment