mirror of
https://github.com/maziggy/bambuddy.git
synced 2026-10-19 07:33:18 +02:00
Add tag management feature (Issue #183)
Implement centralized tag management for print archives:
- GET /archives/tags endpoint to list all tags with usage counts
- PUT /archives/tags/{name} endpoint to rename tags across archives
- DELETE /archives/tags/{name} endpoint to delete tags from archives
- TagManagementModal component with search, sort, rename, and delete
- Gear icon button next to tag filter dropdown on Archives page
- Fix tag autocompletion in EditArchiveModal using dedicated getTags API
Closes #183
This commit is contained in:
@@ -335,6 +335,11 @@ export interface ArchiveStats {
|
||||
total_energy_cost: number;
|
||||
}
|
||||
|
||||
export interface TagInfo {
|
||||
name: string;
|
||||
count: number;
|
||||
}
|
||||
|
||||
export interface FailureAnalysis {
|
||||
period_days: number;
|
||||
total_prints: number;
|
||||
@@ -1931,6 +1936,17 @@ export const api = {
|
||||
deleteArchive: (id: number) =>
|
||||
request<void>(`/archives/${id}`, { method: 'DELETE' }),
|
||||
getArchiveStats: () => request<ArchiveStats>('/archives/stats'),
|
||||
// Tag management
|
||||
getTags: () => request<TagInfo[]>('/archives/tags'),
|
||||
renameTag: (oldName: string, newName: string) =>
|
||||
request<{ affected: number }>(`/archives/tags/${encodeURIComponent(oldName)}`, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({ new_name: newName }),
|
||||
}),
|
||||
deleteTag: (name: string) =>
|
||||
request<{ affected: number }>(`/archives/tags/${encodeURIComponent(name)}`, {
|
||||
method: 'DELETE',
|
||||
}),
|
||||
recalculateCosts: () =>
|
||||
request<{ message: string; updated: number }>('/archives/recalculate-costs', { method: 'POST' }),
|
||||
getFailureAnalysis: (options?: { days?: number; printerId?: number; projectId?: number }) => {
|
||||
|
||||
Reference in New Issue
Block a user