#76 spool list, no reload on page change

This commit is contained in:
Connor Cleveland
2023-10-25 00:32:57 -05:00
parent 33b1c4f9ff
commit 517996d7a8
2 changed files with 270 additions and 254 deletions

View File

@@ -1,263 +1,264 @@
{
"actions": {
"list": "List",
"create": "Create",
"edit": "Edit",
"show": "Show",
"clone": "Clone"
"actions": {
"list": "List",
"create": "Create",
"edit": "Edit",
"show": "Show",
"clone": "Clone"
},
"buttons": {
"create": "Create",
"save": "Save",
"logout": "Log out",
"delete": "Delete",
"edit": "Edit",
"cancel": "Cancel",
"confirm": "Are you sure?",
"filter": "Filter",
"clear": "Clear",
"refresh": "Refresh",
"show": "Show",
"undo": "Undo",
"import": "Import",
"clone": "Clone",
"archive": "Archive",
"unArchive": "Unarchive",
"hideArchived": "Hide Archived",
"showArchived": "Show Archived",
"notAccessTitle": "You don't have permission to access",
"hideColumns": "Hide Columns",
"clearFilters": "Clear Filters"
},
"warnWhenUnsavedChanges": "Are you sure you want to leave? You have unsaved changes.",
"notifications": {
"success": "Successful",
"error": "Error (status code: {{statusCode}})",
"undoable": "You have {{seconds}} seconds to undo.",
"createSuccess": "Successfully created {{resource}}",
"createError": "There was an error creating {{resource}} (status code: {{statusCode}})",
"deleteSuccess": "Successfully deleted {{resource}}",
"deleteError": "Error when deleting {{resource}} (status code: {{statusCode}})",
"editSuccess": "Successfully edited {{resource}}",
"editError": "Error when editing {{resource}} (status code: {{statusCode}})",
"importProgress": "Importing: {{processed}}/{{total}}"
},
"loading": "Loading",
"version": "Version",
"unknown": "Unknown",
"yes": "Yes",
"no": "No",
"tags": {
"clone": "Clone"
},
"dashboard": {
"title": "Dashboard"
},
"printing": {
"generic": {
"title": "Printing",
"description": "Tune in the settings below to get the desired print layout. Keep in mind that printers and your OS may apply it's own margins and scaling, so you may need to perform some trial-and-error before it's all correct. Test it on a piece of regular paper before printing on the actual labels.",
"helpMargin": "Margins should be configured to match your label paper and printer, changing these will affect the size of the entire grid.",
"helpPrinterMargin": "Safe-Zone should be set to how close to the paper edge your printer can print, changing these will not affect the entire grid.",
"print": "Print",
"columns": "Columns",
"rows": "Rows",
"paperSize": "Paper Size",
"customSize": "Custom",
"dimensions": "Dimensions",
"showBorder": "Show Border",
"previewScale": "Preview Scale",
"skipItems": "Skip Items",
"contentSettings": "Content Settings",
"layoutSettings": "Layout Settings",
"horizontalSpacing": "Horizontal Spacing",
"verticalSpacing": "Vertical Spacing",
"marginLeft": "Left Margin",
"marginRight": "Right Margin",
"marginTop": "Top Margin",
"marginBottom": "Bottom Margin",
"printerMarginLeft": "Safe-Zone Left",
"printerMarginRight": "Safe-Zone Right",
"printerMarginTop": "Safe-Zone Top",
"printerMarginBottom": "Safe-Zone Bottom",
"borders": {
"none": "None",
"border": "Border",
"grid": "Grid"
}
},
"buttons": {
"create": "Create",
"save": "Save",
"logout": "Log out",
"delete": "Delete",
"edit": "Edit",
"cancel": "Cancel",
"confirm": "Are you sure?",
"filter": "Filter",
"clear": "Clear",
"refresh": "Refresh",
"show": "Show",
"undo": "Undo",
"import": "Import",
"clone": "Clone",
"archive": "Archive",
"unArchive": "Unarchive",
"hideArchived": "Hide Archived",
"showArchived": "Show Archived",
"notAccessTitle": "You don't have permission to access",
"hideColumns": "Hide Columns",
"clearFilters": "Clear Filters"
"qrcode": {
"button": "Print QR Codes",
"title": "QR Code Printing",
"spoolWeight": "Spool Weight: {{weight}}",
"lotNr": "Lot Nr: {{lot}}",
"bedTemp": "BT: {{temp}}",
"extruderTemp": "ET: {{temp}}",
"textSize": "Content Text Size",
"showSpoolmanIcon": "Show Spoolman Icon",
"showVendor": "Vendor",
"showContent": "Print Label",
"showLotNr": "Lot Nr",
"showSpoolWeight": "Spool Weight",
"showTemperatures": "Temperatures",
"showSpoolComment": "Spool Comment",
"showFilamentComment": "Filament Comment",
"showVendorComment": "Vendor Comment"
},
"warnWhenUnsavedChanges": "Are you sure you want to leave? You have unsaved changes.",
"notifications": {
"success": "Successful",
"error": "Error (status code: {{statusCode}})",
"undoable": "You have {{seconds}} seconds to undo.",
"createSuccess": "Successfully created {{resource}}",
"createError": "There was an error creating {{resource}} (status code: {{statusCode}})",
"deleteSuccess": "Successfully deleted {{resource}}",
"deleteError": "Error when deleting {{resource}} (status code: {{statusCode}})",
"editSuccess": "Successfully edited {{resource}}",
"editError": "Error when editing {{resource}} (status code: {{statusCode}})",
"importProgress": "Importing: {{processed}}/{{total}}"
"spoolSelect": {
"title": "Select Spools",
"description": "Select spools to print QR codes for.",
"showArchived": "Show Archived",
"noSpoolsSelected": "You have not selected any spools.",
"selectAll": "Select/Unselect All",
"selectedTotal_one": "{{count}} spool selected",
"selectedTotal_other": "{{count}} spools selected"
}
},
"scanner": {
"title": "QR Code Scanner",
"description": "Scan a Spoolman QR code to view details about the spool.",
"error": {
"notAllowed": "You have not allowed access to the camera.",
"insecureContext": "The page is not served over HTTPS.",
"streamApiNotSupported": "The browser does not support the MediaStream API.",
"notReadable": "The camera is not readable.",
"notFound": "No camera was found.",
"unknown": "An unknown error occurred. ({{error}})"
}
},
"spool": {
"spool": "Spools",
"fields": {
"id": "ID",
"filament_name": "Filament",
"filament": "Filament",
"material": "Material",
"weight_to_use": "Weight",
"used_weight": "Used Weight",
"remaining_weight": "Remaining Weight",
"measured_weight": "Measured Weight",
"used_length": "Used Length",
"remaining_length": "Remaining Length",
"location": "Location",
"lot_nr": "Lot Nr",
"first_used": "First Used",
"last_used": "Last Used",
"registered": "Registered",
"comment": "Comment",
"archived": "Archived"
},
"loading": "Loading",
"version": "Version",
"unknown": "Unknown",
"yes": "Yes",
"no": "No",
"tags": {
"clone": "Clone"
"fields_help": {
"weight_to_use": "Select what weight value to enter. Measured weight is only available if the spool weight is set for the selected filament.",
"used_weight": "How much filament has been used from the spool. A new spool should have 0g used.",
"remaining_weight": "How much filament is left on the spool. For a new spool this should match the spool weight.",
"measured_weight": "How much the filament and spool weigh.",
"location": "Where the spool is located if you have multiple locations where you store your spools.",
"lot_nr": "Manufacturer's lot number. Can be used to ensure a print has consistent color if multiple spools are used."
},
"dashboard": {
"title": "Dashboard"
"titles": {
"create": "Create Spool",
"clone": "Clone Spool",
"edit": "Edit Spool",
"list": "Spools",
"show": "Show Spool",
"show_title": "[Spool #{{id}}] {{name}}",
"archive": "Archive Spool"
},
"printing": {
"generic": {
"title": "Printing",
"description": "Tune in the settings below to get the desired print layout. Keep in mind that printers and your OS may apply it's own margins and scaling, so you may need to perform some trial-and-error before it's all correct. Test it on a piece of regular paper before printing on the actual labels.",
"helpMargin": "Margins should be configured to match your label paper and printer, changing these will affect the size of the entire grid.",
"helpPrinterMargin": "Safe-Zone should be set to how close to the paper edge your printer can print, changing these will not affect the entire grid.",
"print": "Print",
"columns": "Columns",
"rows": "Rows",
"paperSize": "Paper Size",
"customSize": "Custom",
"dimensions": "Dimensions",
"showBorder": "Show Border",
"previewScale": "Preview Scale",
"skipItems": "Skip Items",
"contentSettings": "Content Settings",
"layoutSettings": "Layout Settings",
"horizontalSpacing": "Horizontal Spacing",
"verticalSpacing": "Vertical Spacing",
"marginLeft": "Left Margin",
"marginRight": "Right Margin",
"marginTop": "Top Margin",
"marginBottom": "Bottom Margin",
"printerMarginLeft": "Safe-Zone Left",
"printerMarginRight": "Safe-Zone Right",
"printerMarginTop": "Safe-Zone Top",
"printerMarginBottom": "Safe-Zone Bottom",
"borders": {
"none": "None",
"border": "Border",
"grid": "Grid"
}
},
"qrcode": {
"button": "Print QR Codes",
"title": "QR Code Printing",
"spoolWeight": "Spool Weight: {{weight}}",
"lotNr": "Lot Nr: {{lot}}",
"bedTemp": "BT: {{temp}}",
"extruderTemp": "ET: {{temp}}",
"textSize": "Content Text Size",
"showSpoolmanIcon": "Show Spoolman Icon",
"showVendor": "Vendor",
"showContent": "Print Label",
"showLotNr": "Lot Nr",
"showSpoolWeight": "Spool Weight",
"showTemperatures": "Temperatures",
"showSpoolComment": "Spool Comment",
"showFilamentComment": "Filament Comment",
"showVendorComment": "Vendor Comment"
},
"spoolSelect": {
"title": "Select Spools",
"description": "Select spools to print QR codes for.",
"showArchived": "Show Archived",
"noSpoolsSelected": "You have not selected any spools.",
"selectAll": "Select/Unselect All",
"selectedTotal_one": "{{count}} spool selected",
"selectedTotal_other": "{{count}} spools selected"
}
"form": {
"new_location_prompt": "Enter a new location",
"spool_updated": "This spool has been updated by someone/something else since you opened this page. Saving will overwrite those changes!"
},
"scanner": {
"title": "QR Code Scanner",
"description": "Scan a Spoolman QR code to view details about the spool.",
"error": {
"notAllowed": "You have not allowed access to the camera.",
"insecureContext": "The page is not served over HTTPS.",
"streamApiNotSupported": "The browser does not support the MediaStream API.",
"notReadable": "The camera is not readable.",
"notFound": "No camera was found.",
"unknown": "An unknown error occurred. ({{error}})"
}
"messages": {
"archive": "Are you sure you want to archive this spool?"
}
},
"filament": {
"filament": "Filaments",
"fields": {
"id": "ID",
"vendor_name": "Vendor",
"vendor": "Vendor",
"name": "Name",
"material": "Material",
"price": "Price",
"density": "Density",
"diameter": "Diameter",
"weight": "Weight",
"spool_weight": "Spool Weight",
"article_number": "Article Number",
"registered": "Registered",
"comment": "Comment",
"settings_extruder_temp": "Extruder Temp",
"settings_bed_temp": "Bed Temp",
"color_hex": "Color",
"spools": "Spool List"
},
"fields_help": {
"name": "Filament name, to distinguish this filament type among others from the same vendor. Should contain the color for example.",
"material": "E.g. PLA, ABS, PETG, etc.",
"price": "Price of a full spool in the system configured currency.",
"weight": "The filament weight of a full spool (net weight). This should not include the weight of the spool itself, only the filament. It is what is usually written on the packaging.",
"spool_weight": "The weight of an empty spool. Used to determine measured weight of a spool.",
"article_number": "E.g. EAN, UPC, etc."
},
"titles": {
"create": "Create Filament",
"clone": "Clone Filament",
"edit": "Edit Filament",
"list": "Filaments",
"show": "Show Filament",
"show_title": "[Filament #{{id}}] {{name}}"
},
"form": {
"filament_updated": "This filament has been updated by someone/something else since you opened this page. Saving will overwrite those changes!"
}
},
"vendor": {
"vendor": "Vendors",
"fields": {
"id": "ID",
"name": "Name",
"registered": "Registered",
"comment": "Comment"
},
"titles": {
"create": "Create Vendor",
"clone": "Clone Vendor",
"edit": "Edit Vendor",
"list": "Vendors",
"show": "Show Vendor",
"show_title": "[Vendor #{{id}}] {{name}}"
},
"form": {
"vendor_updated": "This vendor has been updated by someone/something else since you opened this page. Saving will overwrite those changes!"
}
},
"table": {
"actions": "Actions"
},
"documentTitle": {
"default": "Spoolman",
"suffix": " | Spoolman",
"filament": {
"list": "Filaments | Spoolman",
"show": "#{{id}} Show Filament | Spoolman",
"edit": "#{{id}} Edit Filament | Spoolman",
"create": "Create Filament | Spoolman",
"clone": "#{{id}} Clone Filament | Spoolman"
},
"spool": {
"spool": "Spools",
"fields": {
"id": "ID",
"filament_name": "Filament",
"filament": "Filament",
"material": "Material",
"weight_to_use": "Weight",
"used_weight": "Used Weight",
"remaining_weight": "Remaining Weight",
"measured_weight": "Measured Weight",
"used_length": "Used Length",
"remaining_length": "Remaining Length",
"location": "Location",
"lot_nr": "Lot Nr",
"first_used": "First Used",
"last_used": "Last Used",
"registered": "Registered",
"comment": "Comment",
"archived": "Archived"
},
"fields_help": {
"weight_to_use": "Select what weight value to enter. Measured weight is only available if the spool weight is set for the selected filament.",
"used_weight": "How much filament has been used from the spool. A new spool should have 0g used.",
"remaining_weight": "How much filament is left on the spool. For a new spool this should match the spool weight.",
"measured_weight": "How much the filament and spool weigh.",
"location": "Where the spool is located if you have multiple locations where you store your spools.",
"lot_nr": "Manufacturer's lot number. Can be used to ensure a print has consistent color if multiple spools are used."
},
"titles": {
"create": "Create Spool",
"clone": "Clone Spool",
"edit": "Edit Spool",
"list": "Spools",
"show": "Show Spool",
"show_title": "[Spool #{{id}}] {{name}}",
"archive": "Archive Spool"
},
"form": {
"new_location_prompt": "Enter a new location",
"spool_updated": "This spool has been updated by someone/something else since you opened this page. Saving will overwrite those changes!"
},
"messages": {
"archive": "Are you sure you want to archive this spool?"
}
},
"filament": {
"filament": "Filaments",
"fields": {
"id": "ID",
"vendor_name": "Vendor",
"vendor": "Vendor",
"name": "Name",
"material": "Material",
"price": "Price",
"density": "Density",
"diameter": "Diameter",
"weight": "Weight",
"spool_weight": "Spool Weight",
"article_number": "Article Number",
"registered": "Registered",
"comment": "Comment",
"settings_extruder_temp": "Extruder Temp",
"settings_bed_temp": "Bed Temp",
"color_hex": "Color"
},
"fields_help": {
"name": "Filament name, to distinguish this filament type among others from the same vendor. Should contain the color for example.",
"material": "E.g. PLA, ABS, PETG, etc.",
"price": "Price of a full spool in the system configured currency.",
"weight": "The filament weight of a full spool (net weight). This should not include the weight of the spool itself, only the filament. It is what is usually written on the packaging.",
"spool_weight": "The weight of an empty spool. Used to determine measured weight of a spool.",
"article_number": "E.g. EAN, UPC, etc."
},
"titles": {
"create": "Create Filament",
"clone": "Clone Filament",
"edit": "Edit Filament",
"list": "Filaments",
"show": "Show Filament",
"show_title": "[Filament #{{id}}] {{name}}"
},
"form": {
"filament_updated": "This filament has been updated by someone/something else since you opened this page. Saving will overwrite those changes!"
}
"list": "Spools | Spoolman",
"show": "#{{id}} Show Spool | Spoolman",
"edit": "#{{id}} Edit Spool | Spoolman",
"create": "Create Spool | Spoolman",
"clone": "#{{id}} Clone Spool | Spoolman"
},
"vendor": {
"vendor": "Vendors",
"fields": {
"id": "ID",
"name": "Name",
"registered": "Registered",
"comment": "Comment"
},
"titles": {
"create": "Create Vendor",
"clone": "Clone Vendor",
"edit": "Edit Vendor",
"list": "Vendors",
"show": "Show Vendor",
"show_title": "[Vendor #{{id}}] {{name}}"
},
"form": {
"vendor_updated": "This vendor has been updated by someone/something else since you opened this page. Saving will overwrite those changes!"
}
},
"table": {
"actions": "Actions"
},
"documentTitle": {
"default": "Spoolman",
"suffix": " | Spoolman",
"filament": {
"list": "Filaments | Spoolman",
"show": "#{{id}} Show Filament | Spoolman",
"edit": "#{{id}} Edit Filament | Spoolman",
"create": "Create Filament | Spoolman",
"clone": "#{{id}} Clone Filament | Spoolman"
},
"spool": {
"list": "Spools | Spoolman",
"show": "#{{id}} Show Spool | Spoolman",
"edit": "#{{id}} Edit Spool | Spoolman",
"create": "Create Spool | Spoolman",
"clone": "#{{id}} Clone Spool | Spoolman"
},
"vendor": {
"list": "Vendors | Spoolman",
"show": "#{{id}} Show Vendor | Spoolman",
"edit": "#{{id}} Edit Vendor | Spoolman",
"create": "Create Vendor | Spoolman",
"clone": "#{{id}} Clone Vendor | Spoolman"
}
"list": "Vendors | Spoolman",
"show": "#{{id}} Show Vendor | Spoolman",
"edit": "#{{id}} Edit Vendor | Spoolman",
"create": "Create Vendor | Spoolman",
"clone": "#{{id}} Clone Vendor | Spoolman"
}
}
}

View File

@@ -8,14 +8,14 @@ import utc from "dayjs/plugin/utc";
import { IFilament } from "./model";
import { enrichText } from "../../utils/parsing";
import { IVendor } from "../vendors/model";
import { useNavigate } from "react-router-dom";
dayjs.extend(utc);
const { Title } = Typography;
export const FilamentShow: React.FC<IResourceComponentsProps> = () => {
const t = useTranslate();
const navigate = useNavigate();
const { queryResult } = useShow<IFilament>({
liveMode: "auto",
});
@@ -35,13 +35,24 @@ export const FilamentShow: React.FC<IResourceComponentsProps> = () => {
const URL = `/vendor/show/${item.id}`;
return <a href={URL}>{item.name}</a>;
};
const gotoVendor = (): undefined => {
const URL = `/vendor/show/${record?.vendor?.id}`;
navigate(URL);
}
const gotoSpools = (): undefined => {
const URL = `/spool#filters=[{"field":"filament.id","operator":"in","value":[${record?.id}]}]`
navigate(URL);
}
return (
<Show isLoading={isLoading} title={record ? formatTitle(record) : ""}>
<Title level={5}>{t("filament.fields.id")}</Title>
<NumberField value={record?.id ?? ""} />
<Title level={5}>{t("filament.fields.vendor")}</Title>
<TextField value={record?.vendor ? formatVendor(record?.vendor) : ""} />
<button onClick={gotoVendor} style={{ background: 'none', border: 'none', color: 'blue', cursor: 'pointer', paddingLeft: 0 }}>
{record ? record.vendor?.name : ""}
</button>
<Title level={5}>{t("filament.fields.registered")}</Title>
<DateField
value={dayjs.utc(record?.registered).local()}
@@ -110,7 +121,11 @@ export const FilamentShow: React.FC<IResourceComponentsProps> = () => {
<TextField value={record?.article_number} />
<Title level={5}>{t("filament.fields.comment")}</Title>
<TextField value={enrichText(record?.comment)} />
</Show>
<Title level={5}>{t("filament.fields.spools")}</Title>
<button onClick={gotoSpools} style={{ background: 'none', border: 'none', color: 'blue', cursor: 'pointer', paddingLeft: 0 }}>
{record ? formatTitle(record) : ""}
</button>
</Show >
);
};