changed tab to log and added logging
This commit is contained in:
parent
ac1d5a3ab0
commit
3ad5699c46
|
@ -6,7 +6,8 @@ from action.models import State, StateDefinition
|
|||
from device.models import Device
|
||||
import logging
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
device_logger = logging.getLogger('device_log')
|
||||
|
||||
class NewActionView(View):
|
||||
|
||||
|
@ -26,9 +27,13 @@ class NewActionView(View):
|
|||
user=request.user,
|
||||
institution=request.user.institution,
|
||||
)
|
||||
#TODO: also change logger for full fledged table
|
||||
device_logger.info(
|
||||
f"Updated State to (key='{state_definition.state}', for device value='{snapshot_uuid}') by user {self.request.user}."
|
||||
)
|
||||
|
||||
messages.success(request, f"Action to '{state_definition.state}' has been added.")
|
||||
return redirect(request.META.get('HTTP_REFERER'))
|
||||
else:
|
||||
messages.error(request, "There was an error with your submission.")
|
||||
return redirect(request.META.get('HTTP_REFERER'))
|
||||
return redirect(request.META.get('HTTP_REFERER'))
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
<a href="#details" class="nav-link active" data-bs-toggle="tab" data-bs-target="#details">{% trans 'General details' %}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#states" class="nav-link" data-bs-toggle="tab" data-bs-target="#states">{% trans 'States' %}</a>
|
||||
<a href="#log" class="nav-link" data-bs-toggle="tab" data-bs-target="#log">{% trans 'Log' %}</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a href="#user_properties" class="nav-link" data-bs-toggle="tab" data-bs-target="#user_properties">{% trans 'User properties' %}</a>
|
||||
|
@ -162,10 +162,10 @@
|
|||
</div>
|
||||
|
||||
|
||||
<!-- States list -->
|
||||
<!-- Log Tab TODO: currently only displays states, change when log table is implemented-->
|
||||
|
||||
<div class="tab-pane fade" id="states">
|
||||
<h5 class="card-title mb-3">{% trans 'History of States' %}</h5>
|
||||
<div class="tab-pane fade" id="log">
|
||||
<h5 class="card-title mb-3">{% trans 'Log' %}</h5>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead class="table">
|
||||
|
|
Loading…
Reference in a new issue