2021-11-07 13:57:24 +01:00
|
|
|
import React from "react";
|
|
|
|
import ReactDOM from "react-dom";
|
2021-11-07 15:45:26 +01:00
|
|
|
import { getMemory } from "../util";
|
2021-11-07 13:57:24 +01:00
|
|
|
|
|
|
|
function Report() {
|
2021-11-07 15:45:26 +01:00
|
|
|
const origin = new URL(document.location.toString()).searchParams.get(
|
|
|
|
"origin"
|
|
|
|
);
|
|
|
|
const clusters = getMemory().getClustersForOrigin(origin);
|
|
|
|
const marked_entries = Object.values(clusters)
|
|
|
|
.map((cluster) => cluster.getMarkedRequests())
|
|
|
|
.reduce((a, b) => a.concat(b), [])
|
|
|
|
.map((request) => request.getMarkedEntries())
|
|
|
|
.reduce((a, b) => a.concat(b), []);
|
2021-11-07 13:57:24 +01:00
|
|
|
return (
|
|
|
|
<div>
|
2021-11-07 15:45:26 +01:00
|
|
|
<h1>Generuj treść maila dla {origin}</h1>
|
|
|
|
<table>
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Adres docelowy</th>
|
|
|
|
<th>Źródło danych</th>
|
|
|
|
<th>Treść danych</th>
|
|
|
|
<th> Klasyfikacja</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
{marked_entries.map((entry) => (
|
|
|
|
<tr>
|
|
|
|
<td>{entry.request.shorthost}</td>
|
|
|
|
<td>
|
|
|
|
{entry.source}:{entry.name}
|
|
|
|
{entry.markedKeys.join(",")}
|
|
|
|
</td>
|
|
|
|
<td>{entry.value}</td>
|
|
|
|
<td>
|
|
|
|
<select>
|
|
|
|
{[
|
|
|
|
["history", "Historia przeglądania"],
|
|
|
|
["id", "Sztucznie nadane id"],
|
|
|
|
].map(([key, name]) => (
|
|
|
|
<option key={key} value={key}>
|
|
|
|
{name}
|
|
|
|
</option>
|
|
|
|
))}
|
|
|
|
</select>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
))}
|
|
|
|
</tbody>
|
|
|
|
</table>
|
2021-11-07 13:57:24 +01:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
ReactDOM.render(<Report />, document.getElementById("app"));
|