Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions app/components/analysis/logs/ContainerLogs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const {
data: response,
status,
error,
} = await getAnalysisLogs(analysisId, { limit: null });
} = await getAnalysisLogs(analysisId);
Comment thread
brucetony marked this conversation as resolved.

const lastFetchedAt = ref<string | null>(null);

Expand Down Expand Up @@ -93,7 +93,6 @@ async function refreshLogs() {
const result = await useNuxtApp()
.$hubApi<AnalysisLogsResponse>(`/logs/${analysisId}`, {
method: "GET",
query: { limit: null },
})
.catch(() => undefined);
if (result) {
Expand Down
15 changes: 10 additions & 5 deletions app/services/hub_adapter_swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2892,7 +2892,6 @@
}
],
"description": "Maximum number of log lines to return per container",
"default": 1000,
"title": "Limit"
},
"description": "Maximum number of log lines to return per container"
Expand Down Expand Up @@ -3011,9 +3010,15 @@
"in": "query",
"required": false,
"schema": {
"type": "integer",
"anyOf": [
{
"type": "integer"
},
{
"type": "null"
}
],
"description": "Maximum number of log lines to return per container",
"default": 1000,
"title": "Limit"
},
"description": "Maximum number of log lines to return per container"
Expand Down Expand Up @@ -3133,11 +3138,11 @@
"required": false,
"schema": {
"type": "integer",
"description": "Maximum number of raw log entries to return",
"description": "Maximum number of analysis groups to return",
"default": 1000,
"title": "Limit"
},
"description": "Maximum number of raw log entries to return"
"description": "Maximum number of analysis groups to return"
}
],
"responses": {
Expand Down
12 changes: 11 additions & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
import { defineNuxtConfig } from "nuxt/config";
import { Flame } from "./app/assets/primevue/flame-preset";
import tailwindcss from "@tailwindcss/vite";
import { fileURLToPath } from "node:url";
import { join } from "node:path";

const projectRoot = fileURLToPath(new URL(".", import.meta.url));

export default defineNuxtConfig({
ssr: false,
Expand Down Expand Up @@ -69,8 +73,14 @@ export default defineNuxtConfig({
"~/assets/css/preferences.css",
],

// @ts-expect-error nitro is a valid config key not fully typed in this nuxt version
nitro: {
alias: {
"node-fetch-native/proxy": join(projectRoot, "node_modules/node-fetch-native/dist/proxy.cjs"),
},
},

vite: {
// @ts-expect-error plugin complaint
plugins: [tailwindcss()],
},

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"chart.js": "^4.5.1",
"globals": "^15.15.0",
"next-auth": "~4.21.1",
"node-fetch-native": "^1.6.7",
"nuxt": "^4.4.6",
"pinia": "^3.0.4",
"prettier": "^3.6.2",
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 20 additions & 4 deletions server/routes/flame/api/auth/[...].ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { createProxy } from "node-fetch-native/proxy";
import KeycloakProvider from "next-auth/providers/keycloak";
import AuthentikProvider from "next-auth/providers/authentik";
import OktaProvider from "next-auth/providers/okta";
import OneLoginProvider from "next-auth/providers/onelogin";
import ZitadelProvider from "next-auth/providers/zitadel";
import type { Account, Session, User } from "next-auth";
import type { JWT } from "next-auth/jwt";

import { NuxtAuthHandler } from "#auth";
Expand Down Expand Up @@ -146,12 +148,16 @@ async function refreshAccessToken(token: JWT) {
const clientIssuer =
process.env.NUXT_PUBLIC_IDP_ISSUER ?? "http://localhost:8080/realms/flame";

const proxy = createProxy();

const discovery = await fetch(
`${clientIssuer}/.well-known/openid-configuration`,
proxy as RequestInit,
).then((r) => r.json());
const tokenEndpoint: string = discovery.token_endpoint;

const response = await fetch(tokenEndpoint, {
...(proxy as RequestInit),
headers: { "Content-Type": "application/x-www-form-urlencoded" },
method: "POST",
body: new URLSearchParams({
Expand All @@ -177,27 +183,29 @@ async function refreshAccessToken(token: JWT) {
export default NuxtAuthHandler({
secret: useRuntimeConfig().authSecret,
events: {
async signIn({ account }) {
async signIn({ account }: { account: Account | null }) {
// After successful sign in
const hubAdapterApi = process.env.NUXT_PUBLIC_HUB_ADAPTER_URL;
if (!hubAdapterApi || !account?.access_token) return;
const signInEndpoint = `${hubAdapterApi.replace(/\/$/, "")}/events/signin`;
try {
await fetch(signInEndpoint, {
...(createProxy() as RequestInit),
headers: { Authorization: `Bearer ${account.access_token}` },
method: "POST",
});
} catch (error) {
console.error("Failed to log sign-in event:", error);
}
},
async signOut({ token }) {
async signOut({ token }: { session: Session; token: JWT }) {
Comment thread
brucetony marked this conversation as resolved.
// After successful sign out
const hubAdapterApi = process.env.NUXT_PUBLIC_HUB_ADAPTER_URL;
if (!hubAdapterApi || !token?.access_token) return;
const signOutEndpoint = `${hubAdapterApi.replace(/\/$/, "")}/events/signout`;
try {
await fetch(signOutEndpoint, {
...(createProxy() as RequestInit),
headers: { Authorization: `Bearer ${token.access_token}` },
method: "POST",
});
Expand All @@ -208,15 +216,23 @@ export default NuxtAuthHandler({
},
callbacks: {
/* on session retrieval */
async session({ session, token }) {
async session({ session, token }: { session: Session; token: JWT }) {
return {
...session,
accessToken: token.access_token,
expiresAt: token.expires_at,
};
},
/* on JWT token creation or mutation */
async jwt({ token, account, user }) {
async jwt({
token,
account,
user,
}: {
token: JWT;
account: Account | null;
user: User;
}) {
if (account && user) {
if (account.type === "credentials") {
// CredentialsProvider (Hub password grant): tokens live on the user object
Expand Down
Loading