eLabSDK2.Inventory.Equipment

Hierarchy

Methods

addTreeNodeAddition

Static addTreeNodeAddition(nodeContent): Promise<unknown>

Add custom HTML content to equipment nodes in the inventory tree navigator.

This allows you to inject additional content (HTML) that will be rendered
alongside equipment nodes 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, or other contextual
information to equipment nodes.

Parameters

NameTypeDescription
nodeContentTreeNodeAddition{ id: string, html: string, toolTip: string, isVisible?: (storageLayer: StorageLayerDetail) => boolean }

Returns

Promise<unknown>

Example

// Add a status badge to all equipment nodes
eLabSDK2.Inventory.Equipment.addTreeNodeAddition({
  id: 'status-badge',
  html: '<span class="badge badge-success">Active</span>',
  toolTip: 'Equipment status badge',
  isVisible: (storageLayer) => true
});

Example

// Add a calibration warning icon to specific equipment
eLabSDK2.Inventory.Equipment.addTreeNodeAddition({
  id: 'calibration-warning',
  html: '<i class="fas fa-exclamation-triangle text-warning"></i>',
  toolTip: 'Calibration due - please schedule maintenance',
  isVisible: (storageLayer) => {
    // Check if equipment associated with this storage layer needs calibration
    return storageLayer.equipmentDueForCalibration === true;
  }
});

Example

// Add equipment count information
eLabSDK2.Inventory.Equipment.addTreeNodeAddition({
  id: 'item-count',
  html: '<span class="item-count">5 items</span>',
  toolTip: 'Number of items stored in this equipment',
  isVisible: (storageLayer) => (storageLayer.sampleCount || 0) > 0
});

configureTreeNode

Static configureTreeNode(nodeConfiguration): Promise<unknown>

Customize the visual appearance and behavior of equipment nodes in the inventory tree navigator.

This allows you to override the default rendering of equipment nodes by customizing
their color, icon, tooltip, and label. You can apply these customizations globally
to all equipment nodes or conditionally to specific nodes using the isVisible function.
This is useful for visually distinguishing different types of equipment, indicating
status, or highlighting equipment that requires attention.

Parameters

NameTypeDescription
nodeConfigurationTreeNodeConfiguration{ id: string, color: string, icon: string, toolTip: string, customLabel?: (equipmentId: number) => string, isVisible?: (storageLayer: StorageLayerDetail) => boolean }

Returns

Promise<unknown>

Example

// Apply red color and warning icon to all equipment nodes
eLabSDK2.Inventory.Equipment.configureTreeNode({
  id: 'equipment-warning',
  color: 'red',
  icon: 'fas fa-exclamation-triangle',
  toolTip: 'Equipment requires attention',
  isVisible: (storageLayer) => true
});

Example

// Apply custom styling only to specific equipment by storage ID
eLabSDK2.Inventory.Equipment.configureTreeNode({
  id: 'special-equipment',
  color: '#00a8ff',
  icon: 'fas fa-star',
  toolTip: 'Premium equipment',
  customLabel: (equipmentId) => `Equipment #${equipmentId}`,
  isVisible: (storageLayer) => storageLayer.storageID === 1
});

Example

// Use custom label function to show additional information
eLabSDK2.Inventory.Equipment.configureTreeNode({
  id: 'equipment-with-samples',
  color: 'green',
  icon: 'fas fa-flask',
  toolTip: 'Laboratory equipment',
  customLabel: (equipmentId) => `Equipment ${equipmentId}`,
  isVisible: (storageLayer) => (storageLayer.sampleCount || 0) > 0
});

Example

// Highlight equipment based on storage layer properties
eLabSDK2.Inventory.Equipment.configureTreeNode({
  id: 'needs-attention',
  color: 'orange',
  icon: 'fas fa-wrench',
  toolTip: 'Maintenance required',
  isVisible: (storageLayer) => storageLayer.maintenanceRequired === true
});

© 2023 eLabNext