File size: 10,409 Bytes
1392287 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
<!DOCTYPE html>
<html lang="fr" data-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Requirements Extractor</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/full.css" rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body class="p-8 bg-base-100">
<div class="container mx-auto">
<h1 class="text-4xl font-bold text-center mb-8">Requirements Extractor</h1>
<div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
<select class="select select-bordered" id="workingGroupSelect">
<option disabled selected value="">Working Group</option>
<option>SA1</option>
<option>SA2</option>
<option>SA3</option>
<option>SA4</option>
<option>SA5</option>
<option>SA6</option>
<option>CT1</option>
<option>CT2</option>
<option>CT3</option>
<option>CT4</option>
<option>CT5</option>
<option>CT6</option>
</select>
<select class="select select-bordered" id="meetingSelect" disabled>
<option disabled selected value="">Select a working group</option>
</select>
<button class="btn" id="getTDocs">Get TDocs</button>
</div>
</div>
<div class="hidden" id="filters">
<div class="grid grid-cols-1 md:grid-cols-3 gap-4 mb-6">
<select class="select select-bordered" id="docType">
<option disabled selected value="">Type</option>
<option>Tous</option>
</select>
<select class="select select-bordered" id="docStatus">
<option disabled selected value="">Status</option>
<option>Tous</option>
</select>
<select class="select select-bordered" id="agendaItem">
<option disabled selected value = "">Agenda</option>
<option>Tous</option>
</select>
</div>
</div>
<!-- Tableau des données -->
<div class="max-h-[65vh] overflow-y-auto">
<table class="table table-zebra w-full" id="dataFrame">
<thead class="sticky top-0 bg-base-200 z-10">
<tr class="bg-base-200">
<th>TDoc</th>
<th>Title</th>
<th>Type</th>
<th>Status</th>
<th>Agenda Item N°</th>
<th>URL</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<center><button class="btn mt-6 gap-4" id="getReqs">Get Requirements</button></center>
</div>
<script>
function getDataFrame(){
const wg = document.getElementById('workingGroupSelect').value;
const meeting = document.getElementById('meetingSelect').value;
document.getElementById('docType').innerHTML = `
<option disabled selected value="">Type</option>
<option>Tous</option>
`
document.getElementById('docStatus').innerHTML = `
<option disabled selected value="">Type</option>
<option>Tous</option>
`
document.getElementById('agendaItem').innerHTML = `
<option disabled selected value="">Type</option>
<option>Tous</option>
`
const dataFrame = document.getElementById("dataFrame");
document.getElementById("getTDocs").setAttribute('disabled', 'true')
document.getElementById("getTDocs").innerHTML = "Loading ...";
fetch("/get_dataframe", {method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify({"working_group": wg, "meeting": meeting})})
.then(resp => resp.json())
.then(data => {
document.getElementById("filters").classList.remove("hidden")
const dataframeBody = dataFrame.querySelector("tbody");
dataframeBody.innerHTML = "";
const setType = new Set();
const setAgenda = new Set();
const setStatus = new Set();
data.data.forEach(row => {
const tr = document.createElement("tr");
tr.setAttribute("data-type", row['Type']);
tr.setAttribute("data-status", row["TDoc Status"]);
tr.setAttribute("data-agenda", row["Agenda item description"]);
tr.innerHTML = `
<td>${row["TDoc"]}</td>
<td>${row["Title"]}</td>
<td>${row["Type"]}</td>
<td>${row["TDoc Status"]}</td>
<td>${row["Agenda item description"]}</td>
<td>
<a href="${row["URL"]}" class="link">${row["URL"]}</a>
</td>
`;
dataframeBody.appendChild(tr);
setType.add(row["Type"]);
setAgenda.add(row["Agenda item description"]);
setStatus.add(row["TDoc Status"]);
})
setType.forEach(tdoctype => {
const option = document.createElement("option");
option.textContent = tdoctype;
option.value = tdoctype;
document.getElementById('docType').appendChild(option);
})
setAgenda.forEach(agenda => {
const option = document.createElement("option");
option.textContent = agenda;
option.value = agenda;
document.getElementById('agendaItem').appendChild(option);
})
setStatus.forEach(status => {
const option = document.createElement("option");
option.textContent = status;
option.value = status;
document.getElementById('docStatus').appendChild(option);
})
})
document.getElementById("getTDocs").removeAttribute("disabled")
document.getElementById("getTDocs").innerHTML = "Get TDocs";
}
function filterTable() {
const type = document.getElementById('docType').value
const status = document.getElementById('docStatus').value
const agenda = document.getElementById('agendaItem').value
document.querySelectorAll('#dataFrame tbody tr').forEach(row => {
const showRow =
(type === 'Tous' || row.dataset.type === type || type === "") &&
(status === 'Tous' || row.dataset.status === status || status === "") &&
(agenda === 'Tous' || row.dataset.agenda === agenda || agenda === "")
row.style.display = showRow ? '' : 'none'
})
}
function getMeetings(){
const workingGroup = document.getElementById("workingGroupSelect").value;
document.getElementById("meetingSelect").setAttribute('disabled', 'true')
document.getElementById("meetingSelect").innerHTML = "<option>Loading...</option>"
document.getElementById("getTDocs").setAttribute('disabled', 'true')
fetch("/get_meetings", {method: "POST", headers: {"Content-Type": "application/json"}, body: JSON.stringify({"working_group": workingGroup})})
.then(resp => resp.json())
.then(data => {
document.getElementById("meetingSelect").innerHTML = "";
document.getElementById("meetingSelect").removeAttribute("disabled");
document.getElementById("getTDocs").removeAttribute("disabled")
for(const [key, value] of Object.entries(data.meetings)){
const option = document.createElement("option");
option.textContent = key;
option.value = value;
document.getElementById('meetingSelect').appendChild(option);
}
})
}
function tableToGenBody(tableSelector) {
// columnsMap : { "NomHeaderDansTable": "nom_voulu", ... }
let columnsMap = {"TDoc": "doc_id", "URL": "url"};
const table = document.querySelector(tableSelector);
const headers = Array.from(table.querySelectorAll('thead th')).map(th => th.innerText.trim());
// Indices des colonnes à extraire
const selectedIndices = headers
.map((header, idx) => columnsMap[header] ? idx : -1)
.filter(idx => idx !== -1);
return Array.from(table.querySelectorAll('tbody tr'))
.filter(row => getComputedStyle(row).display !== 'none')
.map(row => {
const cells = Array.from(row.querySelectorAll('td'));
const obj = {};
selectedIndices.forEach(idx => {
const originalHeader = headers[idx];
const newKey = columnsMap[originalHeader];
obj[newKey] = cells[idx].innerText.trim();
});
return obj;
});
}
// Écouteurs d'événements pour les filtres
document.getElementById('docType').addEventListener('change', filterTable)
document.getElementById('docStatus').addEventListener('change', filterTable)
document.getElementById('agendaItem').addEventListener('change', filterTable)
document.getElementById("workingGroupSelect").addEventListener('change', getMeetings)
document.getElementById('getTDocs').addEventListener('click', getDataFrame)
</script>
</body>
</html>
|