Initial implementation of inventree

A small IT asset inventory system built around a nested folder tree,
matching the project brief: Go + html/template + Bootstrap 5 + vanilla JS,
SQLite storage (WAL, FKs, migrations), embedded templates/static assets,
single compiled binary.

- AJAX-driven inventory tree: lazy-loaded folder expansion with per-user
  persisted expand state, drag-and-drop move for folders/assets, safe
  delete-with-relocate-or-cascade confirmation, search with breadcrumbs.
- Assets: CRUD, duplicate, move, auto-generated IT-000001-style IDs,
  CSV import (with optional folder auto-create) and export.
- Admin-defined item types with custom fields (text/long_text/number/date/
  boolean/dropdown/url/ip_address).
- Configurable statuses, session-based auth (bcrypt, secure cookies),
  admin/user roles, user management.
- CLI: serve, version, database migrate, database backup; /healthz;
  graceful shutdown; Dockerfile/docker-compose/systemd unit; Go test suite.
This commit is contained in:
Owen
2026-08-17 13:34:40 -05:00
commit 218687a1ee
71 changed files with 8102 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
{{define "content"}}
<div class="inventory-shell d-flex">
<aside id="tree-pane" class="tree-pane border-end d-flex flex-column">
<div class="p-2 border-bottom">
<div class="input-group input-group-sm mb-2">
<span class="input-group-text"><i class="bi bi-search"></i></span>
<input type="search" id="tree-search" class="form-control" placeholder="Search inventory&hellip;">
</div>
<div class="d-flex gap-1 flex-wrap">
<button class="btn btn-sm btn-outline-secondary" id="btn-expand-all" title="Expand all folders"><i class="bi bi-arrows-expand"></i> Expand</button>
<button class="btn btn-sm btn-outline-secondary" id="btn-collapse-all" title="Collapse all folders"><i class="bi bi-arrows-collapse"></i> Collapse</button>
{{if .User.IsAdmin}}
<button class="btn btn-sm btn-primary ms-auto" id="btn-new-root-folder" data-parent-id="" title="New top-level folder">
<i class="bi bi-folder-plus"></i>
</button>
{{end}}
</div>
</div>
<div class="tree-scroll flex-fill overflow-auto">
<ul class="tree list-unstyled mb-0" id="tree-root">
<li class="tree-node tree-node-root" data-type="root">
<div class="tree-row selected" data-type="root" tabindex="0">
<span class="tree-toggle-spacer"></span>
<i class="bi bi-house-door-fill tree-icon text-primary"></i>
<span class="tree-label">Inventory</span>
</div>
</li>
<li>
<ul class="tree-children list-unstyled" id="top-level-children" data-expanded="true">
{{template "tree_children" .Tree}}
</ul>
</li>
</ul>
</div>
</aside>
<section id="main-panel" class="main-panel flex-fill overflow-auto" data-context-type="root" data-context-id="">
{{template "panel_root" .Root}}
</section>
</div>
{{template "modals" .}}
{{end}}