eLabSDK2.Inventory.StorageLayer
Hierarchy
-
↳
StorageLayer
Methods
addTreeNodeAddition
Static addTreeNodeAddition(nodeContent): Promise<unknown>
Add custom HTML content to storage layer nodes in the inventory tree navigator.
This allows you to inject additional content (HTML) that will be rendered alongside
storage layer nodes (compartments within storage units like shelves, drawers, or boxes)
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, or other contextual details to storage layer nodes.
Parameters
| Name | Type | Description |
|---|---|---|
nodeContent | TreeNodeAddition | { id: string, html: string, toolTip: string, isVisible?: (storageLayer: StorageLayerDetail) => boolean } |
Returns
Promise<unknown>
Example
// Add capacity indicator to storage layer nodes
eLabSDK2.Inventory.StorageLayer.addTreeNodeAddition({
id: 'capacity-indicator',
html: '<span class="badge badge-info">Full</span>',
toolTip: 'Storage layer is at capacity',
isVisible: (storageLayer) => {
if (!storageLayer.capacity) return false;
return storageLayer.occupiedPositions >= storageLayer.capacity;
}
});
Example
// Add warning for storage layers needing attention
eLabSDK2.Inventory.StorageLayer.addTreeNodeAddition({
id: 'attention-warning',
html: '<i class="fas fa-exclamation-triangle text-warning"></i>',
toolTip: 'Storage layer requires attention',
isVisible: (storageLayer) => storageLayer.requiresAttention === true
});
configureTreeNode
Static configureTreeNode(nodeConfiguration): Promise<unknown>
Customize the visual appearance and behavior of storage layer nodes in the inventory tree navigator.
This allows you to override the default rendering of storage layer nodes (compartments like
shelves, drawers, or boxes) by customizing their color, icon, tooltip, and label. You can
apply these customizations globally to all storage layer nodes or conditionally to specific
nodes using the isVisible function. This is useful for visually distinguishing different
types of storage layers, indicating capacity status, or highlighting layers that need attention.
Parameters
| Name | Type | Description |
|---|---|---|
nodeConfiguration | TreeNodeConfiguration | { id: string, color: string, icon: string, toolTip: string, customLabel?: (storageLayerId: number) => string, isVisible?: (storageLayer: StorageLayerDetail) => boolean } |
Returns
Promise<unknown>
Example
// Apply red color to all storage layer nodes
eLabSDK2.Inventory.StorageLayer.configureTreeNode({
id: 'all-layers-red',
color: 'red',
icon: 'fas fa-box',
toolTip: 'Storage compartment',
isVisible: (storageLayer) => true
});
Example
// Highlight a specific storage layer by ID
eLabSDK2.Inventory.StorageLayer.configureTreeNode({
id: 'highlight-layer-1',
color: '#00a8ff',
icon: 'fas fa-star',
toolTip: 'Premium storage',
customLabel: (storageLayerId) => `Layer #${storageLayerId}`,
isVisible: (storageLayer) => storageLayer.storageLayerID === 1
});
Example
// Use custom label to show layer ID
eLabSDK2.Inventory.StorageLayer.configureTreeNode({
id: 'capacity-labels',
color: 'green',
icon: 'fas fa-layer-group',
toolTip: 'Storage layer with samples',
customLabel: (storageLayerId) => `Layer ${storageLayerId}`,
isVisible: (storageLayer) => (storageLayer.sampleCount || 0) > 0
});
getActiveStorageLayerID
Static getActiveStorageLayerID(): number
Get the storage layer ID of the currently active (selected) storage layer.
This retrieves the unique identifier for the storage layer that is currently selected
in the inventory browser. Storage layers are compartments within storage units, such as
shelves in a freezer, drawers in a cabinet, or positions in a box. Use this to identify
which storage layer the user is viewing or interacting with.
Returns
number
The numeric storage layer ID if one is selected, or null if no storage layer is active.
Example
// Get the current storage layer ID
const layerId = eLabSDK2.Inventory.StorageLayer.getActiveStorageLayerID();
if (layerId) {
console.log(`Currently viewing storage layer: ${layerId}`);
}
Example
// Use in a custom action
eLabSDK2.Inventory.StorageLayer.StorageLayerDetail.registerAction({
id: 'export-layer-contents',
label: 'Export Contents',
onClick: () => {
const layerId = eLabSDK2.Inventory.StorageLayer.getActiveStorageLayerID();
if (layerId) {
exportStorageLayerContents(layerId);
}
}
});
getSelectedStorageLayers
Static getSelectedStorageLayers(): number[]
Get the IDs of all currently selected storage layers in the inventory browser.
This retrieves an array of storage layer IDs for all storage layers that the user has
selected (checked) in the inventory browser. Storage layers are compartments within
storage units like shelves, drawers, or positions. Use this for bulk operations on
multiple storage layers, such as moving contents, updating properties, or generating
reports. Returns an empty array if no storage layers are selected.
Returns
number[]
An array of numeric storage layer IDs for all currently selected storage layers.
Example
// Get selected storage layer IDs and log count
const selectedIds = eLabSDK2.Inventory.StorageLayer.getSelectedStorageLayers();
console.log(`${selectedIds.length} storage layers selected`);
console.log('IDs:', selectedIds);
Example
// Perform bulk operation on selected layers
const layerIds = eLabSDK2.Inventory.StorageLayer.getSelectedStorageLayers();
if (layerIds.length > 0) {
await updateStorageLayerProperties(layerIds, { status: 'MAINTENANCE' });
eLabSDK2.UI.Toast.showToast(`${layerIds.length} layers updated`, 2000);
}
Example
// Check selection before performing action
eLabSDK2.Inventory.StorageLayer.StorageLayerDetail.registerBulkAction({
id: 'export-selected',
label: 'Export Selected',
onClick: () => {
const selected = eLabSDK2.Inventory.StorageLayer.getSelectedStorageLayers();
if (selected.length === 0) {
eLabSDK2.UI.Toast.showToast('Please select at least one storage layer');
return;
}
exportStorageLayers(selected);
}
});
getStorageIconUrl
Static getStorageIconUrl(storageTypeName): `/media/images/elab_icons/vector/triz/${string}` | `/media/images/elab_icons/vector/triz/dark/${string}`
Get the icon URL for a given storage type or equipment type name.
This returns the file path to the SVG icon representing the specified storage or equipment
type. Icons are automatically themed based on the current UI theme (light/dark). Use this
to display consistent icons for storage types (freezers, fridges, shelves, etc.) or
equipment types (microscopes, centrifuges, incubators, etc.) in custom interfaces.
Parameters
| Name | Type | Description |
|---|---|---|
storageTypeName | string | The name of the storage or equipment type (e.g., 'Freezer20', 'Microscope', 'Sample Box'). |
Returns
`/media/images/elab_icons/vector/triz/${string}` | `/media/images/elab_icons/vector/triz/dark/${string}`
The URL path to the SVG icon file, automatically adjusted for the current theme (light or dark).
Example
// Get icon for a freezer
const iconUrl = eLabSDK2.Inventory.StorageLayer.getStorageIconUrl('Freezer20');
console.log(iconUrl); // "/media/images/elab_icons/vector/triz/-20 freezer.svg"
Example
// Display storage type icon in custom UI
const storageType = 'Microscope';
const iconUrl = eLabSDK2.Inventory.StorageLayer.getStorageIconUrl(storageType);
const img = document.createElement('img');
img.src = iconUrl;
img.alt = storageType;
document.getElementById('storage-icon').appendChild(img);
Example
// Use in custom storage visualization
const storageTypes = ['Fridge', 'Freezer80', 'Shelf', 'Sample Box'];
storageTypes.forEach(type => {
const iconUrl = eLabSDK2.Inventory.StorageLayer.getStorageIconUrl(type);
renderStorageCard(type, iconUrl);
});
© 2023 eLabNext
Updated about 3 hours ago