From 601d772a5fc01c00608d168650df6136558aa543 Mon Sep 17 00:00:00 2001 From: Jeremiah Moran Date: Tue, 30 Apr 2024 15:15:13 -0700 Subject: [PATCH] Remove -export from report name, add export date to subheader, add "show all" to software table --- ...ice Inventory Report - Advanced DataTables.json | 14 ++++++++++++++ ...entory Report - Advanced dataTables-export.json | 14 -------------- .../Software Report - Advanced DataTables.json | 14 ++++++++++++++ ...ftware Report - Advanced dataTables-export.json | 14 -------------- 4 files changed, 28 insertions(+), 28 deletions(-) create mode 100644 templates/Device Inventory Report - Advanced DataTables.json delete mode 100644 templates/Device Inventory Report - Advanced dataTables-export.json create mode 100644 templates/Software Report - Advanced DataTables.json delete mode 100644 templates/Software Report - Advanced dataTables-export.json diff --git a/templates/Device Inventory Report - Advanced DataTables.json b/templates/Device Inventory Report - Advanced DataTables.json new file mode 100644 index 0000000..f6f058c --- /dev/null +++ b/templates/Device Inventory Report - Advanced DataTables.json @@ -0,0 +1,14 @@ +{ + "base_template": null, + "template": { + "name": "Device Inventory Report - Advanced DataTables", + "template_css": ".content-wrapper {\r\n margin-left: 20px; /* Adjust the margin as needed */\r\n margin-right: 20px; /* Adjust the margin as needed */\r\n }\r\ntable {\r\n width: 100%;\r\n border-collapse: collapse;\r\n}\r\nth, td {\r\n border: 1px solid #ddd;\r\n padding: 8px;\r\n}\r\nth {\r\n background-color: #f2f2f2;\r\n text-align: left;\r\n}\r\ntr:nth-child(even){background-color: #f2f2f2}\r\n/* This is the default state where full headers are visible */\r\n.full-header .short-header {\r\n display: none;\r\n}\r\n\r\n/* Media query for mobile screens */\r\n@media screen and (max-width: 768px) {\r\n .full-header .short-header {\r\n display: inline-block; /* Show abbreviated headers */\r\n }\r\n .full-header {\r\n display: none; /* Hide full headers */\r\n }\r\n}", + "template_md": "\r\n\r\n\r\n \r\n \r\n {{ client.name }} | Computer Inventory Report\r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n
\r\n
\r\n
\r\n

{{ client.name }}'s Computer Inventory Report

\r\n

Below is a list of all computers in your organization. This data was exported on {{datetime.date.today()}} and may not reflect the current status.

\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
Loading...
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {% for item in data_sources.agentsList %}\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {% endfor %}\r\n \r\n
Site NameDevice NameLast UserOperating SystemManufacturerModelSerial #Battery HealthWarranty Expiration
\r\n {% set site = item.site__name if item.site__name else 'N/A' %}\r\n {% set site_parts = site.split(' - ') %}\r\n {% set site_filtered = site_parts[1:] | join(' ') %}\r\n {{ site_filtered }}\r\n {{ item.hostname if item.hostname else 'N/A' }}{{ item.last_logged_in_user if item.last_logged_in_user else 'N/A' }}\r\n {% set os = (item.operating_system|replace(\",\", \"\")) if item.operating_system else 'N/A' %}\r\n {% if 'Windows 10' in os or 'Windows 11' in os %}\r\n {% set os_parts = os.split(' ') %}\r\n {% set os_filtered = os_parts[:3] | join(' ') %}\r\n {{ os_filtered }}\r\n {% elif 'Windows Server' in os %}\r\n {% set os_parts = os.split(' ') %}\r\n {% set os_filtered = os_parts[:4] | join(' ') %}\r\n {{ os_filtered }}\r\n {% else %}\r\n {{ os }}\r\n {% endif %}\r\n {{ item.wmi_detail.comp_sys[0][0].Manufacturer if item.wmi_detail and item.wmi_detail.comp_sys and item.wmi_detail.comp_sys[0] and item.wmi_detail.comp_sys[0][0] and item.wmi_detail.comp_sys[0][0].Manufacturer else 'N/A' }}\r\n {% if item.wmi_detail and item.wmi_detail.comp_sys and item.wmi_detail.comp_sys[0] and item.wmi_detail.comp_sys[0][0] and item.wmi_detail.comp_sys[0][0].Manufacturer == 'LENOVO' and item.wmi_detail.comp_sys_prod and item.wmi_detail.comp_sys_prod[0] and item.wmi_detail.comp_sys_prod[0][0] %}\r\n {{ item.wmi_detail.comp_sys_prod[0][0].Version if item.wmi_detail.comp_sys_prod[0][0].Version else 'N/A' }}\r\n {% elif item.wmi_detail and item.wmi_detail.comp_sys and item.wmi_detail.comp_sys[0] and item.wmi_detail.comp_sys[0][0] %}\r\n {{ item.wmi_detail.comp_sys[0][0].Model if item.wmi_detail.comp_sys[0][0].Model else 'N/A' }}\r\n {% else %}\r\n N/A\r\n {% endif %}\r\n {{ item.wmi_detail.bios[0][0].SerialNumber if item.wmi_detail and item.wmi_detail.bios and item.wmi_detail.bios[0] and item.wmi_detail.bios[0][0] and item.wmi_detail.bios[0][0].SerialNumber else 'N/A' }}\r\n {% set battery = item.custom_fields.get('BatteryHealthPercentage', 'N/A') %}\r\n {% if battery is not none and battery != '' %}\r\n {% if 'No battery present on this system.' in battery or 'N/A' in battery %}\r\n N/A\r\n {% else %}\r\n {% set battery_percentage = battery|int %}\r\n {% if battery_percentage < 60 %}\r\n {{ battery }}%\r\n {% elif battery_percentage < 80 %}\r\n {{ battery }}%\r\n {% else %}\r\n {{ battery }}%\r\n {% endif %}\r\n {% endif %}\r\n {% else %}\r\n N/A\r\n {% endif %}\r\n \r\n {% set warranty = item.custom_fields.get('WarrantyExpiration', 'N/A') %}\r\n {% if warranty != 'N/A' and warranty != '' and warrant is not none %}\r\n {% set warranty_date = datetime.datetime.strptime(warranty, '%Y-%m-%dT%H:%M:%S') %}\r\n {% set pst_zone = ZoneInfo('America/Los_Angeles') %}\r\n {% set warranty_date_pst = warranty_date.astimezone(pst_zone) %}\r\n {% set warranty_formatted = warranty_date_pst.strftime('%Y-%m-%d') %}\r\n {% set current_date = datetime.datetime.now(pst_zone) %}\r\n {% set remaining_days = (warranty_date_pst.date() - current_date.date()).days %}\r\n {% if remaining_days > 90 %}\r\n {{ warranty_formatted }}\r\n {% elif remaining_days > 0 %}\r\n {{ warranty_formatted }}\r\n {% else %}\r\n {{ warranty_formatted }}\r\n {% endif %}\r\n {% else %}\r\n N/A\r\n {% endif %}\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n\r\n", + "type": "html", + "depends_on": [ + "client" + ], + "template_variables": "data_sources:\r\n agentsList:\r\n filter:\r\n site__client_id: '{{client.id}}'\r\n model: agent\r\n custom_fields:\r\n - WarrantyExpiration\r\n - BatteryHealthPercentage\r\n only:\r\n - hostname\r\n - operating_system\r\n - site__name\r\n - site__client__name\r\n - last_logged_in_user\r\n - wmi_detail" + }, + "assets": [] +} \ No newline at end of file diff --git a/templates/Device Inventory Report - Advanced dataTables-export.json b/templates/Device Inventory Report - Advanced dataTables-export.json deleted file mode 100644 index 9d51fef..0000000 --- a/templates/Device Inventory Report - Advanced dataTables-export.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "base_template": null, - "template": { - "name": "Device Inventory Report - Advanced dataTables", - "template_css": ".content-wrapper {\r\n margin-left: 20px; /* Adjust the margin as needed */\r\n margin-right: 20px; /* Adjust the margin as needed */\r\n }\r\ntable {\r\n width: 100%;\r\n border-collapse: collapse;\r\n}\r\nth, td {\r\n border: 1px solid #ddd;\r\n padding: 8px;\r\n}\r\nth {\r\n background-color: #f2f2f2;\r\n text-align: left;\r\n}\r\ntr:nth-child(even){background-color: #f2f2f2}\r\n/* This is the default state where full headers are visible */\r\n.full-header .short-header {\r\n display: none;\r\n}\r\n\r\n/* Media query for mobile screens */\r\n@media screen and (max-width: 768px) {\r\n .full-header .short-header {\r\n display: inline-block; /* Show abbreviated headers */\r\n }\r\n .full-header {\r\n display: none; /* Hide full headers */\r\n }\r\n}", - "template_md": "\r\n\r\n\r\n \r\n \r\n MyCompany - {{ client.name }} | Computer Inventory Report\r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n
\r\n
\r\n
\r\n

{{ client.name }}'s Computer Inventory Report

\r\n

Below is a list of all computers in your organization.

\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
Loading...
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {% for item in data_sources.agentsList %}\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {% endfor %}\r\n \r\n
Site NameDevice NameLast UserOperating SystemManufacturerModelSerial #Battery HealthWarranty Expiration
\r\n {% set site = item.site__name if item.site__name else 'N/A' %}\r\n {% set site_parts = site.split(' - ') %}\r\n {% set site_filtered = site_parts[1:] | join(' ') %}\r\n {{ site_filtered }}\r\n {{ item.hostname if item.hostname else 'N/A' }}{{ item.last_logged_in_user if item.last_logged_in_user else 'N/A' }}\r\n {% set os = (item.operating_system|replace(\",\", \"\")) if item.operating_system else 'N/A' %}\r\n {% if 'Windows 10' in os or 'Windows 11' in os %}\r\n {% set os_parts = os.split(' ') %}\r\n {% set os_filtered = os_parts[:3] | join(' ') %}\r\n {{ os_filtered }}\r\n {% elif 'Windows Server' in os %}\r\n {% set os_parts = os.split(' ') %}\r\n {% set os_filtered = os_parts[:4] | join(' ') %}\r\n {{ os_filtered }}\r\n {% else %}\r\n {{ os }}\r\n {% endif %}\r\n {{ item.wmi_detail.comp_sys[0][0].Manufacturer if item.wmi_detail and item.wmi_detail.comp_sys and item.wmi_detail.comp_sys[0] and item.wmi_detail.comp_sys[0][0] and item.wmi_detail.comp_sys[0][0].Manufacturer else 'N/A' }}\r\n {% if item.wmi_detail and item.wmi_detail.comp_sys and item.wmi_detail.comp_sys[0] and item.wmi_detail.comp_sys[0][0] and item.wmi_detail.comp_sys[0][0].Manufacturer == 'LENOVO' and item.wmi_detail.comp_sys_prod and item.wmi_detail.comp_sys_prod[0] and item.wmi_detail.comp_sys_prod[0][0] %}\r\n {{ item.wmi_detail.comp_sys_prod[0][0].Version if item.wmi_detail.comp_sys_prod[0][0].Version else 'N/A' }}\r\n {% elif item.wmi_detail and item.wmi_detail.comp_sys and item.wmi_detail.comp_sys[0] and item.wmi_detail.comp_sys[0][0] %}\r\n {{ item.wmi_detail.comp_sys[0][0].Model if item.wmi_detail.comp_sys[0][0].Model else 'N/A' }}\r\n {% else %}\r\n N/A\r\n {% endif %}\r\n {{ item.wmi_detail.bios[0][0].SerialNumber if item.wmi_detail and item.wmi_detail.bios and item.wmi_detail.bios[0] and item.wmi_detail.bios[0][0] and item.wmi_detail.bios[0][0].SerialNumber else 'N/A' }}\r\n {% set battery = item.custom_fields.get('BatteryHealthPercentage', 'N/A') %}\r\n {% if battery is not none and battery != '' %}\r\n {% if 'No battery present on this system.' in battery or 'N/A' in battery %}\r\n N/A\r\n {% else %}\r\n {% set battery_percentage = battery|int %}\r\n {% if battery_percentage < 60 %}\r\n {{ battery }}%\r\n {% elif battery_percentage < 80 %}\r\n {{ battery }}%\r\n {% else %}\r\n {{ battery }}%\r\n {% endif %}\r\n {% endif %}\r\n {% else %}\r\n N/A\r\n {% endif %}\r\n \r\n {% set warranty = item.custom_fields.get('WarrantyExpiration', 'N/A') %}\r\n {% if warranty != 'N/A' and warranty != '' and warrant is not none %}\r\n {% set warranty_date = datetime.datetime.strptime(warranty, '%Y-%m-%dT%H:%M:%S') %}\r\n {% set pst_zone = ZoneInfo('America/Los_Angeles') %}\r\n {% set warranty_date_pst = warranty_date.astimezone(pst_zone) %}\r\n {% set warranty_formatted = warranty_date_pst.strftime('%Y-%m-%d') %}\r\n {% set current_date = datetime.datetime.now(pst_zone) %}\r\n {% set remaining_days = (warranty_date_pst.date() - current_date.date()).days %}\r\n {% if remaining_days > 90 %}\r\n {{ warranty_formatted }}\r\n {% elif remaining_days > 0 %}\r\n {{ warranty_formatted }}\r\n {% else %}\r\n {{ warranty_formatted }}\r\n {% endif %}\r\n {% else %}\r\n N/A\r\n {% endif %}\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n\r\n", - "type": "html", - "depends_on": [ - "client" - ], - "template_variables": "data_sources:\r\n agentsList:\r\n filter:\r\n site__client_id: '{{client.id}}'\r\n model: agent\r\n custom_fields:\r\n - WarrantyExpiration\r\n - BatteryHealthPercentage\r\n only:\r\n - hostname\r\n - operating_system\r\n - site__name\r\n - site__client__name\r\n - last_logged_in_user\r\n - wmi_detail" - }, - "assets": [] -} \ No newline at end of file diff --git a/templates/Software Report - Advanced DataTables.json b/templates/Software Report - Advanced DataTables.json new file mode 100644 index 0000000..a38d606 --- /dev/null +++ b/templates/Software Report - Advanced DataTables.json @@ -0,0 +1,14 @@ +{ + "base_template": null, + "template": { + "name": "Software Report - Advanced DataTables", + "template_css": "", + "template_md": "\r\n\r\n\r\n \r\n \r\n {{ client.name }} | Software Inventory Report\r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n
\r\n
\r\n
\r\n

{{ client.name }}'s Software Inventory Report

\r\n

Below is a list of all software currently installed on computers in your organization. This data was exported on {{datetime.date.today()}} and may not reflect the current status.

\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
Loading...
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {% for data in data_sources.agentSoftware %}\r\n {% for software in data.software %}\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {% endfor %}\r\n {% else %}\r\n \r\n \r\n \r\n {% endfor %}\r\n \r\n
HostnameLast UserSite NameSoftware NamePublisherInstall Date
{{ data.agent__hostname }}{{ data.agent__last_logged_in_user }}{{ data.agent__site__name }}{{ software.name }}{{ software.publisher }}{{ software.install_date }}
No software found.
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n\r\n", + "type": "html", + "depends_on": [ + "client" + ], + "template_variables": "data_sources:\r\n agentSoftware:\r\n model: installedsoftware\r\n filter:\r\n agent__site__client__id: \"{{client.id}}\"\r\n only:\r\n - software\r\n - agent__hostname\r\n - agent__site__name\r\n - agent__site__client\r\n - agent__last_logged_in_user" + }, + "assets": [] +} \ No newline at end of file diff --git a/templates/Software Report - Advanced dataTables-export.json b/templates/Software Report - Advanced dataTables-export.json deleted file mode 100644 index 4963934..0000000 --- a/templates/Software Report - Advanced dataTables-export.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "base_template": null, - "template": { - "name": "Software Report - Advanced dataTables", - "template_css": "", - "template_md": "\r\n\r\n\r\n \r\n \r\n MyCompany - {{ client.name }} | Software Inventory Report\r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n
\r\n
\r\n
\r\n

{{ client.name }}'s Software Inventory Report

\r\n

Below is a list of all software currently installed on computers in your organization.

\r\n
\r\n
\r\n
\r\n
\r\n
\r\n
Loading...
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {% for data in data_sources.agentSoftware %}\r\n {% for software in data.software %}\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n {% endfor %}\r\n {% else %}\r\n \r\n \r\n \r\n {% endfor %}\r\n \r\n
HostnameLast UserSite NameSoftware NamePublisherInstall Date
{{ data.agent__hostname }}{{ data.agent__last_logged_in_user }}{{ data.agent__site__name }}{{ software.name }}{{ software.publisher }}{{ software.install_date }}
No software found.
\r\n
\r\n
\r\n
\r\n
\r\n
\r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n\r\n", - "type": "html", - "depends_on": [ - "client" - ], - "template_variables": "data_sources:\r\n agentSoftware:\r\n model: installedsoftware\r\n filter:\r\n agent__site__client__id: \"{{client.id}}\"\r\n only:\r\n - software\r\n - agent__hostname\r\n - agent__site__name\r\n - agent__site__client\r\n - agent__last_logged_in_user" - }, - "assets": [] -} \ No newline at end of file