From 82d81aafb0d6bbb3c4f5c8504216dc97f8e40732 Mon Sep 17 00:00:00 2001 From: Arjen van Bochoven Date: Wed, 3 Jul 2019 18:33:30 +0200 Subject: [PATCH] Convert listing to new format --- js/format_appusage.js | 14 ++++ views/appusage_listing.php | 164 +++++++++++-------------------------- 2 files changed, 64 insertions(+), 114 deletions(-) create mode 100644 js/format_appusage.js diff --git a/js/format_appusage.js b/js/format_appusage.js new file mode 100644 index 0000000..dc5bb6e --- /dev/null +++ b/js/format_appusage.js @@ -0,0 +1,14 @@ +var appNameToLink = function(colNumber, row){ + var col = $('td:eq('+colNumber+')', row), + appName = col.text(); + col.html($('').attr('href', appUrl+'/module/inventory/items/'+appName).text(appName)) +} + +var localizeEvent = function(colNumber, row){ + var col = $('td:eq('+colNumber+')', row), + event = col.text(); + event = event == 'launch' ? i18n.t('appusage.launch') : + event = event == 'activate' ? i18n.t('appusage.activation') : + (event === 'quit' ? i18n.t('appusage.quit') : '') + col.text(event) +} diff --git a/views/appusage_listing.php b/views/appusage_listing.php index ff11c51..1560064 100644 --- a/views/appusage_listing.php +++ b/views/appusage_listing.php @@ -1,114 +1,50 @@ -view('partials/head'); ?> - - - -
-
-
-

- - - - - - - - - - - - - - - - - - - - -
-
-
-
- - - -view('partials/foot'); ?> +view('listings/default', +[ + "i18n_title" => 'appusage.appusagereport', + "not_null_column" => "app_name", + "js_link" => "module/appusage/js/format_appusage", + "table" => [ + [ + "column" => "machine.computer_name", + "i18n_header" => "listing.computername", + "formatter" => "clientDetail", + ], + [ + "column" => "reportdata.serial_number", + "i18n_header" => "serial", + ], + [ + "column" => "appusage.event", + "i18n_header" => "appusage.event", + "formatter" => "appNlocalizeEventameToLink", + ], + [ + "column" => "appusage.app_name", + "i18n_header" => "appusage.appname", + "formatter" => "appNameToLink", + ], + [ + "column" => "appusage.last_time_epoch", + "i18n_header" => "appusage.lastevent", + "formatter" => "timestampToMoment", + ], + [ + "column" => "appusage.number_times", + "i18n_header" => "appusage.count", + ], + [ + "column" => "appusage.app_version", + "i18n_header" => "version", + ], + [ + "column" => "appusage.app_path", + "i18n_header" => "path", + ], + [ + "column" => "appusage.bundle_id", + "i18n_header" => "bundle_id", + ], + ] +]);