Skip to content

Commit

Permalink
feat: use data-service sessions
Browse files Browse the repository at this point in the history
  • Loading branch information
andre-code committed Sep 2, 2024
1 parent 6263d94 commit a1a5479
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
8 changes: 7 additions & 1 deletion client/src/features/sessionsV2/sessionsV2.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
SessionEnvironmentList,
SessionLauncher,
SessionLauncherList,
SessionsV2,
UpdateSessionLauncherParams,
} from "./sessionsV2.types";

Expand All @@ -33,7 +34,7 @@ const sessionsV2Api = createApi({
baseQuery: fetchBaseQuery({
baseUrl: "/ui-server/api/data",
}),
tagTypes: ["Environment", "Launcher"],
tagTypes: ["Environment", "Launcher", "SessionsV2"],
endpoints: (builder) => ({
getSessionEnvironments: builder.query<SessionEnvironmentList, void>({
query: () => {
Expand Down Expand Up @@ -110,6 +111,11 @@ const sessionsV2Api = createApi({
},
invalidatesTags: ["Launcher"],
}),
getSessions: builder.query<SessionsV2, void>({
query: () => ({ url: "sessions" }),
providesTags: (result) =>
result ? [{ id: `${result.launcher_id}`, type: "SessionsV2" }] : [],
}),
}),
});

Expand Down
31 changes: 31 additions & 0 deletions client/src/features/sessionsV2/sessionsV2.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,34 @@ export interface UpdateSessionLauncherParams {
export interface DeleteSessionLauncherParams {
launcherId: string;
}

export interface SessionResources {
cpu: number;
gpu: number;
memory: number;
storage: number;
}

export interface SessionStatusDetail {
status: "ready" | "waiting" | "executing" | "failed";
step: string;
}

export interface SessionStatus {
details?: SessionStatusDetail[];
message?: string;
state: "running" | "starting" | "stopping" | "failed" | "hibernated";
will_hibernate_at?: string;
will_delete_at?: string;
}
export interface SessionsV2 {
image: string;
name: string;
resources: SessionResources;
started: string;
status: SessionStatus;
url: string;
project_id: string;
launcher_id: string;
resource_class_id: string;
}

0 comments on commit a1a5479

Please sign in to comment.