feat(filament): add spool count and total remaining weight columns
Adds computed spool statistics to filament list: - spool_count: Number of non-archived spools of this filament - total_remaining_weight: Sum of remaining weight across all spools Backend changes: - Modified database/filament.py find() to compute stats via subquery - Added fields to Filament pydantic model in api/v1/models.py - Updated filament API endpoint to include stats in response Frontend changes: - Added fields to IFilament interface - Added columns to filament list table - Added translation keys Closes #15 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -260,7 +260,9 @@
|
||||
"longitudinal": "Longitudinal",
|
||||
"external_id": "External ID",
|
||||
"spools": "Show Spools",
|
||||
"not_set": "Not Set"
|
||||
"not_set": "Not Set",
|
||||
"spool_count": "Spools",
|
||||
"total_remaining_weight": "Total Remaining"
|
||||
},
|
||||
"fields_help": {
|
||||
"name": "Filament name, to distinguish this filament type among others from the same manufacturer. Should contain the color for example.",
|
||||
|
||||
@@ -65,6 +65,8 @@ const allColumns: (keyof IFilamentCollapsed & string)[] = [
|
||||
"article_number",
|
||||
"settings_extruder_temp",
|
||||
"settings_bed_temp",
|
||||
"spool_count",
|
||||
"total_remaining_weight",
|
||||
"registered",
|
||||
"comment",
|
||||
];
|
||||
@@ -324,6 +326,22 @@ export const FilamentList: React.FC<IResourceComponentsProps> = () => {
|
||||
maxDecimals: 0,
|
||||
width: 100,
|
||||
}),
|
||||
NumberColumn({
|
||||
...commonProps,
|
||||
id: "spool_count",
|
||||
i18ncat: "filament",
|
||||
unit: "",
|
||||
maxDecimals: 0,
|
||||
width: 80,
|
||||
}),
|
||||
NumberColumn({
|
||||
...commonProps,
|
||||
id: "total_remaining_weight",
|
||||
i18ncat: "filament",
|
||||
unit: "g",
|
||||
maxDecimals: 0,
|
||||
width: 120,
|
||||
}),
|
||||
DateColumn({
|
||||
...commonProps,
|
||||
id: "registered",
|
||||
|
||||
@@ -24,6 +24,8 @@ export interface IFilament {
|
||||
multi_color_direction?: string;
|
||||
external_id?: string;
|
||||
extra: { [key: string]: string };
|
||||
spool_count?: number;
|
||||
total_remaining_weight?: number;
|
||||
}
|
||||
|
||||
// IFilamentParsedExtras is the same as IFilament, but with the extra field parsed into its real types
|
||||
|
||||
Reference in New Issue
Block a user