Plugins 0.2 - UI fixes

This commit is contained in:
Jokob-sk
2023-02-20 20:45:18 +11:00
parent 647013f3ff
commit 43d5c51e7c
4 changed files with 59 additions and 48 deletions

View File

@@ -2441,7 +2441,7 @@ def send_notifications ():
changedPorts_json_struc = None changedPorts_json_struc = None
# DEBUG - print number of rows updated # DEBUG - print number of rows updated
mylog('info', [' Notifications: ', sql.rowcount]) mylog('info', ['[', timeNow(), '] Notifications: ', sql.rowcount])
# Commit changes # Commit changes
commitDB() commitDB()
@@ -3889,8 +3889,6 @@ def process_plugin_events(plugin):
index += 1 index += 1
# Merge existing plugin objects with newly discovered ones and update existin ones with new values # Merge existing plugin objects with newly discovered ones and update existin ones with new values
for eveObj in pluginEvents: for eveObj in pluginEvents:
if eveObj.status == 'new': if eveObj.status == 'new':
@@ -3935,14 +3933,6 @@ def process_plugin_events(plugin):
commitDB() commitDB()
# TODO HERE test on empty DB as well
# collect notifications here as well?
# delete the events here or later? probably later - on notification fail
# so the events can be reanalyzed and notification re-send
# enable form controls on table columns
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
class plugin_object_class: class plugin_object_class:
def __init__(self, plugin, objDbRow): def __init__(self, plugin, objDbRow):

View File

@@ -9,7 +9,7 @@ services:
volumes: volumes:
- ${APP_DATA_LOCATION}/pialert/config:/home/pi/pialert/config - ${APP_DATA_LOCATION}/pialert/config:/home/pi/pialert/config
# - ${APP_DATA_LOCATION}/pialert/db/pialert.db:/home/pi/pialert/db/pialert.db # - ${APP_DATA_LOCATION}/pialert/db/pialert.db:/home/pi/pialert/db/pialert.db
- ${APP_DATA_LOCATION}/pialert/db2:/home/pi/pialert/db - ${APP_DATA_LOCATION}/pialert/db:/home/pi/pialert/db
# (optional) useful for debugging if you have issues setting up the container # (optional) useful for debugging if you have issues setting up the container
- ${LOGS_LOCATION}:/home/pi/pialert/front/log - ${LOGS_LOCATION}:/home/pi/pialert/front/log
# DELETE START anyone trying to use this file: comment out / delete BELOW lines, they are only for development purposes # DELETE START anyone trying to use this file: comment out / delete BELOW lines, they are only for development purposes

View File

@@ -23,7 +23,7 @@
<ul id="tabs-location" class="nav nav-tabs"> <ul id="tabs-location" class="nav nav-tabs">
<!-- PLACEHOLDER --> <!-- PLACEHOLDER -->
</ul> </ul>
<div id="tabs-content-location" class="tab-content"> <div id="tabs-content-location" class="nav nav-tabs">
<!-- PLACEHOLDER --> <!-- PLACEHOLDER -->
</div> </div>
@@ -171,39 +171,60 @@ function generateTabs()
$('#tabs-content-location').append( $('#tabs-content-location').append(
` `
<div id="${obj.unique_prefix}" class="tab-pane ${activetab}"> <div id="${obj.unique_prefix}" class="tab-pane ${activetab}">
<div> <div class="nav-tabs-custom" style="margin-bottom: 0px">
<a href="https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins/${obj.code_name}" target="_blank"><?= lang('Gen_Help');?></a> <ul class="nav nav-tabs">
<li class="active">
<a href="#objectsTarget" data-toggle="tab" >
<i class="fa fa-cube"></i> <?= lang('Plugins_Objects');?> (${pluginObjects.length})
</a>
</li>
<li>
<a href="#eventsTarget" data-toggle="tab" >
<i class="fa fa-bolt"></i> <?= lang('Plugins_Unprocessed_Events');?> (${pluginUnprocessedEvents.length})
</a>
</li>
<ul>
</div> </div>
<div class="tab-content">
<div id="objectsTarget" class="tab-pane active">
<table class="table table-striped">
<tbody>
<tr>
${headersHtml}
</tr>
${obRows}
</tbody>
</table>
</div>
<div id="eventsTarget" class="tab-pane">
<table class="table table-striped">
<tbody>
<tr>
${headersHtml}
</tr>
${evRows}
</tbody>
</table>
</div>
</div>
${localize(obj, 'description')} ${localize(obj, 'description')}
<h5>
<i class="fa fa-clock"></i> <?= lang('Plugins_Unprocessed_Events');?>
</h5>
<hr>
<table class="table table-striped"> <span>
<a href="https://github.com/jokob-sk/Pi.Alert/tree/main/front/plugins/${obj.code_name}" target="_blank"><?= lang('Gen_Help');?></a>
</span>
<tbody>
<tr>
${headersHtml}
</tr>
${evRows}
</tbody>
</table>
<h5>
<i class="fa fa-clock"></i> <?= lang('Plugins_Objects');?>
</h5>
<hr>
<table class="table table-striped">
<tbody>
<tr>
${headersHtml}
</tr>
${obRows}
</tbody>
</table>
</div> </div>
`); `);

View File

@@ -121,10 +121,10 @@ Example:
- `API_SQL` - (optional) Generates a `table_` + code_name + `.json` file as per [API docs](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/API.md). - `API_SQL` - (optional) Generates a `table_` + code_name + `.json` file as per [API docs](https://github.com/jokob-sk/Pi.Alert/blob/main/docs/API.md).
- `RUN_TIMEOUT` - (optional) Max execution time of the script. If not specified a default value of 10 seconds is used to prevent hanging. - `RUN_TIMEOUT` - (optional) Max execution time of the script. If not specified a default value of 10 seconds is used to prevent hanging.
- `WATCH` - (optional) Which database columns are watched for changes for this particular plugin. If not specified no notifications are sent. - `WATCH` - (optional) Which database columns are watched for changes for this particular plugin. If not specified no notifications are sent.
- `REPORT_ON` - (optional) Send a notification only on these statuses. Supprted options are: - `REPORT_ON` - (optional) Send a notification only on these statuses. Supported options are:
- `new` means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered. - `new` means a new unique (unique combination of PrimaryId and SecondaryId) object was discovered.
- `watched-changed` - means that selected `Watched_ValueN` columns changed - `watched-changed` - means that selected `Watched_ValueN` columns changed
- `watched-not-changed` - reports even on events where selected `Watched_ValueN` did not change - `watched-not-changed` - reports even on events where selected `Watched_ValueN` did not change
Example: Example: