Device Icons
So you have added a new device type to attributes, but no icon is appearing.
To add an icon, take the name you have applied for the new device type in attributes, lower case it, replace spaces with underscores and you have the filename.
Take your icon in SVG format (preferably scaled to 50 x 50 pixels) and store it at:
Linux: /usr/local/open-audit/www/open-audit/device_images/
Windows: c:\xampp\htdocs\open-audit\device_images\
If you're on Linux, ensure the correct owner and permissions are set.
So if your new device type (added to attributes) is "Something IOT", your new filename would be something_iot.svg And if you're on Linux, it's permissions would be as below.
rw-rr- 1 root www-data 12K Sep 11 14:02 something_iot.svg
You should now see your shiny new icon, next time it's required.
In OA7, the icon location on Linux is
/usr/local/open-audit/public/device_images/To match the linux permissions:
sudo chown www-data:www-data /usr/local/open-audit/public/device_images/medicaldevice.svg sudo chmod 644 /usr/local/open-audit/public/device_images/medicaldevice.svgSample python to resize the SVG file if required.
Backup the file and look at the root tag
cd /usr/local/open-audit/public/device_images cp medicaldevicee.svg /root/medicaldevicee.svg.orig grep -o '<svg[^>]*>' medicaldevicee.svgset it to 50x50
python3 - medicaldevicee.svg <<'EOF' import re, sys p = sys.argv[1] s = open(p, encoding="utf-8").read() m = re.search(r'<svg\b[^>]*>', s) tag = m.group(0) num = lambda a: (re.search(rf'\b{a}="([\d.]+)', tag) or [None, None])[1] if 'viewBox' not in tag: w, h = num('width'), num('height') if not (w and h): sys.exit("No viewBox and no numeric width/height - stopping, file unchanged") tag = tag.replace('<svg', f'<svg viewBox="0 0 {w} {h}"', 1) tag = re.sub(r'\s(width|height)="[^"]*"', '', tag) tag = tag.replace('<svg', '<svg width="50" height="50"', 1) open(p, "w", encoding="utf-8").write(s.replace(m.group(0), tag, 1)) print(tag) EOFcheck the result
grep -o '<svg[^>]*>' medicaldevicee.svg ls -l medicaldevicee.svg grep -c 'width="50"' ~/medicaldevice.svg1means it’s the scaled file.0means the Python step ran on a different copy