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
|
from device.models import Device
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
device_logger = logging.getLogger('device_log')
|
||||||
|
|
||||||
class NewActionView(View):
|
class NewActionView(View):
|
||||||
|
|
||||||
|
@ -26,6 +27,10 @@ class NewActionView(View):
|
||||||
user=request.user,
|
user=request.user,
|
||||||
institution=request.user.institution,
|
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.")
|
messages.success(request, f"Action to '{state_definition.state}' has been added.")
|
||||||
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>
|
<a href="#details" class="nav-link active" data-bs-toggle="tab" data-bs-target="#details">{% trans 'General details' %}</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<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>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a href="#user_properties" class="nav-link" data-bs-toggle="tab" data-bs-target="#user_properties">{% trans 'User properties' %}</a>
|
<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>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<!-- States list -->
|
<!-- Log Tab TODO: currently only displays states, change when log table is implemented-->
|
||||||
|
|
||||||
<div class="tab-pane fade" id="states">
|
<div class="tab-pane fade" id="log">
|
||||||
<h5 class="card-title mb-3">{% trans 'History of States' %}</h5>
|
<h5 class="card-title mb-3">{% trans 'Log' %}</h5>
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table table-striped table-bordered">
|
<table class="table table-striped table-bordered">
|
||||||
<thead class="table">
|
<thead class="table">
|
||||||
|
|
Loading…
Reference in a new issue