obsidian-kanban icon indicating copy to clipboard operation
obsidian-kanban copied to clipboard

Question: How to use this with dataviewjs to dynamically build a kanban

Open jplumeyssa opened this issue 2 years ago • 3 comments

Hi,

I'm not sure where else to ask this question, so I'm asking here. I have a bit of very simple (probably terrible) dataviewjs that generates a list of cards grouped by a field of metadata. It produces what should be the markdown to generate columns in Kanban.

dataviewjs
// dv.pages("#concerns AND -Resources");
let allconcerns = dv.pages("#concerns and #data");
for (let group of allconcerns.groupBy(p => p.status)) { 
  dv.header(2, group.key);
  group.rows.forEach(row => {
     dv.paragraph("- [ ] " + "[[" + row.file.name + "]]");
  })
 }; 

When I show the kanban note as markdown, it shows the result of the query, which looks good in the markdown view. But the board doesn't update to include the results. I assume it has something to do with when the plugin updates, but not sure how to approach this problem.

jplumeyssa avatar Sep 28 '21 16:09 jplumeyssa

+1 a feature to automate the Kanban based on dataviewjs would ease a lot of manual tasks of this wonderfull plugin.

EmileVezinaCoulombe avatar Oct 09 '21 04:10 EmileVezinaCoulombe

This has been kicking around in my head a bit; I'm offering up some thoughts on this integration:

I'll agree that data driven lists seem pretty neat, but I think it would require some forethought to not get confusing and/or frustrating really fast. The key problem is that leveraging obsidian-dataview means that obsidian-kanban no longer owns its data model, which foils the basic model by which obsidian-kanban persists user updates. For example, when the user drags a card the markdown is updated to reflect that move, whether reordering a list or moving a card between lists: the markdown is the persistent data model.

But if lists are generated via a Dataview, cards can no longer be moved between lists, reordered, etc. User operations such as drag and drop no longer make sense. There's no way in general for obsidian-kanban to know what to do in that situation, because "moving" a card now depends on the semantics of one or more dataview queries and requires somehow knowing how to change data in the rest of the Obsidian vault, not just in the kanban document.

While a card-style dataview-driven dashboard seems appealing (I have a specific use in mind for one!), I think it's a misnomer to think of it as a traditional "Kanban board". It's really a read-only card style UI that updates automatically based on the dataview queries. It might be possible to integrate this into obsidian-kanban, but my gut check is that it would need to be a new kanban type, ala kanban-plugin: dataview. Most card operations would be disabled in this mode. Either the whole board would be generated (e.g. lists and cards come from queries), or perhaps just the cards within lists (allowing lists to be added/removed/renamed/reordered, but not cards).

There are likely other interesting integrations as well. E.g. a dataview query that doesn't define a list, but just updates it. Example: imagine a PARA dashboard with a list for each Area, and Projects under in the Area list they belong to. It'd be neat to be able to write a query that could:

  1. Look for all project documents under the Projects/ folder.
  2. Collate those by the #area-XXX tag in each project.
  3. Update each Area list in the kanban by adding only new projects for that Area (i.e. missing from the list).

The kanban would still just be plain Markdown, updated and controlled by the user. But there would be an easy way to keep it in sync with the other docs in the vault that represented the dashboard's "source of truth".

jwhitley avatar Dec 17 '21 16:12 jwhitley

Agree with most of your thoughts @jwhitley but there have been recent developments that could allow for this. See https://github.com/RafaelGB/obsidian-db-folder, https://github.com/trey-wallis/obsidian-notion-like-tables, etc. See https://github.com/blacksmithgu/obsidian-dataview/discussions/1015 for further discussion. Metaedit could also potentially be used as a dependency.

AB1908 avatar Jun 17 '22 23:06 AB1908