diff --git a/defaults/main.yaml b/defaults/main.yaml index dc6689c..6d45f0f 100644 --- a/defaults/main.yaml +++ b/defaults/main.yaml @@ -51,9 +51,9 @@ sector_size: "512" sleep_time: "5" install_kiosk: false quick_refresh: false -service_only: false +service_only: true armcpu_check: false -service_mode: false +service_mode: true install_docker: true ... \ No newline at end of file diff --git a/files/dashboard/index.php b/files/dashboard/index.php index 874bda1..d3ed0bc 100644 --- a/files/dashboard/index.php +++ b/files/dashboard/index.php @@ -37,29 +37,26 @@ function fetchSSDData() { Search for disk:

'; - // Table header (optional but handy) echo ' - Disk ID - Model String - Serial Number - GB Written - Disk Capacity - Disk Flavor - SMART Result + Disk ID + Model String + Serial Number + GB Written + Disk Capacity + Disk Flavor + SMART Result '; - // Table body - one row per SSD echo ''; foreach ($ssdData as $ssd) { // Escape the values so the page stays safe $id = htmlspecialchars($ssd['id']); $model = htmlspecialchars($ssd['model']); $serial = htmlspecialchars($ssd['serial']); - $tbw = htmlspecialchars($ssd['gb_written']); + $gbw = htmlspecialchars($ssd['gb_written']); $cap = htmlspecialchars($ssd['capacity']); $flavor = htmlspecialchars($ssd['flavor']); $smart = htmlspecialchars($ssd['smart']); @@ -68,7 +65,7 @@ function fetchSSDData() { {$id} {$model} {$serial} - {$tbw} + {$gbw} {$cap} {$flavor} {$smart} @@ -112,4 +109,82 @@ document.addEventListener('DOMContentLoaded', () => { }); + + \ No newline at end of file diff --git a/files/dashboard/styles.css b/files/dashboard/styles.css index cb27f5f..01c12c6 100644 --- a/files/dashboard/styles.css +++ b/files/dashboard/styles.css @@ -129,3 +129,17 @@ li { background-color: #2c3e50; /* Dark background for meter */ } +/* Sort arrow */ +th.sortable::after { + content: ''; + float: right; + margin-left: 4px; + border: 4px solid transparent; +} +th.sortable.asc::after { + border-bottom-color: #333; /* ▲ */ +} +th.sortable.desc::after { + border-top-color: #333; /* ▼ */ +} + diff --git a/files/oop_code/SSDObject.py b/files/oop_code/SSDObject.py index 7a36b99..fa249d3 100644 --- a/files/oop_code/SSDObject.py +++ b/files/oop_code/SSDObject.py @@ -138,12 +138,22 @@ def return_sector_size(drive_id): sector_size_result = subprocess.run(sector_size_command, shell=True, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) return int(sector_size_result.stdout.decode("utf-8")) +# this had to be updated to allow for inconsistent SMART data def return_ls_written(data): - pages = data.get("ata_device_statistics", {}).get("pages", []) - for page in pages: - for entry in page.get("table", []): - if entry.get("name") == "Logical Sectors Written": - return entry.get("value") + if "ata_device_statistics" in data: + pages = data.get("ata_device_statistics", {}).get("pages", []) + for page in pages: + for entry in page.get("table", []): + if entry.get("name") == "Logical Sectors Written": + return entry.get("value") + + if "ata_smart_attributes" in data: + print("type two") + pages = data.get("ata_smart_attributes", []) + for entry in pages.get("table", []): + if entry.get("name") == "Total_LBAs_Written": + print(entry.get("value").get("raw", {})) + return entry.get("raw").get("value") # Function to return all drive records in database def get_all_drive_records(): diff --git a/files/oop_code/ssd_api.py b/files/oop_code/ssd_api.py index 4f6a0ad..bab582c 100644 --- a/files/oop_code/ssd_api.py +++ b/files/oop_code/ssd_api.py @@ -88,9 +88,9 @@ if __name__ == '__main__': scheduler.start() if secure_api: - app.run(debug=True, host='172.17.0.1', port=5000) + app.run(debug=False, host='172.17.0.1', port=5000) else: - app.run(debug=True, host='0.0.0.0', port=5000) + app.run(debug=False, host='0.0.0.0', port=5000) diff --git a/files/scripts/app.py b/files/scripts/app.py index a7fec7f..9d352d1 100644 --- a/files/scripts/app.py +++ b/files/scripts/app.py @@ -391,9 +391,9 @@ if __name__ == '__main__': print(result) if secure_api: - app.run(debug=True, host='172.17.0.1', port=5000) + app.run(debug=False, host='172.17.0.1', port=5000) else: - app.run(debug=True, host='0.0.0.0', port=5000) + app.run(debug=False, host='0.0.0.0', port=5000) diff --git a/tasks/main.yaml b/tasks/main.yaml index dbca91e..90ed083 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -17,10 +17,10 @@ when: not install_kiosk | bool and not service_only | bool and not armcpu_check | bool include_tasks: autologin.yaml -# disablep autologin +# disable autologin - name: Drive health - disable autologin when: install_kiosk | bool or service_only | bool - include_tasks: autologin.yaml + include_tasks: no_autologin.yaml # Install chrome kiosk - name: install chromium kiosk