mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-02-01 18:35:00 -05:00
make lastExecuted default for sorting agents
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -612,6 +612,7 @@ export type LibraryAgentPresetUpdatable = Partial<
|
||||
export enum LibraryAgentSortEnum {
|
||||
CREATED_AT = "createdAt",
|
||||
UPDATED_AT = "updatedAt",
|
||||
LAST_EXECUTED = "lastExecuted",
|
||||
}
|
||||
|
||||
/* *** CREDENTIALS *** */
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user