diff --git a/BACKEND/app/ultils/templates/show_inventory.ts b/BACKEND/app/ultils/templates/show_inventory.ts index b412a5e..8b39708 100644 --- a/BACKEND/app/ultils/templates/show_inventory.ts +++ b/BACKEND/app/ultils/templates/show_inventory.ts @@ -124,7 +124,15 @@ const parseLog = (data: string) => { records = [firstRecord] } } - return records + return records.sort((a: any, b: any) => { + const getScore = (item: any) => { + if (item?.name?.toLowerCase().includes('stack')) return 100 + if (!item.pid) return 100 + return 0 + } + + return getScore(a) - getScore(b) + }) } export default parseLog diff --git a/BACKEND/app/ultils/templates/show_version.ts b/BACKEND/app/ultils/templates/show_version.ts index ea723ab..d1dedae 100644 --- a/BACKEND/app/ultils/templates/show_version.ts +++ b/BACKEND/app/ultils/templates/show_version.ts @@ -3,10 +3,11 @@ import XRegExp from 'xregexp' // Parser function const parseLog = (data: string) => { const patterns = [ - // 1. Software Image & Version + XRegExp('^.*Software.*\\((?\\S+)\\),\\s+Version\\s+(?[\\w\\.-]+)'), XRegExp( - '^.*Software.*\\((?\\S+)\\),\\s+Version\\s+(?.+?),\\s+RELEASE.*\\((?\\S+)\\)' + '^\\*?\\s*\\d+\\s+\\d+\\s+[\\w-]+\\s+(?\\d[\\w\\.-]+)\\s+(?[\\w-]+)\\s+(?:BUNDLE|INSTALL)' ), + XRegExp('System\\s+image\\s+file\\s+is\\s+"(?:[^:]*:)?(?[^"]+)"'), XRegExp('Active-image:\\s+(?\\S+)'), XRegExp('Version:\\s+(?\\S+)'), XRegExp('^ROM:\\s+(?\\S+)'),