Skip to content

Commit

Permalink
Added update script
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeoLacruz committed Dec 16, 2024
1 parent ba7dc56 commit 19defb9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
8 changes: 4 additions & 4 deletions piusv/webif/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ def get_data_html(self, dataSet=None):

data['items'] = {}
for item in self.plugin.item_list:
data['items'][item.property.path] = {}
data['items'][item.property.path]['value'] = item.property.value
data['items'][item.property.path]['last_update'] = item.property.last_update.strftime('%d.%m.%Y %H:%M:%S')
data['items'][item.property.path]['last_change'] = item.property.last_change.strftime('%d.%m.%Y %H:%M:%S')
data['items'][item.id()] = {}
data['items'][item.id()]['value'] = item.property.value
data['items'][item.id()]['last_update'] = item.property.last_update.strftime('%d.%m.%Y %H:%M:%S')
data['items'][item.id()]['last_change'] = item.property.last_change.strftime('%d.%m.%Y %H:%M:%S')
data['plugin_suspended'] = self.plugin.suspended
data['maintenance'] = True if self.plugin.log_level <= 20 else False
try:
Expand Down
16 changes: 15 additions & 1 deletion piusv/webif/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,24 @@
Additional script tag for plugin specific javascript code go into this block
-->
{% block pluginscripts %}

<script>
function handleUpdatedData(response, dataSet=null) {
if (dataSet === 'devices_info' || dataSet === null) {
objResponse = JSON.parse(response);
for (item in objResponse['items']) {
shngInsertText (item+'_value', objResponse['items'][item]['value'], 'maintable', 1);
shngInsertText (item+'_last_update', objResponse['items'][item]['last_update'], 'maintable', 1);
shngInsertText (item+'_last_change', objResponse['items'][item]['last_change'], 'maintable', 1);
}
}

}
</script>
{% endblock pluginscripts %}

{% block headtable %}
<span id='suspended' style="display:none">{{ p.suspended }}</span>
<span id='suspended' style="display:inone">{{ p.suspended }}</span>

<table class="table table-striped table-hover">
<tbody>
Expand Down

0 comments on commit 19defb9

Please sign in to comment.