Skip to content

Commit

Permalink
add short action ID text next to action, add ability to create Action…
Browse files Browse the repository at this point in the history
…s for Custom Functions
  • Loading branch information
kizniche committed Dec 10, 2023
1 parent 6e5d1c1 commit f7765e7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
1 change: 0 additions & 1 deletion mycodo/inputs/mycodo_ram.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# coding=utf-8
import copy
import resource

from mycodo.inputs.base_input import AbstractInput
from mycodo.mycodo_client import DaemonControl
Expand Down
2 changes: 1 addition & 1 deletion mycodo/mycodo_flask/templates/pages/actions.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

{% if 'name' in dict_options and 'message' in dict_options %}
<div class="col-12">
<strong title="UUID: {{unique_id}}">[{{_('Action')}}] {{dict_options["name"]}}</strong>: {{dict_options["message"]}}
<strong title="UUID: {{unique_id}}">[{{_('Action')}} {{unique_id.split('-')[0]}}] {{dict_options["name"]}}</strong>: {{dict_options["message"]}}
</div>
{% endif %}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,36 @@ <h5>{{_('Measurement Settings')}}</h5>

</form>

{% if 'enable_actions' in dict_options['options_enabled']%}

<form method="post" action="/function">
{{form_actions.csrf_token}}
{{form_actions.device_id(class_='form-control', value=each_function.unique_id)}}
{{form_actions.function_type(class_='form-control', value='function')}}

<div class="row align-items-end small-gutters" style="border-bottom: 1px solid #ddd; padding: 1.5em 0 0.2em 0.1em">
<div class="col-auto">
<select class="selectpicker" data-live-search="true" title="{{_('Action')}}: {{dict_translation['select_one']['title']}}" id="action_type_{{each_function.unique_id}}" name="action_type">
{% for value, name in choices_actions %}
<option value="{{value}}">{{name}}</option>
{% endfor %}
</select>
</div>
<div class="col-auto">
<input onclick="return $(this).processRequest(this, 'add_action');" name="add_action" value="{{_('Add')}}" class="form-control btn btn-primary btn-sm btn-block" type="button"/>
</div>
</div>

</form>

{% set post_action = "/function" %}

<div id="mod_function_actions_{{each_function.unique_id}}">
{% for each_action in action if each_action.function_id == each_function.unique_id %}
{% include 'pages/actions.html' %}
{% endfor %}
</div>

{% endif %}

</div>

0 comments on commit f7765e7

Please sign in to comment.