|
1 | | -import { knative } from "~/lib/k8s"; |
| 1 | +import { cnpg, knative } from "~/lib/k8s"; |
2 | 2 | import { getUser } from "~/lib/auth"; |
3 | 3 | import { A, cache, createAsync, type RouteDefinition } from "@solidjs/router"; |
4 | | -import { getSession } from "@solid-mediakit/auth"; |
5 | | -import { getWebRequest } from "vinxi/http"; |
6 | | -import { authOptions } from "~/lib/auth"; |
7 | 4 |
|
8 | | -const getServices = cache(async () => { |
| 5 | +const getOverview = cache(async () => { |
9 | 6 | "use server"; |
10 | | - const user = await getUser() |
11 | | - return await knative.getServices(user.name); |
12 | | -}, "services2"); |
| 7 | + const user = await getUser(); |
| 8 | + const apps = await knative.getServices(user.name); |
| 9 | + const dbs = await cnpg.getDatabases(user.name); |
| 10 | + return { apps, dbs }; |
| 11 | +}, "overview"); |
13 | 12 |
|
14 | 13 | export const route = { |
15 | 14 | load: () => { |
16 | | - getServices(); |
| 15 | + getOverview(); |
17 | 16 | }, |
18 | 17 | } satisfies RouteDefinition; |
19 | 18 |
|
20 | 19 | export default () => { |
21 | | - const services = createAsync(() => getServices()); |
| 20 | + const overview = createAsync(() => getOverview()); |
22 | 21 |
|
23 | 22 | return ( |
24 | 23 | <section class="grid 2xl:grid-cols-3 gap-2 w-full p-2"> |
25 | 24 | <figure class="card relative basis-64 bg-base-200 shadow grow"> |
26 | 25 | <div class="card-body"> |
27 | 26 | <div class="card-title">Apps</div> |
28 | | - <p>{services()?.services.length} Apps runnging</p> |
| 27 | + <p>{overview()?.apps.services.length} Apps runnging</p> |
29 | 28 | <A href="/cloud/apps" class="btn btn-primary"> |
30 | 29 | View Apps |
31 | 30 | </A> |
32 | 31 | </div> |
33 | 32 | </figure> |
| 33 | + <figure class="card relative basis-64 bg-base-200 shadow grow"> |
| 34 | + <div class="card-body"> |
| 35 | + <div class="card-title">Postgres</div> |
| 36 | + <p>{overview()?.dbs.length} Databases runnging</p> |
| 37 | + <A href="/cloud/cnpg" class="btn btn-primary"> |
| 38 | + View Postgres |
| 39 | + </A> |
| 40 | + </div> |
| 41 | + </figure> |
34 | 42 | </section> |
35 | 43 | ); |
36 | 44 | }; |
0 commit comments