make lastExecuted default for sorting agents

This commit is contained in:
Medyan
2026-01-29 20:20:27 -05:00
parent 3ec8fd912f
commit 7838855da9
6 changed files with 13 additions and 7 deletions

View File

@@ -23,10 +23,13 @@ export function LibrarySortMenu({ setLibrarySort }: Props) {
<Select onValueChange={handleSortChange}>
<SelectTrigger className="ml-1 w-fit space-x-1 border-none px-0 text-base underline underline-offset-4 shadow-none">
<ArrowDownNarrowWideIcon className="h-4 w-4 sm:hidden" />
<SelectValue placeholder="Last Modified" />
<SelectValue placeholder="Last Executed" />
</SelectTrigger>
<SelectContent>
<SelectGroup>
<SelectItem value={LibraryAgentSort.lastExecuted}>
Last Executed
</SelectItem>
<SelectItem value={LibraryAgentSort.createdAt}>
Creation Date
</SelectItem>

View File

@@ -11,12 +11,14 @@ export function useLibrarySortMenu({ setLibrarySort }: Props) {
const getSortLabel = (sort: LibraryAgentSort) => {
switch (sort) {
case LibraryAgentSort.lastExecuted:
return "Last Executed";
case LibraryAgentSort.createdAt:
return "Creation Date";
case LibraryAgentSort.updatedAt:
return "Last Modified";
default:
return "Last Modified";
return "Last Executed";
}
};

View File

@@ -14,11 +14,11 @@ export function useLibraryListPage() {
// Ensure sort param is always present in URL (even if default)
useEffect(() => {
if (!librarySortRaw) {
setLibrarySortRaw(LibraryAgentSort.updatedAt, { shallow: false });
setLibrarySortRaw(LibraryAgentSort.lastExecuted, { shallow: false });
}
}, [librarySortRaw, setLibrarySortRaw]);
const librarySort = librarySortRaw || LibraryAgentSort.updatedAt;
const librarySort = librarySortRaw || LibraryAgentSort.lastExecuted;
const setLibrarySort = useCallback(
(value: LibraryAgentSort) => {

View File

@@ -612,6 +612,7 @@ export type LibraryAgentPresetUpdatable = Partial<
export enum LibraryAgentSortEnum {
CREATED_AT = "createdAt",
UPDATED_AT = "updatedAt",
LAST_EXECUTED = "lastExecuted",
}
/* *** CREDENTIALS *** */

View File

@@ -85,7 +85,7 @@ export class LibraryPage extends BasePage {
async selectSortOption(
page: Page,
sortOption: "Creation Date" | "Last Modified",
sortOption: "Last Executed" | "Creation Date" | "Last Modified",
): Promise<void> {
const { getRole } = getSelectors(page);
await getRole("combobox").click();

View File

@@ -182,7 +182,7 @@ test("logged in user is redirected from /login to /library", async ({
await hasUrl(page, "/marketplace");
await page.goto("/login");
await hasUrl(page, "/library?sort=updatedAt");
await hasUrl(page, "/library?sort=lastExecuted");
});
test("logged in user is redirected from /signup to /library", async ({
@@ -195,5 +195,5 @@ test("logged in user is redirected from /signup to /library", async ({
await hasUrl(page, "/marketplace");
await page.goto("/signup");
await hasUrl(page, "/library?sort=updatedAt");
await hasUrl(page, "/library?sort=lastExecuted");
});