Skip to content

Commit

Permalink
Debug
Browse files Browse the repository at this point in the history
  • Loading branch information
adb-sh committed Sep 26, 2024
1 parent 1ff93a4 commit f4070d2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/components/cloud/service/StatusBadge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import {
import { Status } from "./Status";

export const StatusBadge = ({ conditions, disableDropdown = false }) => {
const status = !conditions.some((condition) => condition.status === "False");
const status =
conditions.find((condition) => condition.type === "Ready").status ===
"True";

const renderedStatus = status ? (
<CheckCircleIcon tabindex="0" role="button" class=" w-6 h-6 text-success" />
Expand Down
3 changes: 1 addition & 2 deletions src/lib/prometheus.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use server";

import { cache } from "@solidjs/router";
import { getUser } from "./server";
import { getUser } from "./auth";
import { knative } from "~/lib/k8s";
import { config } from "./config";

Expand Down Expand Up @@ -51,7 +51,6 @@ export const getCompute = cache(async (app: string) => {

const namespace = user.name;
const revision = service.raw.status.latestReadyRevisionName;

return await queryLastCoupleMinutes({
query: `sum(rate(container_cpu_usage_seconds_total{namespace="${namespace}", pod=~"${revision}.*", container != "POD", container != ""}[1m])) by (container)`,
minutes: 120,
Expand Down
6 changes: 5 additions & 1 deletion src/routes/cloud/apps/[app].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ import type { Service as KnativeService } from "~/lib/knative";
const getService = cache(async (app: string) => {
"use server";
const user = await getUser();
return await knative.getService(app, user.name);
try {
return await knative.getService(app, user.name);
} catch (e) {
throw redirect("/cloud/apps");
}
}, "service");

const deleteServiceFromForm = async (form: FormData) => {
Expand Down
2 changes: 1 addition & 1 deletion src/routes/cloud/apps/[app]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default () => {
</div>
</td>
<td class="hidden md:table-cell">
{service()?.raw.status.traffic.find(
{service()?.raw.status?.traffic?.find(
(e) => e.revisionName === revision.metadata.name
)?.percent ?? 0}
%
Expand Down
4 changes: 3 additions & 1 deletion src/routes/cloud/apps/[app]/logs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ export default () => {
{logItem.pod}
</td>
</Show>
<td>{logItem.log}</td>
<td>
<pre>{logItem.log}</pre>
</td>
</tr>
)}
</For>
Expand Down

0 comments on commit f4070d2

Please sign in to comment.