feat: improve SAC UI layout, reports state, and hosts sorting
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -75,13 +75,16 @@ const page = ref(1);
|
||||
const pageSize = 30;
|
||||
const hostname = ref("");
|
||||
const reportType = ref("report.daily.ssh");
|
||||
const REPORT_TYPE_KEY = "sac_reports_type";
|
||||
|
||||
function formatDt(iso: string) {
|
||||
return new Date(iso).toLocaleString("ru-RU");
|
||||
}
|
||||
|
||||
function openReport(id: number) {
|
||||
router.push({ path: `/events/${id}`, query: { from: "reports" } });
|
||||
const query: Record<string, string> = { from: "reports", type: reportType.value };
|
||||
if (hostname.value.trim()) query.hostname = hostname.value.trim();
|
||||
router.push({ path: `/events/${id}`, query });
|
||||
}
|
||||
|
||||
async function load(p: number) {
|
||||
@@ -110,7 +113,14 @@ onMounted(() => {
|
||||
const h = route.query.hostname;
|
||||
if (typeof h === "string" && h) hostname.value = h;
|
||||
const t = route.query.type;
|
||||
if (typeof t === "string" && t) reportType.value = t;
|
||||
if (typeof t === "string" && t) {
|
||||
reportType.value = t;
|
||||
} else {
|
||||
const savedType = localStorage.getItem(REPORT_TYPE_KEY);
|
||||
if (savedType === "report.daily.ssh" || savedType === "report.daily.rdp") {
|
||||
reportType.value = savedType;
|
||||
}
|
||||
}
|
||||
load(1);
|
||||
});
|
||||
|
||||
@@ -123,4 +133,8 @@ watch(
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
watch(reportType, (value) => {
|
||||
localStorage.setItem(REPORT_TYPE_KEY, value);
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user