feat: knowledge graph table view met sort, group en bulk edit
All checks were successful
On Pull Request to Main / test (pull_request) Successful in 48s
On Pull Request to Main / publish (pull_request) Successful in 1m20s
On Pull Request to Main / deploy-dev (pull_request) Successful in 1m52s

Voegt een Graph/Table toggle toe aan de admin Knowledge Graph. De tabel
ondersteunt sorteren per kolom, groeperen op type/relevance/theme/difficulty,
filteren op label, multi-select en bulk-wijzigen van type, learning_relevance
en relevance_locked.

Closes #10

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
RaymondVerhoef
2026-06-03 17:08:51 +02:00
parent 218f6e7d64
commit eb08c4ad96
3 changed files with 540 additions and 11 deletions

View File

@@ -104,6 +104,23 @@ export function useGraphData() {
return true;
}, []);
/**
* Apply the same patch to many topics in one call. `ids` is the set of
* topic IDs to update; `patch` is the partial-topic to merge into each one
* (e.g. `{ type: 'process' }` or `{ learning_relevance: 'core', relevance_locked: true }`).
*
* Persists each topic via db.upsertTopic in parallel and mirrors into state.
* Returns the number of topics actually written (selected ∩ existing).
*/
const bulkUpdateTopics = useCallback(async (ids, patch) => {
const idSet = new Set(ids);
const targets = topicsRef.current.filter(t => idSet.has(t.id));
const updated = targets.map(t => ({ ...t, ...patch }));
await Promise.all(updated.map(t => db.upsertTopic(t)));
setTopics(prev => prev.map(t => (idSet.has(t.id) ? { ...t, ...patch } : t)));
return updated.length;
}, []);
/** Remove a specific (source, target, type) relation triple. */
const removeRelation = useCallback(async (source, target, type) => {
await db.removeRelation(source, target, type);
@@ -165,6 +182,7 @@ export function useGraphData() {
snapshotMeta,
reload,
updateTopic,
bulkUpdateTopics,
deleteTopic,
addRelation,
removeRelation,