Skip to content

Commit

Permalink
fix pause and stop session in session page
Browse files Browse the repository at this point in the history
  • Loading branch information
andre-code committed Sep 20, 2024
1 parent bfa4ad4 commit dbe673e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
10 changes: 5 additions & 5 deletions client/src/features/sessionsV2/PauseOrDeleteSessionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ import { ABSOLUTE_ROUTES } from "../../routing/routes.constants";
import AppContext from "../../utils/context/appContext";
import useLegacySelector from "../../utils/customHooks/useLegacySelector.hook";
import { toHumanRelativeDuration } from "../../utils/helpers/DurationUtils";
import { useWaitForSessionStatusV2 } from "../session/useWaitForSessionStatus.hook";
import {
usePatchSessionMutation,
useStopSessionMutation,
} from "../session/sessions.api";
import { useWaitForSessionStatusV2 } from "../session/useWaitForSessionStatus.hook";
} from "../sessionsV2/sessionsV2.api";

import styles from "../session/components/SessionModals.module.scss";
import { SessionV2 } from "./sessionsV2.types";
Expand Down Expand Up @@ -112,7 +112,7 @@ function AnonymousDeleteSessionModal({
const [isStopping, setIsStopping] = useState(false);

const onStopSession = useCallback(async () => {
stopSession({ serverName: sessionName });
stopSession({ session_id: sessionName });
setIsStopping(true);
}, [sessionName, stopSession]);

Expand Down Expand Up @@ -227,7 +227,7 @@ function PauseSessionModalContent({
const [isStopping, setIsStopping] = useState(false);

const onHibernateSession = useCallback(async () => {
patchSession({ sessionName, state: "hibernated" });
patchSession({ session_id: sessionName, state: "hibernated" });
setIsStopping(true);
}, [patchSession, sessionName]);

Expand Down Expand Up @@ -336,7 +336,7 @@ function DeleteSessionModalContent({
const [isStopping, setIsStopping] = useState(false);

const onStopSession = useCallback(async () => {
stopSession({ serverName: sessionName });
stopSession({ session_id: sessionName });
setIsStopping(true);
}, [sessionName, stopSession]);

Expand Down
4 changes: 1 addition & 3 deletions client/src/features/sessionsV2/SessionStartPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ import useAppDispatch from "../../utils/customHooks/useAppDispatch.hook";
import useAppSelector from "../../utils/customHooks/useAppSelector.hook";

import { resetFavicon, setFavicon } from "../display";
import {
storageDefinitionAfterSavingCredentialsFromConfig,
} from "../project/utils/projectCloudStorage.utils";
import { storageDefinitionAfterSavingCredentialsFromConfig } from "../project/utils/projectCloudStorage.utils";
import type { Project } from "../projectsV2/api/projectV2.api";
import {
projectV2Api,
Expand Down
2 changes: 1 addition & 1 deletion client/src/features/sessionsV2/sessionsV2.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ const sessionsV2Api = createApi({
transformResponse: (result: unknown) => {
return result && typeof result == "string"
? JSON.parse(result)
: result; //TODO ANDREA temporal fix
: result;
},
keepUnusedDataFor: 0,
}),
Expand Down
6 changes: 3 additions & 3 deletions server/src/websocket/handlers/sessionsV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ function sendMessage(data: string, channel: Channel) {
}

function heartbeatRequestSessionStatusV2({
channel,
apiClient,
headers,
channel,
apiClient,
headers,
}: WebSocketHandlerArgs): void {
const previousStatuses = channel.data.get("sessionStatusV2") as string;
apiClient
Expand Down

0 comments on commit dbe673e

Please sign in to comment.