Append remediation notes to Jira ticket description in QueuePanel
- Single-item: openCreateJiraFromQueue fetches notes for Remediate items and pre-fills the description with a Remediation Notes section - Multi-item: ConsolidationModal fetches notes for all Remediate items and appends them via appendRemediationNotes utility Previously notes were only integrated in IvantiTodoQueuePage.js but the actual Jira creation flow users interact with is in ReportingPage.js QueuePanel and ConsolidationModal.
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
generateConsolidatedDescription,
|
||||
extractFirstCve,
|
||||
extractCommonVendor,
|
||||
appendRemediationNotes,
|
||||
} from '../utils/jiraConsolidation';
|
||||
|
||||
const API_BASE = process.env.REACT_APP_API_BASE || 'http://localhost:3001/api';
|
||||
@@ -285,9 +286,31 @@ export default function ConsolidationModal({ items, onClose, onSuccess }) {
|
||||
useEffect(() => {
|
||||
if (items.length >= 2) {
|
||||
setSummary(generateConsolidatedSummary(items));
|
||||
setDescription(generateConsolidatedDescription(items));
|
||||
setCveId(extractFirstCve(items));
|
||||
setVendor(extractCommonVendor(items));
|
||||
|
||||
// Build description, appending remediation notes for Remediate items
|
||||
const baseDescription = generateConsolidatedDescription(items);
|
||||
const remediateItems = items.filter(i => i.workflow_type === 'Remediate');
|
||||
if (remediateItems.length > 0) {
|
||||
Promise.all(
|
||||
remediateItems.map(item =>
|
||||
fetch(`${API_BASE}/ivanti/todo-queue/${item.id}/notes`, { credentials: 'include' })
|
||||
.then(r => r.ok ? r.json() : [])
|
||||
.catch(() => [])
|
||||
)
|
||||
).then(results => {
|
||||
const notesMap = {};
|
||||
remediateItems.forEach((item, idx) => {
|
||||
if (results[idx] && results[idx].length > 0) {
|
||||
notesMap[item.id] = results[idx];
|
||||
}
|
||||
});
|
||||
setDescription(appendRemediationNotes(baseDescription, notesMap));
|
||||
});
|
||||
} else {
|
||||
setDescription(baseDescription);
|
||||
}
|
||||
}
|
||||
}, [items]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user