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
+184
View File
@@ -0,0 +1,184 @@
:root {
--tree-indent: 1.15rem;
}
body {
background-color: #f7f8fa;
}
.app-navbar {
background-color: #fff;
}
.login-body {
min-height: 100vh;
background: linear-gradient(180deg, #eef1f6 0%, #f7f8fa 100%);
}
/* Admin-only UI: shown only when <body> carries the role-admin class. */
.admin-only { display: none !important; }
body.role-admin .admin-only { display: inherit !important; }
body.role-admin button.admin-only,
body.role-admin a.admin-only { display: inline-block !important; }
.inventory-shell {
height: calc(100vh - 56px);
min-height: 480px;
}
.tree-pane {
width: 340px;
min-width: 260px;
max-width: 45vw;
background-color: #fff;
flex-shrink: 0;
}
.tree-scroll {
overflow-y: auto;
}
.main-panel {
background-color: #fff;
}
ul.tree, ul.tree-children {
list-style: none;
margin: 0;
padding-left: 0;
}
ul.tree-children {
padding-left: var(--tree-indent);
}
.tree-node-root > .tree-row {
font-weight: 600;
}
.tree-row {
display: flex;
align-items: center;
gap: 0.35rem;
padding: 0.2rem 0.4rem;
border-radius: 0.25rem;
cursor: pointer;
white-space: nowrap;
user-select: none;
}
.tree-row:hover {
background-color: #f1f3f5;
}
.tree-row.selected {
background-color: #e7f1ff;
color: #0d6efd;
font-weight: 500;
}
.tree-row.drop-target {
outline: 2px dashed #0d6efd;
outline-offset: -2px;
background-color: #e7f1ff;
}
.tree-row-more {
cursor: default;
}
.tree-toggle {
border: none;
background: none;
padding: 0;
width: 1.1rem;
height: 1.1rem;
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
color: #6c757d;
}
.tree-toggle i {
transition: transform 0.12s ease;
}
.tree-toggle.expanded i {
transform: rotate(90deg);
}
.tree-toggle-spacer {
width: 1.1rem;
flex-shrink: 0;
display: inline-block;
}
.tree-icon {
flex-shrink: 0;
}
.tree-label {
overflow: hidden;
text-overflow: ellipsis;
flex: 1 1 auto;
}
.tree-status-badge {
font-size: 0.65rem;
flex-shrink: 0;
}
.tree-actions {
flex-shrink: 0;
}
.btn-tree-action {
border: none;
background: none;
color: #6c757d;
padding: 0 0.25rem;
}
.btn-tree-action:hover {
color: #212529;
}
.tree-node.dragging {
opacity: 0.4;
}
.stat-card .card-body {
text-align: center;
}
.stat-value {
font-size: 1.4rem;
font-weight: 600;
line-height: 1.2;
}
.stat-label {
font-size: 0.75rem;
color: #6c757d;
}
.panel-content {
max-width: 1100px;
}
.asset-row, .folder-link, .asset-link {
cursor: pointer;
}
@media (max-width: 767.98px) {
.inventory-shell {
flex-direction: column;
height: auto;
}
.tree-pane {
width: 100%;
max-width: 100%;
max-height: 40vh;
}
}
File diff suppressed because one or more lines are too long