Merge pull request #429 from Keybored02/feature/use_remaining_filament

Show remaining spool weigth instead of used
This commit is contained in:
MartinNYHC
2026-02-18 15:03:57 +01:00
committed by GitHub
8 changed files with 22 additions and 5 deletions
+1 -1
View File
@@ -177,7 +177,7 @@ export function AssignSpoolModal({ isOpen, onClose, printerId, amsId, trayId, tr
<p className="text-xs text-bambu-gray">
{spool.color_name || ''}
{spool.label_weight ? ` - ${spool.label_weight}g` : ''}
{spool.weight_used > 0 ? ` (${Math.round(spool.weight_used)}g used)` : ''}
{spool.label_weight ? ` (${Math.max(0, Math.round(spool.label_weight - spool.weight_used))}g ${t('ams.remainingUnit')})` : ''}
</p>
</div>
{selectedSpoolId === spool.id && (
@@ -24,7 +24,7 @@ interface SpoolmanConfig {
interface InventoryConfig {
onAssignSpool?: () => void;
onUnassignSpool?: () => void;
assignedSpool?: { id: number; material: string; brand: string | null; color_name: string | null } | null;
assignedSpool?: { id: number; material: string; brand: string | null; color_name: string | null; remainingWeightGrams?: number | null } | null;
}
interface ConfigureSlotConfig {
@@ -148,6 +148,7 @@ export function FilamentHoverCard({ data, children, disabled, className = '', sp
};
const colorHex = data.colorHex ? `#${data.colorHex.replace('#', '')}` : null;
const assignedRemainingWeight = inventory?.assignedSpool?.remainingWeightGrams ?? null;
return (
<div
@@ -238,7 +239,10 @@ export function FilamentHoverCard({ data, children, disabled, className = '', sp
{t('ams.fill')}
</span>
<span className="text-xs text-white font-semibold flex items-center gap-1">
{data.fillLevel !== null ? `${data.fillLevel}%` : '—'}
<span>{data.fillLevel !== null ? `${data.fillLevel}%` : '—'}</span>
{assignedRemainingWeight !== null && data.fillLevel !== null && (
<span className="text-[9px] text-bambu-gray font-normal">• {assignedRemainingWeight}g</span>
)}
{data.fillSource === 'spoolman' && data.fillLevel !== null && (
<span className="text-[9px] text-bambu-gray font-normal">{t('spoolman.fillSourceLabel')}</span>
)}
+2
View File
@@ -2682,6 +2682,8 @@ export default {
kFactor: 'K-Faktor',
fill: 'Füllstand',
configure: 'Konfigurieren',
used: 'verwendet',
remainingUnit: 'verbleibend',
},
// Print modal
+2
View File
@@ -2686,6 +2686,8 @@ export default {
kFactor: 'K Factor',
fill: 'Fill',
configure: 'Configure',
used: 'used',
remainingUnit: 'remaining',
},
// Print modal
+2
View File
@@ -2674,6 +2674,8 @@ export default {
kFactor: 'Facteur K',
fill: 'Remplir',
configure: 'Configurer',
used: 'utilisé',
remainingUnit: 'restant',
},
// Print modal
+4 -2
View File
@@ -2347,7 +2347,7 @@ export default {
kProfiles: 'K-Profiles',
addKProfile: 'Aggiungi K-Profile',
assignSpool: 'Assegna Bobina',
unassignSpool: 'Deassegna',
unassignSpool: 'Scollega',
assignSuccess: 'Bobina assegnata e slot AMS configurato',
assignFailed: 'Assegnazione bobina fallita',
selectSpool: 'Seleziona una bobina da assegnare a questo slot',
@@ -2397,8 +2397,10 @@ export default {
externalSpool: 'Bobina esterna',
profile: 'Profilo',
kFactor: 'K Factor',
fill: 'Riempi',
fill: 'Livello',
configure: 'Configura',
used: 'utilizzato',
remainingUnit: 'rimanente',
},
// Print modal
+2
View File
@@ -2604,6 +2604,8 @@ export default {
kFactor: 'K値',
fill: '充填率',
configure: '設定',
used: '使用済み',
remainingUnit: '残り',
},
printModal: {
flowCalibration: 'フローキャリブレーション',
+3
View File
@@ -2907,6 +2907,7 @@ function PrinterCard({
material: assignment.spool.material,
brand: assignment.spool.brand,
color_name: assignment.spool.color_name,
remainingWeightGrams: Math.max(0, Math.round(assignment.spool.label_weight - assignment.spool.weight_used)),
} : null,
onAssignSpool: filamentData.vendor !== 'Bambu Lab' ? () => setAssignSpoolModal({
printerId: printer.id,
@@ -3144,6 +3145,7 @@ function PrinterCard({
material: assignment.spool.material,
brand: assignment.spool.brand,
color_name: assignment.spool.color_name,
remainingWeightGrams: Math.max(0, Math.round(assignment.spool.label_weight - assignment.spool.weight_used)),
} : null,
onAssignSpool: filamentData.vendor !== 'Bambu Lab' ? () => setAssignSpoolModal({
printerId: printer.id,
@@ -3330,6 +3332,7 @@ function PrinterCard({
material: assignment.spool.material,
brand: assignment.spool.brand,
color_name: assignment.spool.color_name,
remainingWeightGrams: Math.max(0, Math.round(assignment.spool.label_weight - assignment.spool.weight_used)),
} : null,
onAssignSpool: () => setAssignSpoolModal({
printerId: printer.id,