@@ -91,6 +91,6 @@ export function TabShowHostDetails({
);
}
-export function TabSshKeys({ data }: { data: LhpPatrolReport }) {
+export function TabSshKeys({ data }: { data: HostPatrolReport }) {
return
;
}
diff --git a/website/src/components/report/DataLoader.tsx b/website/src/components/report/DataLoader.tsx
index 6716216..bd19f44 100644
--- a/website/src/components/report/DataLoader.tsx
+++ b/website/src/components/report/DataLoader.tsx
@@ -1,10 +1,10 @@
-import { LhpPatrolReport, parseData, saveData } from '@/lib/data';
+import { HostPatrolReport, parseData, saveData } from '@/lib/data';
import { Card, CardBody, CardFooter, CardHeader } from '@nextui-org/card';
import { Divider } from '@nextui-org/divider';
import { ChangeEvent, useState } from 'react';
import { Centered } from '../helpers';
-export function DataLoader({ onLoadData }: { onLoadData: (x: LhpPatrolReport) => void }) {
+export function DataLoader({ onLoadData }: { onLoadData: (x: HostPatrolReport) => void }) {
const [error, setError] = useState
();
const changeHandler = (e: ChangeEvent) => {
diff --git a/website/src/components/report/ShowHostDetails.tsx b/website/src/components/report/ShowHostDetails.tsx
index 01cb439..db51c6d 100644
--- a/website/src/components/report/ShowHostDetails.tsx
+++ b/website/src/components/report/ShowHostDetails.tsx
@@ -1,4 +1,4 @@
-import { LhpHostReport, LhpPatrolReport, SshPublicKey } from '@/lib/data';
+import { HostPatrolReport, HostReport, SshPublicKey } from '@/lib/data';
import {
Card,
CardBody,
@@ -18,7 +18,7 @@ import Link from 'next/link';
import { toast } from 'react-toastify';
import { KVBox } from '../helpers';
-export function ShowHostDetails({ host, data }: { host: LhpHostReport; data: LhpPatrolReport }) {
+export function ShowHostDetails({ host, data }: { host: HostReport; data: HostPatrolReport }) {
return (
@@ -212,7 +212,7 @@ export function ShowHostDetails({ host, data }: { host: LhpHostReport; data: Lhp
);
}
-export function TabulateSshKeys({ host, data }: { host: LhpHostReport; data: LhpPatrolReport }) {
+export function TabulateSshKeys({ host, data }: { host: HostReport; data: HostPatrolReport }) {
const keysKnownGlobal = (data.knownSshKeys || []).reduce(
(acc, x) => ({ ...acc, [`${x.fingerprint}`]: x }),
{} as Record
diff --git a/website/src/components/report/Sidebar.tsx b/website/src/components/report/Sidebar.tsx
index 5aa3cb1..9858b11 100644
--- a/website/src/components/report/Sidebar.tsx
+++ b/website/src/components/report/Sidebar.tsx
@@ -1,11 +1,11 @@
-import { LhpHostReport } from '@/lib/data';
+import { HostReport } from '@/lib/data';
import { Listbox, ListboxItem } from '@nextui-org/listbox';
import Image from 'next/image';
import { getCloudIconName } from './helpers';
export interface SidebarProps {
- data: LhpHostReport[];
- onHostSelect: (host: LhpHostReport) => void;
+ data: HostReport[];
+ onHostSelect: (host: HostReport) => void;
}
export function Sidebar({ data, onHostSelect }: SidebarProps) {
diff --git a/website/src/components/report/TabOverview.tsx b/website/src/components/report/TabOverview.tsx
index aac1059..b4734b0 100644
--- a/website/src/components/report/TabOverview.tsx
+++ b/website/src/components/report/TabOverview.tsx
@@ -1,7 +1,7 @@
-import { LhpPatrolReport, buildSshKeysTable } from '@/lib/data';
+import { HostPatrolReport, buildSshKeysTable } from '@/lib/data';
import { SimpleBarChart, histogram } from '../helpers';
-export function TabOverview({ data }: { data: LhpPatrolReport }) {
+export function TabOverview({ data }: { data: HostPatrolReport }) {
const sshkeys = Object.values(buildSshKeysTable(data));
return (
diff --git a/website/src/components/report/TabulateHosts.tsx b/website/src/components/report/TabulateHosts.tsx
index b4c9c86..2e87839 100644
--- a/website/src/components/report/TabulateHosts.tsx
+++ b/website/src/components/report/TabulateHosts.tsx
@@ -1,4 +1,4 @@
-import { LhpHostReport } from '@/lib/data';
+import { HostReport } from '@/lib/data';
import { Chip } from '@nextui-org/chip';
import { Radio, RadioGroup, Select, SelectItem, Selection, Slider } from '@nextui-org/react';
import { Table, TableBody, TableCell, TableColumn, TableHeader, TableRow } from '@nextui-org/table';
@@ -11,11 +11,11 @@ export function TabulateHosts({
hosts,
onHostSelect,
}: {
- hosts: LhpHostReport[];
- onHostSelect: (host: LhpHostReport) => void;
+ hosts: HostReport[];
+ onHostSelect: (host: HostReport) => void;
}) {
- const [filters, setFilters] = useState boolean>>({});
- const [filteredHosts, setFilteredHosts] = useState(hosts);
+ const [filters, setFilters] = useState boolean>>({});
+ const [filteredHosts, setFilteredHosts] = useState(hosts);
useEffect(() => {
setFilteredHosts(hosts.filter((host) => Object.values(filters).reduce((acc, f) => acc && f(host), true)));
diff --git a/website/src/components/report/index.tsx b/website/src/components/report/index.tsx
index 0e27e1f..9d54ada 100644
--- a/website/src/components/report/index.tsx
+++ b/website/src/components/report/index.tsx
@@ -1,6 +1,6 @@
'use client';
-import { LhpPatrolReport, deleteData, loadData } from '@/lib/data';
+import { HostPatrolReport, deleteData, loadData } from '@/lib/data';
import { Just, Maybe, Nothing } from 'purify-ts/Maybe';
import { useEffect, useState } from 'react';
import { BigSpinner } from '../helpers';
@@ -8,7 +8,7 @@ import { App } from './App';
import { DataLoader } from './DataLoader';
export function Report() {
- const [data, setAppData] = useState>>(Nothing);
+ const [data, setAppData] = useState>>(Nothing);
useEffect(() => {
loadData().caseOf({
diff --git a/website/src/lib/data.ts b/website/src/lib/data.ts
index f243890..018d5fb 100644
--- a/website/src/lib/data.ts
+++ b/website/src/lib/data.ts
@@ -4,7 +4,7 @@ import { FromSchema } from 'json-schema-to-ts';
import { Either, Left, Right } from 'purify-ts/Either';
import { Just, Maybe, Nothing } from 'purify-ts/Maybe';
-export const LHP_PATROL_REPORT_SCHEMA = {
+export const HOSTPATROL_REPORT_SCHEMA = {
$comment: 'Host Patrol Report\nReport',
properties: {
hosts: {
@@ -262,22 +262,22 @@ export const LHP_PATROL_REPORT_SCHEMA = {
type: 'object',
} as const satisfies JSONSchema;
-export type LhpPatrolReport = FromSchema;
+export type HostPatrolReport = FromSchema;
export type ArrayElement = ArrayType extends readonly (infer ElementType)[]
? ElementType
: never;
-export type LhpHostReport = ArrayElement;
-export type SshPublicKey = ArrayElement;
+export type HostReport = ArrayElement;
+export type SshPublicKey = ArrayElement;
const AJV = new Ajv();
-const LHP_PATROL_REPORT_VALIDATOR = AJV.compile(LHP_PATROL_REPORT_SCHEMA);
+const HOSTPATROL_REPORT_VALIDATOR = AJV.compile(HOSTPATROL_REPORT_SCHEMA);
-const _LOCAL_STORAGE_KEY_DATA = 'LHP_DATA';
+const _LOCAL_STORAGE_KEY_DATA = 'HOSTPATROL_DATA';
-export function loadData(): Either> {
+export function loadData(): Either> {
const data = localStorage.getItem(_LOCAL_STORAGE_KEY_DATA);
if (data === null) {
@@ -287,14 +287,14 @@ export function loadData(): Either> {
return parseData(data).map(Just);
}
-export function parseData(data: string): Either {
+export function parseData(data: string): Either {
try {
const parsed = JSON.parse(data);
- const result = LHP_PATROL_REPORT_VALIDATOR(parsed);
+ const result = HOSTPATROL_REPORT_VALIDATOR(parsed);
if (!result) {
- console.error(LHP_PATROL_REPORT_VALIDATOR.errors);
- return Left('Invalid lhp patrol report object.');
+ console.error(HOSTPATROL_REPORT_VALIDATOR.errors);
+ return Left('Invalid Host Patrol report object.');
}
return Right(parsed);
@@ -303,7 +303,7 @@ export function parseData(data: string): Either {
}
}
-export function saveData(x: LhpPatrolReport): void {
+export function saveData(x: HostPatrolReport): void {
localStorage.setItem(_LOCAL_STORAGE_KEY_DATA, JSON.stringify(x));
}
@@ -315,13 +315,13 @@ export type SshKeysTable = Record;
export interface SshKeysTableRecord {
key: SshPublicKey;
- seenHosts: Set;
+ seenHosts: Set;
seenComments: Set;
isKnown: boolean;
knownComment: string;
}
-export function buildSshKeysTable(data: LhpPatrolReport): SshKeysTable {
+export function buildSshKeysTable(data: HostPatrolReport): SshKeysTable {
// Initialize the return value:
const keys: SshKeysTable = {};