Skip to content

Commit 73b2315

Browse files
committed
[fix] UI and some minor issues
1 parent 29dcc58 commit 73b2315

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

openwisp_controller/connection/admin.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from django.core.exceptions import ObjectDoesNotExist, PermissionDenied, ValidationError
1212
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
1313
from django.db.models import Count, Q
14-
from django.http import HttpResponseForbidden, JsonResponse
14+
from django.http import HttpResponseForbidden, HttpResponseNotAllowed, JsonResponse
1515
from django.shortcuts import redirect
1616
from django.template.response import TemplateResponse
1717
from django.urls import path, resolve
@@ -73,7 +73,7 @@ class Meta:
7373
"location",
7474
]
7575
widgets = {
76-
"label": forms.TextInput(attrs={"class": "vTextField"}),
76+
"label": forms.TextInput(attrs={"class": "vTextField ow-text-field"}),
7777
"notes": forms.Textarea(attrs={"rows": 3}),
7878
"input": BatchCommandSchemaWidget,
7979
"group": OrganizationScopedSelect,
@@ -508,6 +508,8 @@ def execute_command_view(self, request):
508508
A valid submission goes to the session and redirects to the confirm
509509
page, so that its device table can be paginated with plain GETs.
510510
"""
511+
if request.method not in ("GET", "POST"):
512+
return HttpResponseNotAllowed(["GET", "POST"])
511513
self._check_add_permission(request)
512514
if request.method == "POST":
513515
form = BatchCommandExecutionForm(request.POST, request=request)
@@ -524,9 +526,6 @@ def execute_command_view(self, request):
524526
"title": _("Execute mass command"),
525527
"opts": self.opts,
526528
"form": form,
527-
# not combined with self.media: ModelAdmin.media loads
528-
# jquery.init.js before select2, the opposite of what select2
529-
# needs (see BatchCommandExecutionForm.Media)
530529
"media": form.media,
531530
"has_view_permission": self.has_view_permission(request),
532531
}
@@ -536,6 +535,8 @@ def confirm_command_view(self, request):
536535
"""Second step: review the targeted devices and dispatch the command.
537536
Dispatching is decided by the HTTP method alone.
538537
"""
538+
if request.method not in ("GET", "POST"):
539+
return HttpResponseNotAllowed(["GET", "POST"])
539540
self._check_add_permission(request)
540541
if request.method == "POST":
541542
return self._execute_batch_command(request)

openwisp_controller/connection/static/connection/css/batch-command.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@
245245
text-align: center;
246246
width: 2rem;
247247
}
248-
.execute-form .submit-row {
248+
#main .execute-form .submit-row {
249249
display: flex;
250250
gap: 0.5rem;
251251
justify-content: flex-end;
@@ -306,3 +306,6 @@
306306
.execute-batch-command .form-row.field-input.errors .flex-container {
307307
display: none;
308308
}
309+
#main .form-row .ow-text-field {
310+
width: 320px;
311+
}

openwisp_controller/connection/templates/admin/connection/batch_command/execute_command.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
{% block content %}
3232
<div id="content-main">
33-
<form method="post" novalidate>
33+
<form method="post" novalidate class="execute-form">
3434
{% csrf_token %}
3535
<nav class="stepper" aria-label="{% trans 'Execution progress' %}">
3636
<div class="stepper-step active" aria-current="step">

0 commit comments

Comments
 (0)