Skip to content

Commit

Permalink
Merge pull request #47 from MathisBurger/feature/runner-cmd
Browse files Browse the repository at this point in the history
All features required for v0.1.0.4
  • Loading branch information
MathisBurger authored Oct 14, 2024
2 parents 3b9f842 + 4b9a4b3 commit 952bb0f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion executor/internal/services/TaskBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func BuildTask(er ExecRequest) (input.Task, error) {
case LanguageGo:
image = "golang:1.19"
case LanguageJava:
image = "maven:3.9.9-amazoncorretto-21"
image = "ghcr.io/mathisburger/cc-images-java:latest"
default:
return input.Task{}, errors.New("invalid language")
}
Expand Down
2 changes: 1 addition & 1 deletion web/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export default function RootLayout({
<Navbar />
</AppShell.Navbar>
)}
<AppShell.Main>{children}</AppShell.Main>
<AppShell.Main mb={100}>{children}</AppShell.Main>
<AppShell.Footer><Footer /></AppShell.Footer>
</AppShell>
<SpotlightWrapper />
Expand Down
8 changes: 7 additions & 1 deletion web/app/my-groups/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@ import useApiServiceClient from "@/hooks/useApiServiceClient";
import useClientQuery from "@/hooks/useClientQuery";
import {useState} from "react";
import CreateGroupModal from "@/components/group/CreateGroupModal";
import useCurrentUser from "@/hooks/useCurrentUser";
import { isGranted } from "@/service/auth";
import { UserRoles } from "@/service/types/usernator";

const GroupsPage = () => {
const api = useApiServiceClient();
const [groups] = useClientQuery<GroupsResponse>(() => api.getMyGroups());
const [createModalOpen, setCreateModalOpen] = useState(false);
const {user} = useCurrentUser();

return (
<Container fluid>
<Title>My Groups</Title>
<Button onClick={() => setCreateModalOpen(true)}>Create group</Button>
{isGranted(user, [UserRoles.Tutor, UserRoles.Admin]) && (
<Button onClick={() => setCreateModalOpen(true)}>Create group</Button>
)}
<GroupsDisplayComponent groups={groups?.groups ?? []} page="my-groups" />
{createModalOpen && (
<CreateGroupModal onClose={() => setCreateModalOpen(false)} />
Expand Down
21 changes: 20 additions & 1 deletion web/app/solutions/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AssignmentLanguage, Solution } from "@/service/types/tasky";
import CentralLoading from "@/components/CentralLoading";
import JobResultDisplay from "@/components/JobResultDisplay";
import useCurrentUser from "@/hooks/useCurrentUser";
import { useState } from "react";
import {useEffect, useState} from "react";
import { isGranted } from "@/service/auth";
import { UserRoles } from "@/service/types/usernator";
import ExecutorUIDisplay from "@/components/solution/ExecutorUIDisplay";
Expand All @@ -15,6 +15,9 @@ import NavigateBack from "@/components/NavigateBack";
import FileStructureDisplay from "@/components/FileStructureDisplay";
import QuestionAnswersDisplay from "@/components/solution/questions/QuestionAnswersDisplay";

// Every 30s
const REFETCH_INTERVAL = 1000 * 30;

const SolutionDetailsPage = ({ params }: { params: { id: string } }) => {
const id = parseInt(`${params.id}`, 10);
const api = useApiServiceClient();
Expand All @@ -23,6 +26,22 @@ const SolutionDetailsPage = ({ params }: { params: { id: string } }) => {
const [solution, refetch] = useClientQuery<Solution>(() =>
api.getSolution(id),
);

useEffect(() => {
const fetcher = async () => {
if (solution?.job && solution.job.execution.length > 0) {
const exec = solution.job.execution[0];
if (exec.error === null && exec.result === null && exec.state === "RUNNING") {
setTimeout(() => {
refetch();
fetcher();
}, REFETCH_INTERVAL);
}
}
};
fetcher();
}, [solution]);

console.log(solution);
const approve = async () => {
await api.approveSolution(id);
Expand Down

0 comments on commit 952bb0f

Please sign in to comment.