Attention une mise à jour du service Gitlab va être effectuée le mardi 14 décembre entre 13h30 et 14h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes.

Commit ae99af36 authored by BAIRE Anthony's avatar BAIRE Anthony
Browse files

expand the 'advanced' tab in case of server-side validation error

parent d630d502
Pipeline #53083 failed with stage
in 1 minute and 22 seconds
......@@ -142,6 +142,8 @@ class WebappForm(forms.ModelForm):
widget=forms.RadioSelect)
# Advanced
ADVANCED_FIELDS = ("docker_os", "memory_limit_mb", "job_queue",
"entrypoint", "owner", "tags")
docker_os = forms.ModelChoiceField(
queryset=DockerOs.objects.all().distinct(),
label='Operating sytem',
......
......@@ -227,6 +227,11 @@ class WebappUpdate(SuccessMessageMixin, LoginRequiredMixin, UpdateView):
def get_context_data(self, **kwargs):
ctx=super().get_context_data(**kwargs)
ctx["action"] = "Update"
# we expand the 'advanced' tab if any of its field has a validation error
ctx["show_advanced"] = bool(set(ctx["form"].errors)
.intersection(ctx["form"].ADVANCED_FIELDS))
return ctx
def get_form(self):
......@@ -287,6 +292,7 @@ class WebappCreate(SuccessMessageMixin, LoginRequiredMixin, IsProviderMixin, Cre
def get_context_data(self, **kwargs):
ctx=super().get_context_data(**kwargs)
ctx["action"] = "Create"
ctx["show_advanced"] = False
return ctx
def form_valid(self, form):
......
......@@ -66,12 +66,12 @@
<div class="card">
<div class="card-header">
<h5 class="mb-0">
<button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseAdvanced" aria-expanded="false" aria-controls="collapseAdvanced">
<button class="btn btn-link" type="button" data-toggle="collapse" data-target="#collapseAdvanced" aria-expanded="{{show_advanced}}" aria-controls="collapseAdvanced">
Advanced options
</button>
</h5>
</div>
<div class="collapse" id="collapseAdvanced">
<div class="collapse {% if show_advanced %}show{% endif %}" id="collapseAdvanced">
<div class="card-body">
<div class="form-row">
......
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