I'm trying to set up a custom dashboard by following the Creating a Custom Dashboard tutorial linked below, but have run into a problem using logResource.
I'm having trouble getting any data back from logResource using either getUserLog or getLog with the type set to "save" and the date set to various dates between now and 2000. I always get back an empty array.
There are no errors logged in the JavaScript console.
I have published new documents, saved edits to existing documents, and tried creating a new user and running the same tests from that account. It seems that nothing is returned under any circumstances.
I'm using the latest version of Umbraco.
Does anyone have any suggestions on what else I can try?
logResource.getUserLog("save", new Date()).then(function (response) {
console.log(response);
});
and do you have the logResource injected into the controller?
angular.module("umbraco").controller("CustomWelcomeDashboardController", function ($scope, userService, logResource, entityResource) {
if you post your whole controller implementation can see if I can spot anything / can see if there is an issue with logResource on the version you are using.
I span up a copy of 7.7.6 (when you say 'latest' 7.6.6 above you mean 7.7.6?)
Copied across a completed version of tutorial, it works, cut and paste what you have above...
also works!
save update to content item and a media item, both appear on the dashboard...
and from your snapshot of the console.log output, you can see the dashboard is retrieving items from the userLog, for userId 1, but just the two updates to the DataTypes..
So the issue does appear to be that when you are saving an updated content item, or media item, the log of that event isn't either being made, or isn't being retrieved by getUserLog.
If it's not making it to the log, that must be a bug (but it's working fine for me in 7.6.6) if it's the second, then the other possibility is that the SinceDate (new Date()) bit or the UserId (the current user is used by getUserLog) is filtering these events out when retrieving the log?
Make sure you hit save, instead of save and publish, see if that makes a difference? and see what new Date() is generating on your machine, have a look in the Audit Log (right click the content item you just saved, and choose Audit Trail, and see if the action was recorded there.,..)
Thanks once again for taking the time to reply. I do indeed mean version 7.7.6 and not 7.6.6 - apologies.
Interestingly, it now appears to be working. I now have 247 items being returned by getLog(), and 3 items being returned by getUserLog(). I've not made any changes to the project since I previously commented, so I'm not really sure why it now works.
The only thing that has changed is that my computer has been restarted as I had it powered off over the weekend.
I did try fiddling with new Date() to set various dates in case that was the issue when troubleshooting, but that didn't seem to make a difference.
Also, given that getLog() doesn't require a particular user ID, and that still didn't return anything, it can't be that which was preventing the results from being returned.
Thank you very much for taking the time to investigate this! I only wish I could provide a better explanation of what actually broke or how restarting the machine fixed it.
logResource not returning any results
Hi all,
I'm trying to set up a custom dashboard by following the Creating a Custom Dashboard tutorial linked below, but have run into a problem using logResource.
https://our.umbraco.org/documentation/Tutorials/Creating-a-Custom-Dashboard/
I'm having trouble getting any data back from logResource using either getUserLog or getLog with the type set to "save" and the date set to various dates between now and 2000. I always get back an empty array.
I'm using code along these lines:
There are no errors logged in the JavaScript console.
I have published new documents, saved edits to existing documents, and tried creating a new user and running the same tests from that account. It seems that nothing is returned under any circumstances.
I'm using the latest version of Umbraco.
Does anyone have any suggestions on what else I can try?
Thanks!
Hi Dan
Which version of Umbraco? 7.7.6 ? (An issue with the logResource was fixed in 7.6.4 - http://issues.umbraco.org/issue/U4-9489)
have you tried:
});
and do you have the logResource injected into the controller?
if you post your whole controller implementation can see if I can spot anything / can see if there is an issue with logResource on the version you are using.
regards
Marc
Hi Marc,
Thanks for taking the time to reply and offer some help!
I am indeed running Umbraco 7.6.6, and have checked the umbraco.resources.js source file to confirm that I do have the fix.
I have tried the code you suggested, and my controller does resemble the one you have provided:
However, since testing it this morning I'm no longer getting a blank array! Unfortunately, it's not returning the items I was hoping for.
Yesterday afternoon I made some changes to some document types and data types, so this is being returned:
As you can see, the accompanying changes to content do not show in the list.
Thanks again.
Hi Dan
This is puzzling
I span up a copy of 7.7.6 (when you say 'latest' 7.6.6 above you mean 7.7.6?)
Copied across a completed version of tutorial, it works, cut and paste what you have above...
also works!
save update to content item and a media item, both appear on the dashboard...
and from your snapshot of the console.log output, you can see the dashboard is retrieving items from the userLog, for userId 1, but just the two updates to the DataTypes..
So the issue does appear to be that when you are saving an updated content item, or media item, the log of that event isn't either being made, or isn't being retrieved by getUserLog.
If it's not making it to the log, that must be a bug (but it's working fine for me in 7.6.6) if it's the second, then the other possibility is that the SinceDate (new Date()) bit or the UserId (the current user is used by getUserLog) is filtering these events out when retrieving the log?
Make sure you hit save, instead of save and publish, see if that makes a difference? and see what new Date() is generating on your machine, have a look in the Audit Log (right click the content item you just saved, and choose Audit Trail, and see if the action was recorded there.,..)
regards
Marc
Hi Marc,
Thanks once again for taking the time to reply. I do indeed mean version 7.7.6 and not 7.6.6 - apologies.
Interestingly, it now appears to be working. I now have 247 items being returned by getLog(), and 3 items being returned by getUserLog(). I've not made any changes to the project since I previously commented, so I'm not really sure why it now works.
The only thing that has changed is that my computer has been restarted as I had it powered off over the weekend.
I did try fiddling with new Date() to set various dates in case that was the issue when troubleshooting, but that didn't seem to make a difference.
Also, given that getLog() doesn't require a particular user ID, and that still didn't return anything, it can't be that which was preventing the results from being returned.
Thank you very much for taking the time to investigate this! I only wish I could provide a better explanation of what actually broke or how restarting the machine fixed it.
is working on a reply...