add os and category labels to details and conversion slack blocks

This commit is contained in:
Charlotte Croce 2025-04-19 14:02:30 -04:00
parent b329988c38
commit ad6b108d3f
5 changed files with 84 additions and 27 deletions

View file

@ -78,12 +78,25 @@ const getSearchResultBlocks = (keyword, results, pagination = {}) => {
const ruleId = safeRule.id || 'unknown';
logger.debug(`${FILE_NAME}: Adding result #${index + 1}: ${ruleId} - ${safeRule.title || 'Untitled'}`);
// Combine rule information and action button into a single line
// Get OS emoji based on product
const getOsEmoji = (product) => {
if (!product) return '';
const productLower = product.toLowerCase();
if (productLower.includes('windows')) return ':window: ';
if (productLower.includes('mac') || productLower.includes('apple')) return ':apple: ';
if (productLower.includes('linux')) return ':penguin: ';
return '';
};
const osEmoji = getOsEmoji(safeRule.logsource && safeRule.logsource.product);
// Rule information and action button - with OS emoji before title and no ID field
blocks.push({
"type": "section",
"text": {
"type": "mrkdwn",
"text": `*${safeRule.title || 'Untitled Rule'}*\nID: \`${ruleId}\``
"text": `*${osEmoji}${safeRule.title || 'Untitled Rule'}*`
},
"accessory": {
"type": "button",