icons.adoc 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. [#entity-icons]
  2. = Entity icons
  3. The `icon` field is configured on each entity definition in `config.yaml`. It sets an icon for the entity *type* (for example, all `server` instances share the same icon).
  4. Entity icons use the same icon system as actions. See xref:action_customization/icons.adoc[Icons] for the full range of supported formats — Unicode aliases, HTML entities, Iconify, image paths, and custom-webui assets.
  5. == Configuration
  6. Add `icon` under an entity definition alongside `file`, `name`, and `properties`:
  7. [source,yaml]
  8. ----
  9. entities:
  10. - file: /etc/OliveTin/servers.yaml
  11. name: server
  12. icon: ssh
  13. properties:
  14. - name: hostname
  15. title: Hostname
  16. - file: /etc/OliveTin/containers.json
  17. name: container
  18. icon: <iconify-icon icon="logos:docker-icon"></iconify-icon>
  19. ----
  20. If `icon` is omitted or empty, no icon is shown for that entity type. Unlike actions, entity types do not get a default icon.
  21. === Short-name aliases
  22. OliveTin resolves a few common short names to Unicode HTML entities at config load time. These are convenient for entity types that match common action categories:
  23. [cols="1,1", options="header"]
  24. |===
  25. | Alias | Typical use
  26. | `ssh`
  27. | Servers accessed over SSH
  28. | `ping`
  29. | Network hosts
  30. | `box`
  31. | Containers or packages
  32. | `backup`
  33. | Backup targets
  34. | `restart` / `reboot`
  35. | Systems or services
  36. | `light`
  37. | Lights or switches
  38. | `robot`
  39. | Automation targets
  40. |===
  41. The full alias list is in the xref:action_customization/icons.adoc#icons[Icons] documentation and in the source file `service/internal/config/emoji.go`.
  42. === Custom-webui image paths
  43. A path containing `/` (that does not start with `<`) is expanded to an `<img>` tag pointing at `/custom-webui/`. For example, `icons/server.png` becomes an image served from `<config-dir>/custom-webui/icons/server.png`.
  44. == Where icons appear
  45. Entity icons are shown in the web UI next to the entity type name, not next to individual instances.
  46. === Entities page
  47. On the Entities page, each entity type section heading shows the configured icon beside the type name (for example, `Entity: server`).
  48. === Entity details page
  49. When viewing a single entity instance, the icon appears in the page title beside the instance name. The icon comes from the entity type definition, not from fields in the entity data file.
  50. === API
  51. The `icon` field is included on:
  52. * `EntityDefinition` — returned by `GetEntities` for each entity type
  53. * `Entity` — returned by `GetEntity` for a single instance (same type-level icon)
  54. == What entity icons do not affect
  55. * **Individual instances** — icons are per entity type in `config.yaml`, not per row in the entity data file. You cannot give `server1` a different icon from `server2` through entity configuration alone.
  56. * **Dashboards** — entity fieldsets and directories use their own `icon` fields on dashboard components. See xref:dashboards/intro.adoc[Dashboards].
  57. * **Action buttons** — actions have their own `icon` field. An entity-bound action does not inherit the entity type icon automatically.
  58. == Example
  59. [source,yaml]
  60. ----
  61. entities:
  62. - file: entities/servers.yaml
  63. name: server
  64. icon: ssh
  65. properties:
  66. - name: hostname
  67. title: Hostname
  68. - name: ip
  69. title: IP
  70. - file: entities/containers.json
  71. name: container
  72. icon: box
  73. ----
  74. With this configuration, the Entities page shows a key icon beside the `server` section and a box icon beside the `container` section. Opening any server instance shows the same key icon in the details page title.
  75. == What's next?
  76. * xref:action_customization/icons.adoc[Icons] — full icon format reference (Iconify, Unicode, images, and offline hosting)
  77. * xref:entities/intro.adoc[Entities] — overview of entities in OliveTin
  78. * xref:entities/properties.adoc[Entity properties] — configure which fields appear in the entity list