Skip to content

Commit

Permalink
humanizeDuration on cnpg index
Browse files Browse the repository at this point in the history
  • Loading branch information
adb-sh committed Nov 16, 2024
1 parent faf5fcd commit 7d26f9e
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/routes/cloud/cnpg/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { cache, createAsync, A, type RouteDefinition } from "@solidjs/router";
import { getUser } from "~/lib/auth";
import { StatusBadge } from "~/components/cloud/service/StatusBadge";
import { cnpg } from "~/lib/k8s";
import humanizeDuration from "humanize-duration";

const getDBs = cache(async () => {
"use server";
Expand Down Expand Up @@ -68,11 +69,24 @@ export default () => {
/>
</td>
<td>
{new Date(
db.status.conditions.find(
(condition) => condition.type === "Ready"
).lastTransitionTime
).toLocaleString()}
<div
class="tooltip"
data-tip={new Date(
db.status.conditions.find(
(condition) => condition.type === "Ready"
)?.lastTransitionTime
).toLocaleString()}
>
{humanizeDuration(
new Date(
db.status.conditions.find(
(condition) => condition.type === "Ready"
)?.lastTransitionTime
).getTime() - Date.now(),
{ round: true, largest: 1 }
)}{" "}
ago
</div>
</td>
<td class="hidden md:block">{db.spec.imageName}</td>
<td>
Expand Down

0 comments on commit 7d26f9e

Please sign in to comment.