obsidian-gitlab-issues icon indicating copy to clipboard operation
obsidian-gitlab-issues copied to clipboard

Add all Variables from the Gitlab Issue API Response

Open strxngewxrld opened this issue 1 year ago • 3 comments

Please add all available variables from the Gitlab Issue API to use in a custom template.

I see some potential to combine this plugin with the projects plugin, so you could show your issues in a kanban board or calendar. For better filtering, all available variables should be present.

strxngewxrld avatar Mar 24 '24 19:03 strxngewxrld

You can already use whatever filter parameters you like when defining your query.

benr77 avatar Mar 25 '24 07:03 benr77

yes, that's possible, but I can't use all values as handlebars, like 'labels' for example:

---
id: {{id}}
title: {{title}}
dueDate: {{due_date}}
webUrl: {{web_url}}
project: {{references.full}}
labels: {{#each labels}}#{{this}} {{/each}}
---

strxngewxrld avatar Mar 25 '24 08:03 strxngewxrld

any thoughts on that?

yes, that's possible, but I can't use all values as handlebars, like 'labels' for example:

---
id: {{id}}
title: {{title}}
dueDate: {{due_date}}
webUrl: {{web_url}}
project: {{references.full}}
labels: {{#each labels}}#{{this}} {{/each}}
---

strxngewxrld avatar Apr 15 '24 13:04 strxngewxrld

This should be resolved by #25 which has been included in the latest release I have just published.

benr77 avatar May 30 '24 06:05 benr77

@JonnyDeates, thx for the commit, works perfectly!

strxngewxrld avatar Jun 02 '24 06:06 strxngewxrld

Hey @strxngewxrld ! I'm trying to set up a custom template to mimic what you have above, now that all the attributes can be pulled in. Things like Assignee, last updated, and labels definitely are high on my list, as well as maybe finding a way to insert the webUrl as a formatted link so I can have a shorter "link" on a table and go straight out to my GitLab instance.

However, Obsidian is giving me an error trying to use your code above. It says that having #each is invalid with a message "your frontmatter is invalid." Any advice? I literally copied your example and removed the code block ticks around it as my first attempt at the template.

athenor avatar Sep 23 '24 20:09 athenor

Wait, I think I got it thanks to some help from a developer and his AI assistant. Looks like I needed to use quotes around the line in order to tell Obsidian how to interpret the # symbol.

Edit: Yep. I used the following to add as many properties as I felt was appropriate into the template, following the example in the code:

---
id: {{id}}
title: {{{title}}}
state: {{state}}
dueDate: {{due_date}}
webUrl: {{web_url}}
project: {{references.full}}
assignees: "{{#each assignees}}#{{name}} {{/each}}"
type: {{issue_type}}
task-status: {{task_status}}
create-date: {{created_at}}
update-date: {{updated_at}}
labels: "{{#each labels}}#{{this}} {{/each}}"
weight: {{weight}}
---

### {{{title}}}
##### Due on {{due_date}}

{{{description}}}

[View On Gitlab]({{web_url}})

I then pumped that into Dataview modifying the example query on the Readme - though this is still a work in progress:

TABLE WITHOUT ID file.link AS "GitLab Assigned Tasks", dueDate AS "Due Date", state AS "State", update-date AS "Date Updated", regexreplace(labels, ":", "/") AS "Labels", elink(webUrl, string(id)) AS "Issue ID" from "Data/Gitlab Issues"
SORT dueDate

athenor avatar Sep 23 '24 21:09 athenor