diff --git a/.changeset/nice-walls-glow.md b/.changeset/nice-walls-glow.md new file mode 100644 index 000000000..e3462b08a --- /dev/null +++ b/.changeset/nice-walls-glow.md @@ -0,0 +1,7 @@ +--- +'@siafoundation/hostd-js': minor +'@siafoundation/hostd-react': minor +'@siafoundation/hostd-types': minor +--- + +Remove logs search API. diff --git a/apps/hostd/components/Node/Logs.tsx b/apps/hostd/components/Node/Logs.tsx deleted file mode 100644 index fde74e77b..000000000 --- a/apps/hostd/components/Node/Logs.tsx +++ /dev/null @@ -1,122 +0,0 @@ -import { - Codeblock, - Heading, - Panel, - Skeleton, - Text, - useDatasetEmptyState, -} from '@siafoundation/design-system' -import { useLogsSearch } from '@siafoundation/hostd-react' -import { humanDate } from '@siafoundation/units' -import { cx } from 'class-variance-authority' -import { times } from '@technically/lodash' - -const filters = [] - -export function Logs() { - const logs = useLogsSearch({ - payload: { - levels: ['info'], - limit: 100, - }, - }) - - const loadingState = useDatasetEmptyState( - logs.data?.entries, - logs.isValidating, - logs.error, - filters - ) - - return ( - -
-
- - Logs - -
-
-
- {loadingState === 'noneYet' && ( -
- - No logs yet. - -
- )} - {loadingState === 'error' && ( -
- - {logs.error.message} - -
- )} - {loadingState === 'loading' && } - {!loadingState && - logs.data.entries.map((e) => ( -
-
- {e.name} - - {humanDate(e.timestamp, { timeStyle: 'medium' })} - -
- {e.message} - {e.caller} - - {JSON.stringify(e.fields, null, 2)} - -
- ))} -
-
- - ) -} - -export function EntityListSkeleton() { - return ( - <> - {times(10, (i) => ( -
-
-
- - -
- - -
-
- ))} - - ) -} - -export function itemBorderStyles() { - return cx( - 'border-t border-gray-200 dark:border-graydark-300', - 'first:border-none' - ) -} diff --git a/libs/hostd-js/src/api.ts b/libs/hostd-js/src/api.ts index e8b97b364..15ec8b2fb 100644 --- a/libs/hostd-js/src/api.ts +++ b/libs/hostd-js/src/api.ts @@ -20,9 +20,6 @@ import { IndexTipParams, IndexTipPayload, IndexTipResponse, - LogsSearchParams, - LogsSearchPayload, - LogsSearchResponse, MetricsParams, MetricsPayload, MetricsPeriodParams, @@ -99,7 +96,6 @@ import { contractsIdIntegrityRoute, contractsRoute, indexTipRoute, - logEntriesRoute, metricsIntervalRoute, metricsRoute, settingsAnnounceRoute, @@ -264,11 +260,6 @@ export function Hostd({ api, password }: { api: string; password?: string }) { SystemDirectoryCreatePayload, SystemDirectoryCreateResponse >(axios, 'put', systemDirRoute), - logsSearch: buildRequestHandler< - LogsSearchParams, - LogsSearchPayload, - LogsSearchResponse - >(axios, 'post', logEntriesRoute), alerts: buildRequestHandler( axios, 'get', diff --git a/libs/hostd-react/src/api.ts b/libs/hostd-react/src/api.ts index bda61d9f3..438b6462a 100644 --- a/libs/hostd-react/src/api.ts +++ b/libs/hostd-react/src/api.ts @@ -28,9 +28,6 @@ import { SettingsPinnedUpdateParams, SettingsPinnedUpdatePayload, SettingsPinnedUpdateResponse, - LogsSearchParams, - LogsSearchPayload, - LogsSearchResponse, MetricsParams, MetricsPeriodParams, MetricsPeriodResponse, @@ -90,7 +87,6 @@ import { alertsRoute, contractsIdIntegrityRoute, contractsRoute, - logEntriesRoute, metricsIntervalRoute, metricsRoute, settingsAnnounceRoute, @@ -500,18 +496,6 @@ export function useSystemDirectoryCreate( return usePutFunc({ ...args, route: systemDirRoute }) } -// logs - -export function useLogsSearch( - args: HookArgsWithPayloadSwr< - LogsSearchParams, - LogsSearchPayload, - LogsSearchResponse - > -) { - return usePostSwr({ ...args, route: logEntriesRoute }) -} - // alerts export function useAlerts(args?: HookArgsSwr) { diff --git a/libs/hostd-types/src/api.ts b/libs/hostd-types/src/api.ts index 2f37f7485..07367cf9c 100644 --- a/libs/hostd-types/src/api.ts +++ b/libs/hostd-types/src/api.ts @@ -31,7 +31,6 @@ export const volumesIdRoute = '/volumes/:id' export const volumesIdResizeRoute = '/volumes/:id/resize' export const volumesIdCancelRoute = '/volumes/:id/cancel' export const systemDirRoute = '/system/dir' -export const logEntriesRoute = '/log/entries' export const alertsRoute = '/alerts' export const alertsDismissRoute = '/alerts/dismiss' @@ -522,34 +521,10 @@ export type SystemDirectoryResponse = { freeBytes: number directories: string[] } - export type SystemDirectoryCreateParams = void export type SystemDirectoryCreatePayload = { path: string } export type SystemDirectoryCreateResponse = void -// logs - -type LogEntry = { - timestamp: string - level: string - name: string - caller: string - message: string - fields: Record -} - -export type LogsSearchParams = void -export type LogsSearchPayload = { - names?: string[] - callers?: string[] - levels?: string[] - before?: string - after?: string - limit?: number - offset?: number -} -export type LogsSearchResponse = { count: number; entries: LogEntry[] } - // alerts export type AlertSeverity = 'info' | 'warning' | 'error' | 'critical'