Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
4 changes: 1 addition & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,5 @@
"typos.config": ".github/workflows/typos.toml",
"[markdown]": {
"editor.defaultFormatter": "DavidAnson.vscode-markdownlint"
},
"biome.configurationPath": "./site/biome.jsonc",
"biome.lsp.bin": "./site/node_modules/.bin/biome"
}
}
25 changes: 25 additions & 0 deletions site/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/
import globalAxios, { type AxiosInstance, isAxiosError } from "axios";
import type dayjs from "dayjs";
import type { Task } from "modules/tasks/tasks";
import userAgentParser from "ua-parser-js";
import { delay } from "../utils/delay";
import { OneWayWebSocket } from "../utils/OneWayWebSocket";
Expand Down Expand Up @@ -422,6 +423,10 @@ export type GetProvisionerDaemonsParams = {
limit?: number;
};

export type TasksFilter = {
username?: string;
};

/**
* This is the container for all API methods. It's split off to make it more
* clear where API methods should go, but it is eventually merged into the Api
Expand Down Expand Up @@ -2687,6 +2692,26 @@ class ExperimentalApiMethods {

return response.data;
};

getTasks = async (filter: TasksFilter): Promise<Task[]> => {
const queryExpressions = ["has-ai-task:true"];

if (filter.username) {
queryExpressions.push(`owner:${filter.username}`);
}

const workspaces = await API.getWorkspaces({
q: queryExpressions.join(" "),
});
const prompts = await API.experimental.getAITasksPrompts(
workspaces.workspaces.map((workspace) => workspace.latest_build.id),
);

return workspaces.workspaces.map((workspace) => ({
workspace,
prompt: prompts.prompts[workspace.latest_build.id],
}));
};
}

// This is a hard coded CSRF token/cookie pair for local development. In prod,
Expand Down
1 change: 1 addition & 0 deletions site/src/components/Badge/Badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const badgeVariants = cva(
"border border-solid border-border-destructive bg-surface-red text-highlight-red shadow",
green:
"border border-solid border-surface-green bg-surface-green text-highlight-green shadow",
info: "border border-solid border-surface-sky bg-surface-sky text-highlight-sky shadow",
},
size: {
xs: "text-2xs font-regular h-5 [&_svg]:hidden rounded px-1.5",
Expand Down
Loading
Loading