Compare commits
No commits in common. "a23f836358942714386ba129d4a58d8224ae8e28" and "43a70929ec11c5bc3b0c921d7d7d98154516779b" have entirely different histories.
a23f836358
...
43a70929ec
4 changed files with 8 additions and 32 deletions
|
|
@ -164,16 +164,6 @@ export async function deleteField(
|
||||||
await api.delete(`/api/v1/admin/fields/${fieldId}`);
|
await api.delete(`/api/v1/admin/fields/${fieldId}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function listViews(
|
|
||||||
tableId: number,
|
|
||||||
bridgeUrl?: string | null,
|
|
||||||
): Promise<Array<{ id: number; name: string; type: string }>> {
|
|
||||||
const api = getBridgeClient(resolveBridgeUrl(bridgeUrl));
|
|
||||||
return unwrap<Array<{ id: number; name: string; type: string }>>(
|
|
||||||
api.get(`/api/v1/admin/tables/${tableId}/views`),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function createView(
|
export async function createView(
|
||||||
tableId: number,
|
tableId: number,
|
||||||
payload: { name: string; type: 'grid' | 'gallery' | 'kanban' | 'calendar' | 'timeline' | 'form' },
|
payload: { name: string; type: 'grid' | 'gallery' | 'kanban' | 'calendar' | 'timeline' | 'form' },
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,6 @@ import {
|
||||||
createDatabase,
|
createDatabase,
|
||||||
createTable,
|
createTable,
|
||||||
createField,
|
createField,
|
||||||
listViews,
|
|
||||||
} from "../services/admin-client";
|
} from "../services/admin-client";
|
||||||
|
|
||||||
type Step = "name" | "fields" | "creating";
|
type Step = "name" | "fields" | "creating";
|
||||||
|
|
@ -185,24 +184,15 @@ export function CreateDatabaseModal({
|
||||||
await createField(table.id, payload as never, bridgeUrl);
|
await createField(table.id, payload as never, bridgeUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Step 4: resolve the auto-created Grid view of the new table, then
|
// Step 4: insert the new table as a Tiptap node into the editor.
|
||||||
// insert the embed node with a real viewId (without it the renderer
|
// We don't have a viewId here yet — Baserow auto-creates a default Grid
|
||||||
// shows "No rows found in this view").
|
// view at table creation. We let the rendererfetch the first view.
|
||||||
const views = await listViews(table.id, bridgeUrl);
|
|
||||||
const defaultView =
|
|
||||||
views.find((v) => v.type === "grid") ?? views[0] ?? null;
|
|
||||||
if (!defaultView) {
|
|
||||||
throw new Error(
|
|
||||||
"Table creee mais aucune vue par defaut trouvee. Reessayez ou contactez un admin.",
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
editor
|
editor
|
||||||
.chain()
|
.chain()
|
||||||
.focus()
|
.focus()
|
||||||
.insertDatabaseView({
|
.insertDatabaseView({
|
||||||
tableId: String(table.id),
|
tableId: String(table.id),
|
||||||
viewId: String(defaultView.id),
|
viewId: "",
|
||||||
viewType: "grid",
|
viewType: "grid",
|
||||||
bridgeUrl: bridgeUrl ?? null,
|
bridgeUrl: bridgeUrl ?? null,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -35,10 +35,7 @@ export class BacklinkIndexerService {
|
||||||
let page: { content: any; workspaceId: string } | null = null;
|
let page: { content: any; workspaceId: string } | null = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Kysely's CamelCasePlugin (configured in database.module.ts) maps
|
const result = await sql<{ content: any; workspace_id: string }>`
|
||||||
// snake_case columns to camelCase keys at runtime, so the row type
|
|
||||||
// must reflect the post-plugin shape.
|
|
||||||
const result = await sql<{ content: any; workspaceId: string }>`
|
|
||||||
SELECT p.content, s.workspace_id
|
SELECT p.content, s.workspace_id
|
||||||
FROM pages p
|
FROM pages p
|
||||||
JOIN spaces s ON s.id = p.space_id
|
JOIN spaces s ON s.id = p.space_id
|
||||||
|
|
@ -54,7 +51,7 @@ export class BacklinkIndexerService {
|
||||||
|
|
||||||
page = {
|
page = {
|
||||||
content: result.rows[0].content,
|
content: result.rows[0].content,
|
||||||
workspaceId: result.rows[0].workspaceId,
|
workspaceId: result.rows[0].workspace_id,
|
||||||
};
|
};
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
this.logger.error(
|
this.logger.error(
|
||||||
|
|
|
||||||
|
|
@ -137,9 +137,8 @@ export class BacklinkParserService {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- R3.1.c database-view node (embed links a page indirectly via pageId attr) ---
|
// --- R3.1.c databaseView node (embed links a page indirectly via pageId attr) ---
|
||||||
// The shared schema in @docmost/editor-ext uses kebab-case as the node name.
|
if (type === 'databaseView' && attrs.pageId) {
|
||||||
if (type === 'database-view' && attrs.pageId) {
|
|
||||||
out.push({
|
out.push({
|
||||||
linkType: 'database_embed',
|
linkType: 'database_embed',
|
||||||
pageId: attrs.pageId,
|
pageId: attrs.pageId,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue