Plugins 0.4 - Further UI work

This commit is contained in:
Jokob-sk
2023-03-04 20:41:48 +11:00
parent 49ce3edbdb
commit 1a05435691
7 changed files with 58 additions and 18 deletions

View File

@@ -105,6 +105,16 @@ Instructions for [pucherot's original code can be found here](https://github.com
- [jokob-sk](https://github.com/jokob-sk/Pi.Alert): DB Maintenance tools
- Please see the [Git commit history](https://github.com/jokob-sk/Pi.Alert/commits/main) for a full list of people and their contributions to the project
## ☕ Support me
Disclaimer: Please only donate if you don't have any debt yourself. Support yourself first, then others.
<a href="https://github.com/sponsors/jokob-sk" target="_blank"><img src="https://i.imgur.com/X6p5ACK.png" alt="Sponsor Me on GitHub" style="height: 30px !important;width: 117px !important;" width="150px" ></a>
<a href="https://www.buymeacoffee.com/jokobsk" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 30px !important;width: 117px !important;" width="117px" height="30px" ></a>
<a href="https://www.patreon.com/user?u=84385063" target="_blank"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/82/Patreon_logo_with_wordmark.svg/512px-Patreon_logo_with_wordmark.svg.png" alt="Support me on patreon" style="height: 30px !important;width: 117px !important;" width="117px" ></a>
BTC: 1N8tupjeCK12qRVU2XrV17WvKK7LCawyZM
<!--- --------------------------------------------------------------------- --->
[main]: ./docs/img/devices_split.png "Main screen"
[screen1]: ./docs/img/device_details.png "Screen 1"

View File

@@ -3760,6 +3760,8 @@ def execute_plugin(plugin):
else:
set_RUN_TIMEOUT = set["value"]
mylog('debug', [' [Plugins] Timeout: ', set_RUN_TIMEOUT])
# Prepare custom params
params = []

View File

@@ -20,7 +20,7 @@ services:
- ${DEV_LOCATION}/pholus:/home/pi/pialert/pholus
- ${DEV_LOCATION}/dockerfiles:/home/pi/pialert/dockerfiles
- ${APP_DATA_LOCATION}/pialert/php.ini:/etc/php/7.4/fpm/php.ini
- ${DEV_LOCATION}/front/api:/home/pi/pialert/front/api
# - ${DEV_LOCATION}/front/api:/home/pi/pialert/front/api
- ${DEV_LOCATION}/front/css:/home/pi/pialert/front/css
- ${DEV_LOCATION}/front/lib/AdminLTE:/home/pi/pialert/front/lib/AdminLTE
- ${DEV_LOCATION}/front/js:/home/pi/pialert/front/js

View File

@@ -193,3 +193,5 @@ Disclaimer: Please only donate if you don't have any debt yourself. Support your
<a href="https://github.com/sponsors/jokob-sk" target="_blank"><img src="https://i.imgur.com/X6p5ACK.png" alt="Sponsor Me on GitHub" style="height: 30px !important;width: 117px !important;" width="150px" ></a>
<a href="https://www.buymeacoffee.com/jokobsk" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 30px !important;width: 117px !important;" width="117px" height="30px" ></a>
<a href="https://www.patreon.com/user?u=84385063" target="_blank"><img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/82/Patreon_logo_with_wordmark.svg/512px-Patreon_logo_with_wordmark.svg.png" alt="Support me on patreon" style="height: 30px !important;width: 117px !important;" width="117px" ></a>
BTC: 1N8tupjeCK12qRVU2XrV17WvKK7LCawyZM

View File

@@ -244,7 +244,7 @@ if (isset($_POST['submit']) && submit && isset($_POST['skinselector_set'])) {
<option value="16"><?= lang('Device_TableHead_Location');?></option>
<option value="17"><?= lang('Device_TableHead_Vendor');?></option>
</select>
<span class="input-group-addon"><i title="<?= lang('DevDetail_GoToNetworkNode');?>" class="fa fa-save pointer" onclick="saveSelectedColumns();"></i></span>
<span class="input-group-addon"><i title="<?= lang('Gen_Save');?>" class="fa fa-save pointer" onclick="saveSelectedColumns();"></i></span>
</div>
</div>

View File

@@ -23,7 +23,7 @@
<ul id="tabs-location" class="nav nav-tabs">
<!-- PLACEHOLDER -->
</ul>
<div id="tabs-content-location" class="nav nav-tabs">
<div id="tabs-content-location" class="tab-content">
<!-- PLACEHOLDER -->
</div>
@@ -49,6 +49,8 @@ function getFormControl(dbColumnDef, value, index) {
break;
case 'textboxsave':
console.log(value)
value = value == 'null' ? '' : value; // hide 'null' values
id = `${dbColumnDef.column}_${index}`
@@ -99,6 +101,16 @@ function saveData (id) {
// var result = JSON.parse(data);
console.log(data)
if(sanitize(data) == 'OK')
{
showMessage("Saved")
// Remove navigation prompt "Are you sure you want to leave..."
window.onbeforeunload = null;
} else
{
showMessage("ERROR")
}
// if (result) {
// period = result;
// $('#period').val(period);
@@ -162,6 +174,8 @@ function getData(){
pluginObjects = res["data"];
console.log(pluginObjects)
$.get('api/table_plugins_history.json', function(res) {
pluginHistory = res["data"];
@@ -212,6 +226,7 @@ function generateTabs()
});
// Generate the event rows
var eveCount = 0;
for(i=0;i<pluginUnprocessedEvents.length;i++)
{
if(pluginUnprocessedEvents[i].Plugin == obj.unique_prefix)
@@ -223,10 +238,12 @@ function generateTabs()
clm += '<td>'+ pluginUnprocessedEvents[i][colDefinitions[j].column] +'</td>'
}
evRows += '<tr>' + clm + '</tr>'
eveCount++;
}
}
// Generate the history rows
var histCount = 0
for(i=0;i<pluginHistory.length;i++)
{
if(pluginHistory[i].Plugin == obj.unique_prefix)
@@ -238,12 +255,14 @@ function generateTabs()
clm += '<td>'+ pluginHistory[i][colDefinitions[j].column] +'</td>'
}
hiRows += '<tr>' + clm + '</tr>'
histCount++;
}
}
console.log(pluginObjects)
// Generate the object rows
var obCount = 0;
for(var i=0;i<pluginObjects.length;i++)
{
if(pluginObjects[i].Plugin == obj.unique_prefix)
@@ -252,9 +271,16 @@ function generateTabs()
for(var j=0;j<colDefinitions.length;j++)
{
if(colDefinitions[j].column == 'UserData' )
{
console.log(colDefinitions[j].column)
console.log(pluginObjects[i][colDefinitions[j].column])
console.log(pluginObjects[i])
}
clm += '<td>'+ getFormControl(colDefinitions[j], pluginObjects[i][colDefinitions[j].column], pluginObjects[i]["Index"]) +'</td>'
}
obRows += '<tr>' + clm + '</tr>'
obCount++;
}
}
@@ -265,25 +291,25 @@ function generateTabs()
<div class="nav-tabs-custom" style="margin-bottom: 0px">
<ul class="nav nav-tabs">
<li class="active">
<a href="#objectsTarget" data-toggle="tab" >
<a href="#objectsTarget_${obj.unique_prefix}" data-toggle="tab" >
<i class="fa fa-cube"></i> <?= lang('Plugins_Objects');?> (${pluginObjects.length})
<i class="fa fa-cube"></i> <?= lang('Plugins_Objects');?> (${obCount})
</a>
</li>
<li>
<a href="#eventsTarget" data-toggle="tab" >
<a href="#eventsTarget_${obj.unique_prefix}" data-toggle="tab" >
<i class="fa fa-bolt"></i> <?= lang('Plugins_Unprocessed_Events');?> (${pluginUnprocessedEvents.length})
<i class="fa fa-bolt"></i> <?= lang('Plugins_Unprocessed_Events');?> (${eveCount})
</a>
</li>
<li>
<a href="#historyTarget" data-toggle="tab" >
<a href="#historyTarget_${obj.unique_prefix}" data-toggle="tab" >
<i class="fa fa-clock"></i> <?= lang('Plugins_History');?> (${pluginHistory.length})
<i class="fa fa-clock"></i> <?= lang('Plugins_History');?> (${histCount})
</a>
</li>
@@ -294,7 +320,7 @@ function generateTabs()
<div class="tab-content">
<div id="objectsTarget" class="tab-pane active">
<div id="objectsTarget_${obj.unique_prefix}" class="tab-pane ${activetab}">
<table class="table table-striped">
<tbody>
<tr>
@@ -304,7 +330,7 @@ function generateTabs()
</tbody>
</table>
</div>
<div id="eventsTarget" class="tab-pane">
<div id="eventsTarget_${obj.unique_prefix}" class="tab-pane">
<table class="table table-striped">
<tbody>
@@ -315,7 +341,7 @@ function generateTabs()
</tbody>
</table>
</div>
<div id="historyTarget" class="tab-pane">
<div id="historyTarget_${obj.unique_prefix}" class="tab-pane">
<table class="table table-striped">
<tbody>

View File

@@ -9,7 +9,7 @@
}],
"icon":[{
"language_code":"en_us",
"string" : "<i class=\"fa-solid fa-search\"></i>"
"string" : "<i class=\"fa-solid fa-satellite-dish\"></i>"
}],
"description": [{
"language_code":"en_us",
@@ -45,7 +45,7 @@
{
"column": "Object_PrimaryID",
"show": true,
"type": "url",
"type": "label",
"default_value":"",
"options": [],
"localized": ["name"],
@@ -57,7 +57,7 @@
{
"column": "Object_SecondaryID",
"show": true,
"type": "label",
"type": "url",
"default_value":"",
"options": [],
"localized": ["name"],
@@ -194,7 +194,7 @@
{
"function": "CMD",
"type": "text",
"default_value":"SELECT dv.dev_Name as Object_PrimaryID, cast(dv.dev_LastIP as VARCHAR(100)) || ':' || cast( SUBSTR(ns.Port ,0, INSTR(ns.Port , '/')) as VARCHAR(100)) as Object_SecondaryID, datetime() as DateTime, ns.Service as Watched_Value1, ns.State as Watched_Value2, 'null' as Watched_Value3, 'null' as Watched_Value4, ns.Extra as Extra FROM (SELECT * FROM Nmap_Scan) ns LEFT JOIN (SELECT dev_Name, dev_MAC, dev_LastIP FROM Devices) dv ON ns.MAC = dv.dev_MAC",
"default_value":"SELECT dv.dev_Name as Object_PrimaryID, cast('http://' || dv.dev_LastIP as VARCHAR(100)) || ':' || cast( SUBSTR(ns.Port ,0, INSTR(ns.Port , '/')) as VARCHAR(100)) as Object_SecondaryID, datetime() as DateTime, ns.Service as Watched_Value1, ns.State as Watched_Value2, 'null' as Watched_Value3, 'null' as Watched_Value4, ns.Extra as Extra FROM (SELECT * FROM Nmap_Scan) ns LEFT JOIN (SELECT dev_Name, dev_MAC, dev_LastIP FROM Devices) dv ON ns.MAC = dv.dev_MAC",
"options": [],
"localized": ["name", "description"],
"name" : [{