Plugins 0.2 - Show objects in UI

This commit is contained in:
Jokob-sk
2023-02-14 22:24:12 +11:00
parent 541c16aea6
commit b0ce1b87a9
5 changed files with 232 additions and 30 deletions

View File

@@ -476,7 +476,8 @@ $lang['en_us'] = array(
// Plugins
//////////////////////////////////////////////////////////////////
'Plugins_Unprocessed_Events' => 'Unprocessed events',
'Plugins_Unprocessed_Events' => 'Unprocessed Events',
'Plugins_Objects' => 'Plugin Objects',
//////////////////////////////////////////////////////////////////
// Settings

View File

@@ -74,6 +74,7 @@ function localize (obj, key) {
// -----------------------------------------------------------------------------
pluginDefinitions = []
pluginUnprocessedEvents = []
pluginObjects = []
function getData(){
@@ -81,11 +82,17 @@ function getData(){
pluginDefinitions = res["data"];
$.get('api/table_plugins_unprocessed_entries.json', function(res) {
$.get('api/table_plugins_events.json', function(res) {
pluginUnprocessedEvents = res["data"];
generateTabs()
$.get('api/table_plugins_objects.json', function(res) {
pluginObjects = res["data"];
generateTabs()
});
});
});
@@ -113,7 +120,8 @@ function generateTabs()
headersHtml = ""
headers = []
rows = ""
evRows = ""
obRows = ""
// Generate the header
$.each(obj["database_column_aliases"]["localized"], function(index, locItem){
@@ -122,7 +130,7 @@ function generateTabs()
});
// Generate the entry rows
// Generate the event rows
for(i=0;i<pluginUnprocessedEvents.length;i++)
{
if(pluginUnprocessedEvents[i].Plugin == obj.unique_prefix)
@@ -133,7 +141,22 @@ function generateTabs()
{
clm += '<td>'+ pluginUnprocessedEvents[i][headers[j]] +'</td>'
}
rows += '<tr>' + clm + '</tr>'
evRows += '<tr>' + clm + '</tr>'
}
}
// Generate the object rows
for(i=0;i<pluginObjects.length;i++)
{
if(pluginObjects[i].Plugin == obj.unique_prefix)
{
clm = ""
for(j=0;j<headers.length;j++)
{
clm += '<td>'+ pluginObjects[i][headers[j]] +'</td>'
}
obRows += '<tr>' + clm + '</tr>'
}
}
@@ -156,9 +179,24 @@ function generateTabs()
<tr>
${headersHtml}
</tr>
${rows}
${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>
`);