style: format web workspace
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
import { loadJson, workspaceApiPath } from "$lib/workspace/api/http";
|
||||
import type { RepositoryListResponse, WorkspaceResponse } from "$lib/workspace/sidebar/types";
|
||||
import type {
|
||||
RepositoryListResponse,
|
||||
WorkspaceResponse,
|
||||
} from "$lib/workspace/sidebar/types";
|
||||
import type { LayoutLoad } from "./$types";
|
||||
|
||||
export const load: LayoutLoad = async ({ fetch, params }) => {
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
import { loadJson, workspaceApiPath } from '$lib/workspace/api/http';
|
||||
import type { MemoryStagingListResponse } from '$lib/workspace/sidebar/types';
|
||||
import type { PageLoad } from './$types';
|
||||
import { loadJson, workspaceApiPath } from "$lib/workspace/api/http";
|
||||
import type { MemoryStagingListResponse } from "$lib/workspace/sidebar/types";
|
||||
import type { PageLoad } from "./$types";
|
||||
|
||||
export const load: PageLoad = async ({ fetch, params }) => {
|
||||
return {
|
||||
workspaceId: params.workspaceId,
|
||||
staging: await loadJson<MemoryStagingListResponse>(
|
||||
fetch,
|
||||
`${workspaceApiPath(params.workspaceId, '/memory/staging')}?limit=200`,
|
||||
`${workspaceApiPath(params.workspaceId, "/memory/staging")}?limit=200`,
|
||||
),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -9,7 +9,7 @@ export const load: PageLoad = async ({ fetch, params }) => {
|
||||
const apiPath = (path: string) => workspaceApiPath(params.workspaceId, path);
|
||||
const objectiveId = params.objectiveId;
|
||||
const [objectives, objective] = await Promise.all([
|
||||
loadJson<ObjectiveListResponse>(fetch, apiPath('/objectives')),
|
||||
loadJson<ObjectiveListResponse>(fetch, apiPath("/objectives")),
|
||||
loadJson<ObjectiveDetail>(
|
||||
fetch,
|
||||
apiPath(`/objectives/${encodeURIComponent(objectiveId)}`),
|
||||
|
||||
+3
-1
@@ -1,5 +1,7 @@
|
||||
export function load(
|
||||
{ params }: { params: { workspaceId: string; runtimeId: string; workerId: string } },
|
||||
{ params }: {
|
||||
params: { workspaceId: string; runtimeId: string; workerId: string };
|
||||
},
|
||||
) {
|
||||
return {
|
||||
workspaceId: params.workspaceId,
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import type { PageLoad } from './$types';
|
||||
import type { PageLoad } from "./$types";
|
||||
|
||||
export const load: PageLoad = ({ params }) => ({
|
||||
sourceTreeId: params.sourceTreeId,
|
||||
|
||||
+8
-2
@@ -10,7 +10,10 @@ import type { PageLoad } from "./$types";
|
||||
export const load: PageLoad = async ({ fetch, params }) => {
|
||||
const runtimeId = params.runtimeId;
|
||||
const [runtimes, workdirs, cleanupPlan] = await Promise.all([
|
||||
loadJson<ListResponse<Runtime>>(fetch, workspaceApiPath(params.workspaceId, "/runtimes")),
|
||||
loadJson<ListResponse<Runtime>>(
|
||||
fetch,
|
||||
workspaceApiPath(params.workspaceId, "/runtimes"),
|
||||
),
|
||||
loadJson<BrowserWorkingDirectoryListResponse>(
|
||||
fetch,
|
||||
workspaceApiPath(
|
||||
@@ -20,7 +23,10 @@ export const load: PageLoad = async ({ fetch, params }) => {
|
||||
),
|
||||
loadJson<RuntimeCleanupPlanResponse>(
|
||||
fetch,
|
||||
workspaceApiPath(params.workspaceId, `/runtimes/${encodeURIComponent(runtimeId)}/cleanup-plan`),
|
||||
workspaceApiPath(
|
||||
params.workspaceId,
|
||||
`/runtimes/${encodeURIComponent(runtimeId)}/cleanup-plan`,
|
||||
),
|
||||
),
|
||||
]);
|
||||
|
||||
|
||||
@@ -6,7 +6,10 @@ export const load = (async ({ fetch, params }) => {
|
||||
const ticketId = params.ticketId;
|
||||
const ticket = await loadJson<TicketDetail>(
|
||||
fetch,
|
||||
workspaceApiPath(params.workspaceId, `/tickets/${encodeURIComponent(ticketId)}`),
|
||||
workspaceApiPath(
|
||||
params.workspaceId,
|
||||
`/tickets/${encodeURIComponent(ticketId)}`,
|
||||
),
|
||||
);
|
||||
|
||||
return {
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
import { loadJson, workspaceApiPath } from "$lib/workspace/api/http";
|
||||
import type { ListResponse, RuntimeCleanupPlanResponse, Worker } from "$lib/workspace/sidebar/types";
|
||||
import type {
|
||||
ListResponse,
|
||||
RuntimeCleanupPlanResponse,
|
||||
Worker,
|
||||
} from "$lib/workspace/sidebar/types";
|
||||
import type { PageLoad } from "./$types";
|
||||
|
||||
export const load: PageLoad = async ({ fetch, params }) => {
|
||||
@@ -7,12 +11,17 @@ export const load: PageLoad = async ({ fetch, params }) => {
|
||||
fetch,
|
||||
workspaceApiPath(params.workspaceId, "/workers"),
|
||||
);
|
||||
const runtimeIds = Array.from(new Set(workers.data?.items.map((worker) => worker.runtime_id) ?? []));
|
||||
const runtimeIds = Array.from(
|
||||
new Set(workers.data?.items.map((worker) => worker.runtime_id) ?? []),
|
||||
);
|
||||
const cleanupPlanEntries = await Promise.all(
|
||||
runtimeIds.map(async (runtimeId) => {
|
||||
const cleanupPlan = await loadJson<RuntimeCleanupPlanResponse>(
|
||||
fetch,
|
||||
workspaceApiPath(params.workspaceId, `/runtimes/${encodeURIComponent(runtimeId)}/cleanup-plan`),
|
||||
workspaceApiPath(
|
||||
params.workspaceId,
|
||||
`/runtimes/${encodeURIComponent(runtimeId)}/cleanup-plan`,
|
||||
),
|
||||
);
|
||||
return [runtimeId, cleanupPlan] as const;
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user