Skip to content

Commit

Permalink
chore: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
tschoffelen committed Sep 27, 2024
1 parent e72fc2b commit 2165968
Showing 1 changed file with 27 additions and 47 deletions.
74 changes: 27 additions & 47 deletions packages/dashboard/src/components/stats/invocation-summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@ import { format } from "date-fns";
import { ExternalLink, ScrollText, SnowflakeIcon } from "lucide-react";

import { Button } from "@/components/ui/button";
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from "@/components/ui/tooltip";
import InvocationResult from "@/components/stats/invocation-result";
import { Tooltipped } from "@/components/ui/tooltipped";
import InvocationResult from "@/components/stats/invocation-result";

export const MiniInvocationSummary = ({ data, short = false }) => {
return (
Expand All @@ -28,10 +22,10 @@ export const MiniInvocationSummary = ({ data, short = false }) => {
<dd className="mr-4 font-semibold flex items-center gap-2">
{(data.ended - data.started).toLocaleString()} ms
{data.readiness === "cold" && (
<Tooltipped title="Cold start">
<SnowflakeIcon className="size-3.5 text-blue-400" />
</Tooltipped>
)}
<Tooltipped title="Cold start">
<SnowflakeIcon className="size-3.5 text-blue-400" />
</Tooltipped>
)}
</dd>
{short ? null : (
<>
Expand All @@ -50,42 +44,28 @@ const InvocationSummary = ({ data }) => {
<div className="flex items-center justify-between flex-wrap">
<MiniInvocationSummary data={data} />
<div className="gap-2 hidden md:flex">
<TooltipProvider>
<Tooltip delayDuration={100}>
<TooltipTrigger>
<Button variant="outline" size="icon" asChild>
<a
href={`https://${data.region}.console.aws.amazon.com/lambda/home?region=eu-west-1#/functions/${data.name}?tab=monitoring`}
target="_blank"
title="Open in AWS Console"
>
<ExternalLink className="size-4" />
</a>
</Button>
</TooltipTrigger>
<TooltipContent>
<p>Open in AWS Console</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
<TooltipProvider>
<Tooltip delayDuration={100}>
<TooltipTrigger>
<Button variant="outline" size="icon" asChild>
<a
href={`https://${data.region}.console.aws.amazon.com/cloudwatch/home?region=eu-west-1#logsV2:log-groups/log-group/$252Faws$252Flambda$252F${data.name}/log-events/${encodeURIComponent(data.info.logStreamName).replace(/%/g, "$25")}$3FfilterPattern$3D$2522${data.id}$2522`}
target="_blank"
title="Open CloudWatch Logs"
>
<ScrollText className="size-4" />
</a>
</Button>
</TooltipTrigger>
<TooltipContent>
<p>Open CloudWatch Logs</p>
</TooltipContent>
</Tooltip>
</TooltipProvider>
<Tooltipped title="Open in AWS Console">
<Button variant="outline" size="icon" asChild>
<a
href={`https://${data.region}.console.aws.amazon.com/lambda/home?region=eu-west-1#/functions/${data.name}?tab=monitoring`}
target="_blank"
title="Open in AWS Console"
>
<ExternalLink className="size-4" />
</a>
</Button>
</Tooltipped>
<Tooltipped title="Open CloudWatch Logs">
<Button variant="outline" size="icon" asChild>
<a
href={`https://${data.region}.console.aws.amazon.com/cloudwatch/home?region=eu-west-1#logsV2:log-groups/log-group/$252Faws$252Flambda$252F${data.name}/log-events/${encodeURIComponent(data.info.logStreamName).replace(/%/g, "$25")}$3FfilterPattern$3D$2522${data.id}$2522`}
target="_blank"
title="Open CloudWatch Logs"
>
<ScrollText className="size-4" />
</a>
</Button>
</Tooltipped>
</div>
</div>
);
Expand Down

0 comments on commit 2165968

Please sign in to comment.