Skip to content

Commit

Permalink
Merge pull request #513 from pokt-foundation/hide-app-logs
Browse files Browse the repository at this point in the history
Hide App logs tab for now
  • Loading branch information
RabeeAbuBaker authored Oct 12, 2023
2 parents 79f5aa8 + 5e49a3b commit 2e4e444
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 54 deletions.
53 changes: 3 additions & 50 deletions app/routes/account.$accountId.$appId.logs/route.tsx
Original file line number Diff line number Diff line change
@@ -1,60 +1,13 @@
import { json, LoaderFunction, MetaFunction } from "@remix-run/node"
import { useLoaderData } from "@remix-run/react"
import invariant from "tiny-invariant"
import ErrorView from "~/components/ErrorView"
import { initDwhClient } from "~/models/dwh/dwh.server"
import { Logs } from "~/models/dwh/sdk/models/Logs"
import AppLogs from "~/routes/account.$accountId.$appId.logs/view"
import type { DataStruct } from "~/types/global"
import { getErrorMessage } from "~/utils/catchError"
import { LoaderFunction, MetaFunction, redirect } from "@remix-run/node"
import { seo_title_append } from "~/utils/seo"
import { requireUser } from "~/utils/user.server"

export const meta: MetaFunction = () => {
return {
title: `Application Logs ${seo_title_append}`,
}
}

type AppLogsData = {
logs: Logs[]
}

export const loader: LoaderFunction = async ({ request, params }) => {
await requireUser(request)
const dwh = initDwhClient()

try {
const { appId } = params
invariant(typeof appId === "string", "AppId must be a set url parameter")

const logsResponse = await dwh.logsGet({
portalApplicationId: [appId],
})

return json<DataStruct<AppLogsData>>({
data: {
logs: logsResponse.data as Logs[],
},
error: false,
})
} catch (error) {
return json<DataStruct<AppLogsData>>({
data: null,
error: true,
message: getErrorMessage(error),
})
}
}

export default function AccountInsights() {
const { data, error, message } = useLoaderData() as DataStruct<AppLogsData>

if (error) {
return <ErrorView message={message} />
}

const { logs } = data

return <AppLogs logs={logs} />
const { appId, accountId } = params
return redirect(`/account/${accountId}/${appId}`)
}
4 changes: 0 additions & 4 deletions app/routes/account.$accountId.$appId/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ export default function AppIdLayoutView({
to: "insights",
label: "Insights",
},
{
to: "logs",
label: "Logs",
},
{
to: "security",
label: "Security",
Expand Down

0 comments on commit 2e4e444

Please sign in to comment.