LCOV - code coverage report
Current view: top level - src/renderer/extensions/linearMode - getExecutionStatusMessage.ts Coverage Total Hit
Test: ComfyUI E2E Coverage Lines: 30.8 % 13 4
Test Date: 2026-11-17 04:17:53

            Line data    Source code
       1              : import type { ComfyNodeDefImpl } from '@/core/graph/nodeDef/ComfyNodeDefImpl'
       2              : 
       3              : type ExecutionStatusKey =
       4              :   | 'generating'
       5              :   | 'saving'
       6              :   | 'loading'
       7              :   | 'encoding'
       8              :   | 'decoding'
       9              :   | 'processing'
      10              :   | 'resizing'
      11              :   | 'generatingVideo'
      12              :   | 'processingVideo'
      13              :   | 'training'
      14              : 
      15              : /**
      16              :  * Specific status messages for nodes that can't be matched by PascalCase
      17              :  * identifier patterns (e.g. unconventional naming, spaces).
      18              :  */
      19         2355 : const statusMap: Record<string, ExecutionStatusKey> = {
      20              :   // Video utility nodes with non-standard naming
      21              :   'Video Slice': 'processingVideo',
      22              :   GetVideoComponents: 'processingVideo',
      23              :   CreateVideo: 'processingVideo',
      24              : 
      25              :   // Training
      26              :   TrainLoraNode: 'training'
      27              : }
      28              : 
      29              : /**
      30              :  * Matches a PascalCase identifier within a node type name.
      31              :  */
      32        18840 : function pascalId(...ids: string[]): RegExp {
      33        18840 :   return new RegExp('(?:' + ids.join('|') + ')(?![a-z])')
      34              : }
      35              : 
      36         2355 : const identifierRules: [RegExp, ExecutionStatusKey][] = [
      37              :   [pascalId('Save', 'Preview'), 'saving'],
      38              :   [pascalId('Load', 'Loader'), 'loading'],
      39              :   [pascalId('Encode'), 'encoding'],
      40              :   [pascalId('Decode'), 'decoding'],
      41              :   [pascalId('Compile', 'Conditioning', 'Merge'), 'processing'],
      42              :   [pascalId('Upscale', 'Resize'), 'resizing'],
      43              :   [pascalId('ToVideo'), 'generatingVideo'],
      44              :   [pascalId('Sampler'), 'generating']
      45              : ]
      46              : 
      47            0 : export function getExecutionStatusMessage(
      48              :   t: (key: string) => string,
      49              :   nodeType: string,
      50              :   nodeDef?: ComfyNodeDefImpl | null,
      51              :   properties?: Record<string, unknown>
      52              : ): string | null {
      53            0 :   const customMessage = properties?.['Execution Message']
      54            0 :   if (typeof customMessage === 'string' && customMessage.trim()) {
      55            0 :     return customMessage.trim()
      56              :   }
      57              : 
      58            0 :   if (nodeType in statusMap) return t(`execution.${statusMap[nodeType]}`)
      59              : 
      60            0 :   for (const [pattern, key] of identifierRules) {
      61            0 :     if (pattern.test(nodeType)) return t(`execution.${key}`)
      62              :   }
      63              : 
      64            0 :   if (nodeDef?.api_node) return t('execution.processing')
      65              : 
      66            0 :   return null
      67              : }
        

Generated by: LCOV version 2.0-1