Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Henrik Vincent 122 posts 616 karma points
    Jun 08, 2018 @ 12:02
    Henrik Vincent
    0

    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:

    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

    Best

    Henrik

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jun 18, 2018 @ 09:24
    Dave Woestenborghs
    0

    Hi Henrik,

    Which version of Umbraco are you using ?

    Dave

  • Henrik Vincent 122 posts 616 karma points
    Jun 18, 2018 @ 09:27
    Henrik Vincent
    0

    Hi Dave

    I'm running 7.10.2 locally

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jun 18, 2018 @ 10:38
    Dave Woestenborghs
    0

    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

  • Henrik Vincent 122 posts 616 karma points
    Jun 19, 2018 @ 12:15
    Henrik Vincent
    0

    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

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jun 19, 2018 @ 12:26
    Dave Woestenborghs
    0

    If you create the issue can you link it here ?

    Dave

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jun 19, 2018 @ 12:56
    Dave Woestenborghs
    1

    Hi Henrik,

    I created the issue on the tracker : http://issues.umbraco.org/issue/U4-11458

    Dave

  • Henrik Vincent 122 posts 616 karma points
    Jun 20, 2018 @ 05:26
    Henrik Vincent
    0

    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

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jun 20, 2018 @ 06:49
    Dave Woestenborghs
    0

    By the way.

    You can use getLog on the logResource. That one works fine. But the results are not filtered on user.

    Dave

  • Henrik Vincent 122 posts 616 karma points
    Jun 22, 2018 @ 08:10
    Henrik Vincent
    0

    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

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jun 23, 2018 @ 08:14
    Dave Woestenborghs
    0

    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

  • Marc Goodson 2155 posts 14408 karma points MVP 9x c-trib
    Feb 12, 2019 @ 09:24
    Marc Goodson
    1

    And these have both been pulled in so the tutorial should work again in 7.13.x

  • Henrik Vincent 122 posts 616 karma points
    Feb 12, 2019 @ 09:35
    Henrik Vincent
    0

    Great. Thanks for the update :)

  • Thomas 319 posts 606 karma points c-trib
    Jul 19, 2019 @ 18:25
    Thomas
    0

    Did you get this to work?

    In Umbraco 8 i'm getting.

    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);
        });
    
Please Sign in or register to post replies

Write your reply to:

Draft