diff --git a/plugins/ms-ai-architect/playground/ms-ai-architect-playground.html b/plugins/ms-ai-architect/playground/ms-ai-architect-playground.html index cc49acd..4e566ad 100644 --- a/plugins/ms-ai-architect/playground/ms-ai-architect-playground.html +++ b/plugins/ms-ai-architect/playground/ms-ai-architect-playground.html @@ -3040,6 +3040,7 @@ } function renderRequirements(data, slot) { + const items = data.items || []; const sevForStatus = function (status) { const s = (status || '').toLowerCase(); if (s === 'met') return 'low'; @@ -3047,23 +3048,58 @@ if (s === 'missing') return 'critical'; return 'info'; }; - const items = (data.items || []).map(function (it, idx) { - return '
  • ' + - '' + - 'R-' + String(idx + 1).padStart(2, '0') + '' + - '' + escapeHtml(it.requirement) + '' + - 'Kilde: ' + escapeHtml(it.source_article || '—') + ' · Status: ' + escapeHtml(it.status || '—') + '' + - '
  • '; - }).join(''); - slot.innerHTML = - '
    ' + - '
    ' + - '
    ' + - '
    Krav' + (data.items || []).length + '
    ' + - '
      ' + items + '
    ' + - '
    ' + - '
    ' + - '
    '; + const dominantStatus = function (group) { + if (group.some(function (it) { return /missing/i.test(it.status); })) return 'missing'; + if (group.some(function (it) { return /partial/i.test(it.status); })) return 'partial'; + return 'met'; + }; + + // Group by source_article (Art. X) for scenario-card-grid. + const groups = {}; + items.forEach(function (it) { + const key = it.source_article || 'Andre'; + if (!groups[key]) groups[key] = []; + groups[key].push(it); + }); + const groupKeys = Object.keys(groups).sort(); + const cardsHtml = groupKeys.length ? '
    ' + groupKeys.map(function (k) { + const group = groups[k]; + const status = dominantStatus(group); + return '
    ' + + '
    ' + + '' + escapeHtml(k) + '' + + '' + group.length + ' krav' + + '
    ' + + '

    ' + escapeHtml(group[0].requirement) + (group.length > 1 ? ' (+' + (group.length - 1) + ')' : '') + '

    ' + + '
    '; + }).join('') + '
    ' : ''; + + const expansionsHtml = items.length ? items.map(function (it, idx) { + const sev = sevForStatus(it.status); + return ''; + }).join('') : ''; + + const body = cardsHtml + (expansionsHtml ? '
    ' + expansionsHtml + '
    ' : ''); + slot.innerHTML = renderPageShell({ + eyebrow: 'KRAV', + title: data.title || 'AI Act-krav per risiko og rolle', + lede: data.lede || 'Konkrete forpliktelser gruppert etter Art-paragraf med detaljer per krav.', + verdict: data.verdict || inferVerdict(data, 'requirements-list'), + keyStats: data.keyStats || inferKeyStats(data, 'requirements-list') + }, body); } function renderTransparency(data, slot) {