mirror of
https://github.com/zadam/trilium.git
synced 2025-10-30 02:59:03 +01:00
chore(views/board): prepare to group by attribute
This commit is contained in:
parent
11547ecaa3
commit
951b5384a3
23
apps/client/src/widgets/view_widgets/board_view/data.ts
Normal file
23
apps/client/src/widgets/view_widgets/board_view/data.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import FNote from "../../../entities/fnote";
|
||||||
|
import froca from "../../../services/froca";
|
||||||
|
|
||||||
|
export async function getBoardData(noteIds: string[], groupByColumn: string) {
|
||||||
|
const notes = await froca.getNotes(noteIds);
|
||||||
|
const byColumn: Map<string, FNote[]> = new Map();
|
||||||
|
|
||||||
|
for (const note of notes) {
|
||||||
|
const group = note.getLabelValue(groupByColumn);
|
||||||
|
if (!group) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!byColumn.has(group)) {
|
||||||
|
byColumn.set(group, []);
|
||||||
|
}
|
||||||
|
byColumn.get(group)!.push(note);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
byColumn
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
import ViewMode, { ViewModeArgs } from "../view_mode";
|
import ViewMode, { ViewModeArgs } from "../view_mode";
|
||||||
|
import { getBoardData } from "./data";
|
||||||
|
|
||||||
const TPL = /*html*/`
|
const TPL = /*html*/`
|
||||||
<div class="board-view">
|
<div class="board-view">
|
||||||
@ -45,7 +46,8 @@ export default class BoardView extends ViewMode<StateInfo> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async renderBoard(el: HTMLElement) {
|
private async renderBoard(el: HTMLElement) {
|
||||||
|
const data = await getBoardData(this.noteIds, "status");
|
||||||
|
console.log("Board data:", data);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user