I need to make a custom status page in the Umbraco backoffice that displays the entire site's content tree (with everything always expanded), and displays the publish state of certain types of nodes (those with document type aliases containing certain a certain string) via color coding.
It seems like a custom Dashboard is the way to do this, but so far I haven't found any specific info on how I could output a customized content tree like this.
I feel like if I could get some code set up that recursively outputs all child nodes as text labels, I could probably handle the rest, but I'm not too familiar with AngularJS, so I don't know how to do that.
Is anyone able to point me in the right direction? Any suggestions or tips would be appreciated.
Thanks Dennis. I was able to get started by following those instructions, but I am stuck on how to get the root node of my website (or its ID), so I can get child content from it. I don't want to hard code an ID, because this will break across local/dev/live. Can anyone point me in the right direction?
Thanks for the reply. I need to access the root node from within AngularJS in a custom Dashboard, though. ContentService is a C# API. Would I need to do something like set up a surface controller that uses the C# GetRootContent() method just to get the root node from within AngularJS?
Thanks, but unfortunately that won't work for me, because I don't have an initial node in the tree already at hand. My main issue is that I need to get some sort of entry point into the content tree so I can start traversing, without referencing a node ID.
Does anyone have any idea how I could do this? I don't see any methods that look to be of much help in the API documentation.
Looks like I found a way in! Here's the code I used:
angular.module("umbraco").controller("TranslationsDashboardController", function ($scope, entityResource, contentResource, treeResource, treeService) {
var vm = this;
treeService.getTree({ section: "content" })
.then(function (content) {
console.log(content);
});
});
In the console I then get an object for the root of the Content section tree (above even my Homepage node), which I can then get the child nodes of to start traversing.
EDIT: Upon looking at the results, it looks like I could've also used the node ID "-1" to get the same node by ID.
Custom Dashboard Tips?
I need to make a custom status page in the Umbraco backoffice that displays the entire site's content tree (with everything always expanded), and displays the publish state of certain types of nodes (those with document type aliases containing certain a certain string) via color coding.
It seems like a custom Dashboard is the way to do this, but so far I haven't found any specific info on how I could output a customized content tree like this.
I feel like if I could get some code set up that recursively outputs all child nodes as text labels, I could probably handle the rest, but I'm not too familiar with AngularJS, so I don't know how to do that.
Is anyone able to point me in the right direction? Any suggestions or tips would be appreciated.
Thanks,
David
Hi David,
Dont know if you have seen this before. We have some documentation on how to setup a custom dashboard.
Hope you can get some inspiration and help from this guide - https://our.umbraco.org/documentation/tutorials/Creating-a-Custom-Dashboard/
/Dennis
Thanks Dennis. I was able to get started by following those instructions, but I am stuck on how to get the root node of my website (or its ID), so I can get child content from it. I don't want to hard code an ID, because this will break across local/dev/live. Can anyone point me in the right direction?
Thanks,
David
Hi David
Have you seen the content service https://our.umbraco.org/documentation/reference/management/services/contentservice#getrootcontent
There is a GetRootContent() method
Hope this helps,
/Dennis
Hi Dennis,
Thanks for the reply. I need to access the root node from within AngularJS in a custom Dashboard, though. ContentService is a C# API. Would I need to do something like set up a surface controller that uses the C# GetRootContent() method just to get the root node from within AngularJS?
Perhaps this can be a help or inspiration
https://our.umbraco.org/forum/developers/extending-umbraco/73796-how-to-get-the-parentid-of-the-current-node-in-custom-tree-using-angularjs
Thanks, but unfortunately that won't work for me, because I don't have an initial node in the tree already at hand. My main issue is that I need to get some sort of entry point into the content tree so I can start traversing, without referencing a node ID.
Does anyone have any idea how I could do this? I don't see any methods that look to be of much help in the API documentation.
Looks like I found a way in! Here's the code I used:
In the console I then get an object for the root of the Content section tree (above even my Homepage node), which I can then get the child nodes of to start traversing.
EDIT: Upon looking at the results, it looks like I could've also used the node ID "-1" to get the same node by ID.
is working on a reply...