fix #493: add effective access matrix

This commit is contained in:
devmrko
2026-06-26 14:14:22 +09:00
parent 210e0bd4d0
commit c8326f954d
12 changed files with 805 additions and 0 deletions

View File

@@ -486,6 +486,38 @@ function initTokenContextPreviews() {
});
}
function filterEffectiveMatrixTable(select) {
const table = document.getElementById(select.dataset.effectiveFilter || '');
if (!table) {
return;
}
const value = select.value || '';
table.querySelectorAll('.effective-empty-row').forEach((row) => row.remove());
let visibleRows = 0;
table.querySelectorAll('tbody tr[data-effective-id]').forEach((row) => {
const visible = !value || row.dataset.effectiveId === value;
row.hidden = !visible;
if (visible) {
visibleRows += 1;
}
});
if (value && visibleRows === 0) {
const body = table.querySelector('tbody');
const columnCount = table.querySelectorAll('thead th').length || 1;
const row = document.createElement('tr');
row.className = 'effective-empty-row';
row.innerHTML = `<td colspan="${columnCount}" class="text-muted">${table.dataset.emptyMessage || '선택한 항목이 없습니다.'}</td>`;
body?.appendChild(row);
}
}
function initEffectiveMatrixFilters() {
document.querySelectorAll('[data-effective-filter]').forEach((select) => {
select.addEventListener('change', () => filterEffectiveMatrixTable(select));
filterEffectiveMatrixTable(select);
});
}
function sqlLiteral(value) {
return `'${String(value || '').replaceAll("'", "''")}'`;
}
@@ -791,6 +823,7 @@ document.addEventListener('DOMContentLoaded', () => {
filterGroupDetail(select.id);
});
initTokenContextPreviews();
initEffectiveMatrixFilters();
const objectSelect = document.querySelector('select[name="objectRef"]');
if (objectSelect) {
objectSelect.addEventListener('change', () => {