Statuses import, an icon picker, folder-scoped CSV import, and site name
- Statuses can now be bulk-imported/updated via CSV (Name, Color columns; matches and updates existing statuses by name). New internal/statuses/csv.go, tested. - Icon fields (folder create/rename, item type form) are now a searchable dropdown of the 50 most common Bootstrap Icons instead of a free-text box, via a small reusable .icon-picker widget in app.js/app.css. - CSV asset import is now folder-scoped when triggered from the tree: right-click a folder (or its background) > Import CSV... imports every row directly into that folder, so the CSV needs no Folder column at all, and the option no longer appears at the top level. The original global, Folder-path-aware import (with auto-create-missing-folders) moved to a new admin-only Settings > Import / Export page, alongside the new Statuses import and format examples for both. assets.Import gained ImportOptions.TargetFolderID to drive the folder-scoped mode. - Site Name (Settings > General) now actually renders in the navbar brand and <title>, via a per-App "siteName" template func bound in loadTemplates. The brand is plain text now, not a link to /inventory.
This commit is contained in:
@@ -3,16 +3,16 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>inventree</title>
|
||||
<title>{{siteName}}</title>
|
||||
<link rel="stylesheet" href="/static/css/bootstrap.min.css">
|
||||
<link rel="stylesheet" href="/static/icons/bootstrap-icons.css">
|
||||
<link rel="stylesheet" href="/static/css/app.css">
|
||||
</head>
|
||||
<body class="role-{{.User.Role}}">
|
||||
<nav class="navbar navbar-expand-lg app-navbar border-bottom px-3">
|
||||
<a class="navbar-brand fw-semibold d-flex align-items-center gap-2" href="/inventory">
|
||||
<i class="bi bi-diagram-3-fill"></i> inventree
|
||||
</a>
|
||||
<span class="navbar-brand fw-semibold d-flex align-items-center gap-2 mb-0">
|
||||
<i class="bi bi-diagram-3-fill"></i> {{siteName}}
|
||||
</span>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navMain">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
|
||||
@@ -22,8 +22,20 @@
|
||||
<input type="text" class="form-control" name="name" value="{{if .ItemType}}{{.ItemType.Name}}{{end}}" required>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label class="form-label">Icon <span class="text-body-secondary">(Bootstrap Icons class)</span></label>
|
||||
<input type="text" class="form-control" name="icon" value="{{if .ItemType}}{{.ItemType.Icon}}{{end}}" placeholder="bi-box-seam">
|
||||
<label class="form-label">Icon</label>
|
||||
<div class="icon-picker" data-icon-picker>
|
||||
<input type="hidden" name="icon" value="{{if .ItemType}}{{.ItemType.Icon}}{{end}}">
|
||||
<button type="button" class="btn btn-outline-secondary icon-picker-toggle w-100">
|
||||
<i class="bi icon-picker-preview"></i>
|
||||
<span class="icon-picker-label text-body-secondary">Choose icon…</span>
|
||||
<i class="bi bi-chevron-down icon-picker-caret"></i>
|
||||
</button>
|
||||
<div class="icon-picker-menu">
|
||||
<input type="search" class="form-control form-control-sm icon-picker-search" placeholder="Search icons…">
|
||||
<div class="icon-picker-grid"></div>
|
||||
<button type="button" class="btn btn-sm btn-link p-0 mt-2 icon-picker-clear">Clear</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label class="form-label">Description</label>
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
{{define "content"}}
|
||||
<div class="container-fluid p-3">
|
||||
<h4 class="mb-3">Settings</h4>
|
||||
<div class="row g-3">
|
||||
<div class="col-md-3 col-lg-2">
|
||||
{{template "settings_nav" "import"}}
|
||||
</div>
|
||||
<div class="col-md-9 col-lg-10" style="max-width: 900px">
|
||||
|
||||
{{if .Error}}
|
||||
<div class="alert alert-danger">{{.Error}}</div>
|
||||
{{else if eq .Kind "assets"}}
|
||||
<div class="alert alert-success">Imported {{.Imported}} asset(s), updated {{.Updated}}.{{if .Errs}} {{.Errs}} row(s) had warnings.{{end}}</div>
|
||||
{{else if eq .Kind "statuses"}}
|
||||
<div class="alert alert-success">Imported {{.Imported}} status(es), updated {{.Updated}}.{{if .Errs}} {{.Errs}} row(s) had warnings.{{end}}</div>
|
||||
{{end}}
|
||||
|
||||
<p class="text-body-secondary">
|
||||
This page is for bulk, admin-level imports that can reference any folder path (and create missing
|
||||
folders along the way). To import assets straight into one specific folder without a Folder column,
|
||||
right-click that folder in the Inventory tree and choose <strong>Import CSV…</strong> instead.
|
||||
</p>
|
||||
|
||||
<div class="card mb-4">
|
||||
<div class="card-header py-2 fw-semibold">Import Assets</div>
|
||||
<div class="card-body">
|
||||
<form method="post" action="/settings/import/assets" enctype="multipart/form-data" class="mb-3">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">CSV File</label>
|
||||
<input type="file" class="form-control" name="file" accept=".csv" required>
|
||||
</div>
|
||||
<div class="form-check mb-3">
|
||||
<input class="form-check-input" type="checkbox" name="create_missing_folders" id="createMissingFolders" value="1" checked>
|
||||
<label class="form-check-label" for="createMissingFolders">Create missing folders referenced in the Folder column</label>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Import Assets</button>
|
||||
</form>
|
||||
|
||||
<p class="mb-1 fw-semibold small">Format</p>
|
||||
<p class="text-body-secondary small mb-2">
|
||||
Required: <code>Name</code>, <code>Item Type</code>, <code>Status</code>. Optional:
|
||||
<code>Asset ID</code> (auto-generated if blank; matches an existing asset to update it),
|
||||
<code>Folder</code> (a <code>/</code>-separated path such as <code>Main Office/Network</code>),
|
||||
<code>Assigned User</code>, <code>Notes</code>, and one <code>cf_<field_key></code> column
|
||||
per custom field (e.g. <code>cf_serial_number</code>).
|
||||
</p>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-bordered mb-0 small">
|
||||
<thead>
|
||||
<tr><th>Asset ID</th><th>Name</th><th>Item Type</th><th>Folder</th><th>Status</th><th>Assigned User</th><th>Notes</th><th>cf_serial_number</th></tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr><td></td><td>Core Switch</td><td>Switch</td><td>Main Office/Network</td><td>In Use</td><td></td><td></td><td>SN-12345</td></tr>
|
||||
<tr><td>IT-000042</td><td>Front Desk PC</td><td>Desktop</td><td>Main Office/Workstations</td><td>In Use</td><td>jdoe</td><td>Loaner unit</td><td></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<div class="card-header py-2 fw-semibold">Import Statuses</div>
|
||||
<div class="card-body">
|
||||
<form method="post" action="/settings/import/statuses" enctype="multipart/form-data" class="mb-3">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">CSV File</label>
|
||||
<input type="file" class="form-control" name="file" accept=".csv" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Import Statuses</button>
|
||||
</form>
|
||||
|
||||
<p class="mb-1 fw-semibold small">Format</p>
|
||||
<p class="text-body-secondary small mb-2">
|
||||
Required: <code>Name</code>. Optional: <code>Color</code> (any Bootstrap color name -
|
||||
<code>primary</code>, <code>secondary</code>, <code>success</code>, <code>danger</code>,
|
||||
<code>warning</code>, <code>info</code>, or <code>dark</code>; defaults to <code>secondary</code>).
|
||||
A row whose name matches an existing status updates its color instead of creating a duplicate.
|
||||
</p>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-bordered mb-0 small">
|
||||
<thead><tr><th>Name</th><th>Color</th></tr></thead>
|
||||
<tbody>
|
||||
<tr><td>In Use</td><td>success</td></tr>
|
||||
<tr><td>Awaiting Parts</td><td>warning</td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
@@ -22,8 +22,20 @@
|
||||
</div>
|
||||
<div class="row g-2">
|
||||
<div class="col">
|
||||
<label class="form-label">Icon <span class="text-body-secondary">(Bootstrap Icons class, optional)</span></label>
|
||||
<input type="text" class="form-control" name="icon" id="folderFormIcon" placeholder="bi-folder-fill">
|
||||
<label class="form-label">Icon <span class="text-body-secondary">(optional)</span></label>
|
||||
<div class="icon-picker" data-icon-picker>
|
||||
<input type="hidden" name="icon" id="folderFormIcon" value="">
|
||||
<button type="button" class="btn btn-outline-secondary icon-picker-toggle w-100">
|
||||
<i class="bi icon-picker-preview"></i>
|
||||
<span class="icon-picker-label text-body-secondary">Choose icon…</span>
|
||||
<i class="bi bi-chevron-down icon-picker-caret"></i>
|
||||
</button>
|
||||
<div class="icon-picker-menu">
|
||||
<input type="search" class="form-control form-control-sm icon-picker-search" placeholder="Search icons…">
|
||||
<div class="icon-picker-grid"></div>
|
||||
<button type="button" class="btn btn-sm btn-link p-0 mt-2 icon-picker-clear">Clear</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<label class="form-label">Sort Order</label>
|
||||
@@ -116,26 +128,25 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Import CSV -->
|
||||
<!-- Import CSV into a specific folder (right-click a folder > Import CSV...) -->
|
||||
<div class="modal fade" id="importModal" tabindex="-1">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<form id="importForm">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Import Assets from CSV</h5>
|
||||
<h5 class="modal-title" id="importModalTitle">Import CSV</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="hidden" name="folder_id" id="importFolderId">
|
||||
<div class="mb-3">
|
||||
<label class="form-label">CSV File</label>
|
||||
<input type="file" class="form-control" name="file" id="importFile" accept=".csv" required>
|
||||
</div>
|
||||
<div class="form-check mb-2">
|
||||
<input class="form-check-input" type="checkbox" name="create_missing_folders" id="importCreateFolders" value="1" checked>
|
||||
<label class="form-check-label" for="importCreateFolders">Create missing folders referenced in the Folder column</label>
|
||||
</div>
|
||||
<p class="text-body-secondary small mb-0">
|
||||
Columns: Asset ID, Name, Item Type, Folder, Status, Assigned User, Notes, plus <code>cf_<field_key></code> for custom fields.
|
||||
Every row imports into this folder. Columns: <code>Name</code>, <code>Item Type</code>,
|
||||
<code>Status</code>. Optional: <code>Asset ID</code>, <code>Assigned User</code>, <code>Notes</code>,
|
||||
plus <code>cf_<field_key></code> for custom fields. No Folder column needed.
|
||||
</p>
|
||||
<div id="importResult" class="mt-3"></div>
|
||||
</div>
|
||||
|
||||
@@ -12,5 +12,8 @@
|
||||
<a href="/settings/users" class="list-group-item list-group-item-action{{if eq . "users"}} active{{end}}">
|
||||
<i class="bi bi-people me-2"></i>Users
|
||||
</a>
|
||||
<a href="/settings/import" class="list-group-item list-group-item-action{{if eq . "import"}} active{{end}}">
|
||||
<i class="bi bi-upload me-2"></i>Import / Export
|
||||
</a>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
Reference in New Issue
Block a user