fix(tui): show current location in working copies; order by created; change shortcut; tab to cycle actions in dialog select (#30989)
This commit is contained in:
parent
3151e2246a
commit
ecdfcd91ca
8 changed files with 151 additions and 51 deletions
|
|
@ -2,7 +2,7 @@ export * as ProjectV2 from "./project"
|
|||
export * as Project from "./project"
|
||||
|
||||
import { Context, Effect, Layer, Schema } from "effect"
|
||||
import { eq } from "drizzle-orm"
|
||||
import { asc, desc, eq } from "drizzle-orm"
|
||||
import path from "path"
|
||||
import { AbsolutePath, withStatics } from "./schema"
|
||||
import { FSUtil } from "./fs-util"
|
||||
|
|
@ -76,11 +76,10 @@ export const layer = Layer.effect(
|
|||
.select({ directory: ProjectDirectoryTable.directory })
|
||||
.from(ProjectDirectoryTable)
|
||||
.where(eq(ProjectDirectoryTable.project_id, input.projectID))
|
||||
.orderBy(desc(ProjectDirectoryTable.time_created), asc(ProjectDirectoryTable.directory))
|
||||
.all()
|
||||
.pipe(Effect.orDie)
|
||||
return rows
|
||||
.toSorted((a, b) => a.directory.localeCompare(b.directory))
|
||||
.map((row) => AbsolutePath.make(row.directory))
|
||||
return rows.map((row) => AbsolutePath.make(row.directory))
|
||||
})
|
||||
|
||||
const cached = Effect.fnUntraced(function* (dir: string) {
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ describe("Project directories schemas", () => {
|
|||
}),
|
||||
)
|
||||
|
||||
it.effect("lists stored project directories only for the requested project", () =>
|
||||
it.effect("lists stored project directories newest first for the requested project", () =>
|
||||
Effect.gen(function* () {
|
||||
const project = yield* ProjectV2.Service
|
||||
const { db } = yield* Database.Service
|
||||
|
|
@ -82,16 +82,16 @@ describe("Project directories schemas", () => {
|
|||
yield* db
|
||||
.insert(ProjectDirectoryTable)
|
||||
.values([
|
||||
{ project_id: projectID, directory: AbsolutePath.make("/repo/z"), type: "root" },
|
||||
{ project_id: projectID, directory: AbsolutePath.make("/repo/a"), type: "main" },
|
||||
{ project_id: otherID, directory: AbsolutePath.make("/other"), type: "main" },
|
||||
{ project_id: projectID, directory: AbsolutePath.make("/repo/z"), type: "root", time_created: 2 },
|
||||
{ project_id: projectID, directory: AbsolutePath.make("/repo/a"), type: "main", time_created: 1 },
|
||||
{ project_id: otherID, directory: AbsolutePath.make("/other"), type: "main", time_created: 3 },
|
||||
])
|
||||
.run()
|
||||
.pipe(Effect.orDie)
|
||||
|
||||
expect(yield* project.directories({ projectID })).toEqual([
|
||||
AbsolutePath.make("/repo/a"),
|
||||
AbsolutePath.make("/repo/z"),
|
||||
AbsolutePath.make("/repo/a"),
|
||||
])
|
||||
}),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue