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
28 changes: 16 additions & 12 deletions app/components/analysis/AnalysesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ async function parseProjects() {
// status: PodStatus,
// ): PodStatus | "running" | "finished" {
// if (status === PodStatus.Executing) {
// return "running";
// return PodStatus.Running;
// } else if (status === PodStatus.Executed) {
// return "finished";
// return PodStatus.Finished;
// } else {
// return status;
// }
Expand Down Expand Up @@ -233,16 +233,20 @@ function parseAnalysis(
// If PodOrc status update returns undefined -> use hub info since it's all we have
// If status from PodOrc -> use it
// If no run status reported by PodOrc, and it's not failed/finished -> set to null (wrong hub info)
if (executionStatuses) {
if (analysisId in executionStatuses) {
analysisEntry.execution_status = executionStatuses[analysisId]!.status;
} else {
if (
analysisEntry.execution_status != PodStatus.Failed &&
analysisEntry.execution_status != PodStatus.Executed
) {
analysisEntry.execution_status = null;
}
// REMEMBER: PO sends running/finished instead of executing/executed
const acceptableHubStatuses: Array<PodStatus | null | undefined> = [
PodStatus.Failed,
PodStatus.Executed,
PodStatus.Finished, // Deprecated but still returned by PO
];
if (executionStatuses && analysisId in executionStatuses) {
const podStatus = executionStatuses[analysisId]!;
analysisEntry.execution_status = podStatus.status;
analysisEntry.execution_progress =
podStatus.progress ?? analysisEntry.execution_progress;
} else {
if (!acceptableHubStatuses.includes(analysisEntry.execution_status)) {
analysisEntry.execution_status = null;
}
}
return setProgress(analysisEntry);
Expand Down
2 changes: 1 addition & 1 deletion app/components/analysis/AnalysisControlButtons.vue
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ async function onDeleteAnalysis() {
</NuxtLink>
<AnalysisUpdateButton
:analysisId="props.analysisId"
@updateAnalysisRun="updatePodStatus"
@updateAnalysisRunStatus="updatePodStatus"
/>
</div>
</template>
Expand Down
12 changes: 8 additions & 4 deletions app/components/analysis/AnalysisUpdateButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const props = defineProps({
},
});

const emit = defineEmits(["updateAnalysisRun"]);
const emit = defineEmits(["updateAnalysisRunStatus"]);
const loading = ref(false);
const toast = useToast();

Expand Down Expand Up @@ -65,10 +65,14 @@ async function getStatusUpdateFromPodOrc(): Promise<

async function onClickUpdate() {
loading.value = true;
const updatedStatus = await getStatusUpdateFromPodOrc();
const updatedStatus: AnalysisStatus | undefined =
await getStatusUpdateFromPodOrc();
if (updatedStatus) {
// TODO replace undefined with progress update from PO
emit("updateAnalysisRun", updatedStatus, undefined);
emit(
"updateAnalysisRunStatus",
updatedStatus.status,
updatedStatus.progress,
);
}

loading.value = false;
Expand Down
4 changes: 2 additions & 2 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Flame } from "./app/assets/primevue/flame-preset";
import tailwindcss from "@tailwindcss/vite";

export default defineNuxtConfig({
ssr: process.env.NODE_ENV !== "development",
ssr: false,
devtools: { enabled: false },
modules: ["@primevue/nuxt-module", "@sidebase/nuxt-auth", "@pinia/nuxt"],

Expand All @@ -31,7 +31,7 @@ export default defineNuxtConfig({
originEnvKey: "NUXT_PUBLIC_ORIGIN",
baseURL:
process.env.NUXT_PUBLIC_ORIGIN || "http://localhost:3000/flame/api/auth",
disableServerSideAuth: true, // Not needed since globalAppMiddleware is enabled
disableServerSideAuth: false,
globalAppMiddleware: true,
provider: {
type: "authjs",
Expand Down
5 changes: 3 additions & 2 deletions server/routes/flame/api/auth/[...].ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ 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 { JWT } from "next-auth/jwt";

import { NuxtAuthHandler } from "#auth";

Expand Down Expand Up @@ -104,7 +105,7 @@ function buildProvider() {
return providers;
}

async function refreshAccessToken(token: any) {
async function refreshAccessToken(token: JWT) {
const clientId = process.env.NUXT_IDP_CLIENT_ID ?? "node-ui";
const clientSecret = process.env.NUXT_IDP_CLIENT_SECRET ?? "";
const clientIssuer =
Expand All @@ -122,7 +123,7 @@ async function refreshAccessToken(token: any) {
client_id: clientId,
client_secret: clientSecret,
grant_type: "refresh_token",
refresh_token: token.refresh_token,
refresh_token: token.refresh_token as string,
}),
});

Expand Down
6 changes: 3 additions & 3 deletions test/components/analysis/AnalysisUpdateButton.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ describe("AnalysisUpdateButton.vue", () => {
5000,
fakeAnalysisId,
);
expect(wrapper.emitted("updateAnalysisRun")).toHaveLength(1);
expect(wrapper.emitted("updateAnalysisRun")![0]).toEqual([
expect(wrapper.emitted("updateAnalysisRunStatus")).toHaveLength(1);
expect(wrapper.emitted("updateAnalysisRunStatus")![0]).toEqual([
PodStatus.Running,
undefined,
]);
Expand All @@ -76,7 +76,7 @@ describe("AnalysisUpdateButton.vue", () => {
8000,
fakeMissingAnalysisId,
);
expect(wrapper.emitted("updateAnalysisRun")).toBeFalsy();
expect(wrapper.emitted("updateAnalysisRunStatus")).toBeFalsy();
});

it("Update analysis status - broken", async () => {
Expand Down
11 changes: 9 additions & 2 deletions test/mockapi/handlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
type BodyKongInitializeKongInitializePost,
type BodyPodorcPodsCreatePoPost,
type CleanupPodResponse,
PodStatus,
} from "~/services/Api";
import {
fakeDataStoreInitSuccess,
Expand Down Expand Up @@ -148,13 +149,19 @@ export const handlers = [
// Update Analysis Button - running analysis TODO remove
http.get(`/po/status/${fakeAnalysisId}`, () => {
return HttpResponse.json({
[fakeAnalysisId]: "running",
[fakeAnalysisId]: {
status: PodStatus.Running,
progress: undefined,
},
});
}),

http.get(`/po/status`, () => {
return HttpResponse.json({
[fakeAnalysisId]: { status: "running" },
[fakeAnalysisId]: {
status: PodStatus.Running,
progress: undefined,
},
});
}),

Expand Down