mgmeyers / obsidian-kanban

Create markdown-backed Kanban boards in Obsidian.
https://publish.obsidian.md/kanban/
GNU General Public License v3.0
3.24k stars 190 forks source link

Show cards from a search (or dataview query) #85

Open ryanjamurphy opened 3 years ago

ryanjamurphy commented 3 years ago

As discussed here: https://discord.com/channels/686053708261228577/840286238928797736/841748907273093120

It would be pretty neat to live-import cards matching a certain search or dataview query.

A couple of use cases:

I recognize that this is probably non-trivial, though—namely because the plugin would need to recognize that a search-generated card needs to be converted to a "real" card once it's dragged from the search to another list.

mgmeyers commented 3 years ago

Seems like a good idea to me. Do you imagine this to be like a one-way sync? Eg. what would happen if you delete a note? Should it also be removed from the board?

CovetingEpiphany2152 commented 3 years ago

In my opinion, if the user deletes the note, then it should be removed from the board as well. If the user is no longer interested in keeping the file for said task/note, it would make sense that the board should be cleared too.

CovetingEpiphany2152 commented 3 years ago

I would imagine this being a two-way sync, but the kanban board plugin should only be handling syncing from files to board. 1) the kanban board would sync with the files, and populate itself based on the user's query

miguelmarcos commented 3 years ago

This is quite a powerful concept, a self-updating Kanban board. I think two-way sync is necessary.

CovetingEpiphany2152 commented 3 years ago

Unfortunately, it seems like the dataview plugin-facing API is not available yet. So I don't think this can be done with dataview at the moment.

ryanjamurphy commented 3 years ago

Two-way sync would certainly be the ultimate form, but I also think a one-way sync would be a valuable MVP.

skillhacker-code commented 3 years ago

Yes , it would be so powerful

timconnorz commented 3 years ago

plus 1 to this. Two-way sync would be the holy-grail

pjeby commented 3 years ago

As of version 0.4.4, you can now select the contents of a dataview list (or any other list, for that matter) and either drag-drop or copy-paste to the "+ Add a card" area of a lane, and import multiple items to the board without needing to do them one-by-one. Tables don't work (you get a card for every cell), but you can drag the links one by one and drop them in that area to add them to a column.

This means that if you design your source dataview to exclude notes already linked from your board, you'll only need to transfer new items once.

If you want to automate adding new items to a board, you might try the Workbench plugin -- just configure the plugin to prefix workbench items with "- [ ] ", designate a Kanban board as your workbench note, and then you can define a hotkey to link the current note from the workbench, which will add it to the last column of the board. (Assuming you're not using archiving.)

When dragging between boards (#145) becomes available, I plan to just have a Workbench note with one column as my global "inbox", and then drag cards from there to other kanban boards.

A possible route forward for more automation is exposing an API from this plugin (to e.g. add cards to a specified board, etc.) so that other plugins and scripts can simply call the API rather than reinventing wheels, or having to implement all possible scenarios within this plugin. (For example, if there was an API to get a board's contents, and another to modify them, then other plugins could be written to do arbitrary sync operations from any data source.)

Such an API might work a bit like the periodic notes and calendar plugins' sharing of an API library for managing various settings and providing various operations. Exposing this plugin's markdown parser and generator along with some related utilities as a separate library would allow other plugins to easily do their own things with boards.

marmingr commented 2 years ago

Here's a way to pre-populate a new Kanban based on a dataview search using templater and referencing the meta data as columns - Very basic and really only for initial kanban generation, but saves a lot of initial setup.

Template.md

kanban-plugin: basic


<%* let searchresults = app.plugins.plugins.dataview.api.pages(""); for (let group of searchresults.groupBy(p => p.metafield)) { tR += "## " + group.key + "\n"; group.rows.forEach(row => { tR += "- [ ] " + "[[" + row.file.name + "]]" + "\n"; }) }; %>

dxcore35 commented 2 years ago

Here's a way to pre-populate a new Kanban based on a dataview search using templater and referencing the meta data as columns - Very basic and really only for initial kanban generation, but saves a lot of initial setup.

Template.md

kanban-plugin: basic

<%* let searchresults = app.plugins.plugins.dataview.api.pages(""); for (let group of searchresults.groupBy(p => p.metafield)) { tR += "## " + group.key + "\n"; group.rows.forEach(row => { tR += "- [ ] " + "[[" + row.file.name + "]]" + "\n"; }) }; %>

This is not solution we have been asked for. There must be fixed dataview query in Kanbana, not a templater.

marmingr commented 2 years ago

Here's a way to pre-populate a new Kanban based on a dataview search using templater and referencing the meta data as columns - Very basic and really only for initial kanban generation, but saves a lot of initial setup.

Template.md

kanban-plugin: basic <%* let searchresults = app.plugins.plugins.dataview.api.pages(""); for (let group of searchresults.groupBy(p => p.metafield)) { tR += "## " + group.key + "\n"; group.rows.forEach(row => { tR += "- [ ] " + "[[" + row.file.name + "]]" + "\n"; }) }; %>

This is not solution we have been asked for. There must be fixed dataview query in Kanbana, not a templater.

Agreed, was just offering a potential workaround for those who can't wait for the feature. It would also be viable as Daily Kanban board template or a disposable state of play kanban.

andyjohansson commented 1 year ago

This would be so cool!

fetwar commented 1 year ago

+1

Developing this exact feature for this plugin is on my to-do list, I've taken down a lot of notes from this thread and others.

If anyone already has a branch in progress or has further ideas I'd love to hear them

giggio commented 10 months ago

Unfortunately, it seems like the dataview plugin-facing API is not available yet. So I don't think this can be done with dataview at the moment.

It looks like it is available now:

Plugin Access

You can access the Dataview Plugin API (from other plugins or the console) through app.plugins.plugins.dataview.api; this API is similar to the codeblock reference, with slightly different arguments due to the lack of an implicit file to execute the queries in. For more information, check out the Plugin API reference.

lightningRalf commented 6 months ago

Isn't this now closed? with https://github.com/mgmeyers/obsidian-kanban/tree/2.0.0-beta ?

axgdcode commented 4 months ago

Isn't this now closed? with https://github.com/mgmeyers/obsidian-kanban/tree/2.0.0-beta ?

@lightningRalf can you please explain why?