From 108944e81ca0b64f0537ca264be85b0753fdb29f Mon Sep 17 00:00:00 2001 From: cp-20 Date: Wed, 25 Dec 2024 01:04:18 +0900 Subject: [PATCH] =?UTF-8?q?=E6=AD=A3=E3=81=97=E3=81=8F=E5=87=BA=E5=8A=9B?= =?UTF-8?q?=E3=81=95=E3=82=8C=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/templates/app/ContainerLogExport.tsx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/dashboard/src/components/templates/app/ContainerLogExport.tsx b/dashboard/src/components/templates/app/ContainerLogExport.tsx index cac5458b..8ba4c03c 100644 --- a/dashboard/src/components/templates/app/ContainerLogExport.tsx +++ b/dashboard/src/components/templates/app/ContainerLogExport.tsx @@ -1,5 +1,5 @@ -import { fromJsonString, toJsonString } from '@bufbuild/protobuf' -import { type Timestamp, TimestampSchema } from '@bufbuild/protobuf/wkt' +import { toJsonString } from '@bufbuild/protobuf' +import { type Timestamp, timestampFromDate, TimestampSchema } from '@bufbuild/protobuf/wkt' import { type Component, Show, createSignal } from 'solid-js' import type { Application, ApplicationOutput } from '/@/api/neoshowcase/protobuf/gateway_pb' import { Button } from '/@/components/UI/Button' @@ -25,7 +25,7 @@ const getLogsBefore = async ( setProgressMessage: (message: string) => void, ): Promise => { let remainingLines = lines - const firstBefore: Timestamp = fromJsonString(TimestampSchema, before) + const firstBefore: Timestamp = timestampFromDate(new Date(before)) let nextBefore = firstBefore let logLines: ApplicationOutput[] = [] while (remainingLines > 0 && firstBefore.seconds - nextBefore.seconds < days * secondsPerDay) { @@ -111,10 +111,8 @@ const exportBefore = async ( if (lines > maxExportLines) { throw new Error(`${maxExportLines} 行以下を指定してください`) } - try { - fromJsonString(TimestampSchema, beforeStr) - } catch (e) { - console.error(e) + const date = new Date(beforeStr) + if (Number.isNaN(date)) { throw new Error('日付フォーマットが正しくありません') }