I'm following the Custom Dashboard tutorial, but having issues with the part that covers listing last weeks changes.
I keep getting the following error as soon as I add getUserLog:
An error occured
There was an error parsing the query. [ Token line number = 4,Token line offset = 39,Token in error = WHERE ]
Exception Details
System.Data.SqlServerCe.SqlCeException: There was an error parsing the query. [ Token line number = 4,Token line offset = 39,Token in error = WHERE ]
Stacktrace
at System.Data.SqlServerCe.SqlCeCommand.ProcessResults(Int32 hr)
at System.Data.SqlServerCe.SqlCeCommand.CompileQueryPlan()
at System.Data.SqlServerCe.SqlCeCommand.ExecuteCommand(CommandBehavior behavior, String method, ResultSetOptions options)
at System.Data.SqlServerCe.SqlCeCommand.ExecuteScalar()
at Umbraco.Core.Persistence.PetaPocoCommandExtensions.<>c__DisplayClass11_0.<ExecuteScalarWithRetry>b__0()
at Umbraco.Core.Persistence.FaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
at Umbraco.Core.Persistence.Database.ExecuteScalar[T](String sql, Object[] args)
at Umbraco.Core.Persistence.Database.Page[T](Int64 page, Int64 itemsPerPage, String sql, Object[] args)
at Umbraco.Core.Persistence.Repositories.AuditRepository.GetPagedResultsByQuery(IQuery`1 query, Int64 pageIndex, Int32 pageSize, Int64& totalRecords, Direction orderDirection, AuditType[] auditTypeFilter, IQuery`1 customFilter)
at Umbraco.Core.Services.AuditService.GetPagedItemsByUser(Int32 userId, Int64 pageIndex, Int32 pageSize, Int64& totalRecords, Direction orderDirection, AuditType[] auditTypeFilter, IQuery`1 customFilter)
at Umbraco.Web.Editors.LogController.GetCurrentUserLog(AuditType logType, Nullable`1 sinceDate)
at lambda_method(Closure , Object , Object[] )
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Web.Http.Filters.ActionFilterAttribute.<CallOnActionExecutedAsync>d__5.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.ActionFilterAttribute.<ExecuteActionFilterAsyncCore>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()
My code looks like this (copy from tutorial):
angular.module("umbraco").controller("WelcomeDashboardAdminController", function ($scope, userService, logResource, entityResource) {
//Set View Model
var vm = this;
//Get Current User
var user = userService.getCurrentUser().then(function (user) {
console.log(user);
vm.UserName = user.name;
});
logResource.getUserLog("save", new Date()).then(function (response) {
console.log(response);
var logEntries = [];
// loop through the response, and filter out save log entries we are not interested in
angular.forEach(response, function (item) {
// if no entity exists -1 is returned for the nodeId (eg saving a macro would create a log entry without a nodeid)
if (item.nodeId > 0) {
//this is the only way to tell them apart - whether the comment includes the words Content or Media!!
if (item.comment.match("(\\bContent\\b|\\bMedia\\b)")) {
if (item.comment.indexOf("Media") > -1) {
//log entry is a media item
item.entityType = "Media";
item.editUrl = "media/media/edit/" + item.nodeId;
}
if (item.comment.indexOf("Content") > -1) {
//log entry is a media item
item.entityType = "Document";
item.editUrl = "content/content/edit/" + item.nodeId;
}
//use entityResource to retrieve details of the content/media item
entityResource.getById(item.nodeId, item.entityType).then(function (ent) {
console.log(ent);
item.Content = ent;
});
logEntries.push(item);
}
}
console.log(logEntries);
vm.LogEntries = logEntries;
});
});
});
But the error occurs (status 500) as soon as I add getUserLog.
The error occurs in angular on line 3310:
w.send(j || "")
Is it possible using the logResource and entityResource with SqlCE at all?
Hope you guys can give me a push in the right direction
Alright. That's actually good to know. Was starting to get real frustrated, because I looked through my code so many times, without being able to locate what I did wrong.
Message":"No HTTP resource was found that matches the request URI 'http://eight.local/umbraco/backoffice/UmbracoApi/Log/GetLog?logtype=save&sinceDate=2019-07-19T18%3A19%3A06.095Z'.","MessageDetail":"No action was found on the controller 'Log' that matches the name 'GetLog'.
with this:
logResource.getLog("save", new Date())
.then(function (log) {
console.log(log);
});
Custom dashboard and SqlCE
Hi everyone
I'm following the Custom Dashboard tutorial, but having issues with the part that covers listing last weeks changes.
I keep getting the following error as soon as I add getUserLog:
My code looks like this (copy from tutorial):
But the error occurs (status 500) as soon as I add getUserLog.
The error occurs in angular on line 3310:
Is it possible using the logResource and entityResource with SqlCE at all?
Hope you guys can give me a push in the right direction
Best
Henrik
Hi Henrik,
Which version of Umbraco are you using ?
Dave
Hi Dave
I'm running 7.10.2 locally
Hi Henrik,
I can confirm this issue as well on 7.10.4 using sql ce.
Haven't tried on full SQL yet, but I don't think that should be a difference.
Best is to create a issue on http://issues.umbraco.org
Dave
Hi again Dave
Alright. That's actually good to know. Was starting to get real frustrated, because I looked through my code so many times, without being able to locate what I did wrong.
Best
Henrik
If you create the issue can you link it here ?
Dave
Hi Henrik,
I created the issue on the tracker : http://issues.umbraco.org/issue/U4-11458
Dave
Awesome, Dave.
Was a bit held up with work, so didn't have the time to create it earlier.
Thanks for creating on the tracker!
Have a great day :)
Best
Henrik
By the way.
You can use getLog on the logResource. That one works fine. But the results are not filtered on user.
Dave
Cool!
Gonna give that a go
And I'll keep an eye on the issue you created.
Once again thanks for your help, Dave :)
Henrik
Hi Henrik,
I created a PR to fix some issues when using the logResource. https://github.com/umbraco/Umbraco-CMS/pull/2719
I hope to get this merged in one of the next versions of Umbraco.
I also raised an issue for the umbraco docs that the tutorial needs to be updated : https://github.com/umbraco/UmbracoDocs/issues/894
Dave
And these have both been pulled in so the tutorial should work again in 7.13.x
Great. Thanks for the update :)
Did you get this to work?
In Umbraco 8 i'm getting.
with this:
is working on a reply...