ParametricPartTable Updates (#6692)

* Add parameter units to ParametricPartTable

* Fix conversion aliases
This commit is contained in:
Oliver 2024-03-13 16:02:40 +11:00 committed by GitHub
parent b33314659b
commit 891c4fef6a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View File

@ -39,9 +39,9 @@ def reload_unit_registry():
reg = pint.UnitRegistry(autoconvert_offset_to_baseunit=True)
# Aliases for temperature units
reg.define('@alias degC = celsius = Celsius')
reg.define('@alias degF = fahrenheit = Fahrenheit')
reg.define('@alias degK = kelvin = Kelvin')
reg.define('@alias degC = Celsius')
reg.define('@alias degF = Fahrenheit')
reg.define('@alias degK = Kelvin')
# Define some "standard" additional units
reg.define('piece = 1')

View File

@ -43,9 +43,15 @@ export default function ParametricPartTable({
let data = categoryParmeters.data ?? [];
return data.map((template: any) => {
let title = template.name;
if (template.units) {
title += ` [${template.units}]`;
}
return {
accessor: `parameter_${template.pk}`,
title: template.name,
title: title,
sortable: true,
render: (record: any) => {
// Find matching template parameter