eLabSDK2.Inventory.StorageUnit
Hierarchy
-
↳
StorageUnit
Methods
addTreeNodeAddition
Static addTreeNodeAddition(nodeContent): Promise<unknown>
Add custom HTML content to storage unit nodes in the inventory tree navigator.
This allows you to inject additional content (HTML) that will be rendered alongside
storage unit nodes (freezers, refrigerators, cabinets, boxes, etc.) in the inventory
browser's tree view. The content can be conditionally displayed using the optional
isVisible function. This is useful for adding badges, status indicators, custom icons,
capacity information, temperature alerts, or other contextual details to storage unit nodes.
Parameters
| Name | Type | Description |
|---|---|---|
nodeContent | TreeNodeAddition | { id: string, html: string, toolTip: string, isVisible?: (storageLayer: StorageLayerDetail) => boolean } |
Returns
Promise<unknown>
Example
// Add temperature alert to storage units
eLabSDK2.Inventory.StorageUnit.addTreeNodeAddition({
id: 'temp-alert',
html: '<i class="fas fa-thermometer-full text-danger"></i>',
toolTip: 'Temperature alert - check unit',
isVisible: (storageLayer) => storageLayer.requiresAttention === true
});
Example
// Add capacity badge to all storage units
eLabSDK2.Inventory.StorageUnit.addTreeNodeAddition({
id: 'capacity-badge',
html: '<span class="badge badge-warning">Full</span>',
toolTip: 'Storage unit is at capacity',
isVisible: (storageLayer) => {
if (!storageLayer.capacity) return false;
const percentFull = (storageLayer.occupiedPositions / storageLayer.capacity) * 100;
return percentFull > 90;
}
});
configureTreeNode
Static configureTreeNode(nodeConfiguration): Promise<unknown>
Customize the visual appearance and behavior of storage unit nodes in the inventory tree navigator.
This allows you to override the default rendering of storage unit nodes (freezers, refrigerators,
cabinets, boxes, etc.) by customizing their color, icon, tooltip, and label. You can apply
these customizations globally to all storage unit nodes or conditionally to specific units
using the isVisible function. This is useful for visually distinguishing different types of
storage units, indicating capacity or temperature status, or highlighting units that need attention.
Parameters
| Name | Type | Description |
|---|---|---|
nodeConfiguration | TreeNodeConfiguration | { id: string, color: string, icon: string, toolTip: string, customLabel?: (storageUnitId: number) => string, isVisible?: (storageLayer: StorageLayerDetail) => boolean } |
Returns
Promise<unknown>
Example
// Apply red color to all storage unit nodes
eLabSDK2.Inventory.StorageUnit.configureTreeNode({
id: 'all-units-red',
color: 'red',
icon: 'fas fa-box',
toolTip: 'Storage unit',
isVisible: (storageLayer) => true
});
Example
// Highlight a specific storage unit by storage ID
eLabSDK2.Inventory.StorageUnit.configureTreeNode({
id: 'highlight-unit-1',
color: '#00a8ff',
icon: 'fas fa-snowflake',
toolTip: 'Primary freezer',
customLabel: (storageUnitId) => `Unit #${storageUnitId}`,
isVisible: (storageLayer) => storageLayer.storageID === 1
});
Example
// Use custom label to show storage ID
eLabSDK2.Inventory.StorageUnit.configureTreeNode({
id: 'capacity-labels',
color: 'green',
icon: 'fas fa-warehouse',
toolTip: 'Storage unit with samples',
customLabel: (storageUnitId) => `Storage ${storageUnitId}`,
isVisible: (storageLayer) => (storageLayer.sampleCount || 0) > 0
});
© 2023 eLabNext
Updated about 3 hours ago