Copied to clipboard

Flag this post as spam?

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


  • mikkel 143 posts 365 karma points
    Jan 02, 2019 @ 13:07
    mikkel
    0

    Trying to make a Custom dasbord

    Hi everyone

    I'm about to make a dashboard for my back office. I use the guide umbraco even has on their website.

    https://our.umbraco.com/documentation/tutorials/Creating-a-Custom-Dashboard/

    It all works fine until I have to put the code snippet that shows a list of the last tasks the user has edited. Then the code does not work anymore. I have composed the code incorrectly or is there something I lack

    it is only the code in the customwelcomedashboard.controller.js i am talking about that dont work :D

    here is my code

    angular.module("umbraco").controller("CustomWelcomeDashboardController", function ($scope, userService, logResource, entityResource) {
        var vm = this;
        vm.UserName = 'guest';
        vm.UserLogHistory = [];
        var userLogOptions = {
            pageSize: 10,
            pageNumber: 1,
            orderDirection: "Descending",
            sinceDate: new Date(2018, 0, 1)
        };
    
        logResource.getPagedUserLog(userLogOptions)
            .then(function (response) {
                console.log(response)
                vm.UserLogHistory = response;
            });
    
        logResource.getPagedUserLog(userLogoptions)
            .then(function (response) {
                console.log(response)
                vm.UserLogHistory = response;
                var filteredLogEntries = [];
                // loop through the response, and filter out save log entries we are not interested in
                angular.forEach(response.items, 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) {
                        if (item.logType == "Save") {
                            if (item.entityType == "Media") {
                                // log entry is a media item
                                item.editUrl = "media/media/edit/" + item.nodeId;
                            }
                            if (item.entityType == "Document") {
                                // log entry is a media item
                                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;
                            });
                            filteredLogEntries.push(item);
                        }
                    }
                });
                vm.UserLogHistory.items = filteredLogEntries;
            });
    
        var user = userService.getCurrentUser().then(function (user) {
            console.log(user);
            vm.UserName = user.name;
        });
    });
    

    Thanks for looking at it :D

  • MuirisOG 378 posts 1277 karma points
    Jan 02, 2019 @ 14:19
    MuirisOG
    100

    Mikkel,

    we had problems with this tutorial, which were initially resolved by changing code as per the link below:

    https://our.umbraco.com/forum/extending-umbraco-and-using-the-api/88883-umbraco-angular-logresourcegetuserlog-returns-404-error

    However, we also ran into problems when users removed pages from the live site, so we abandoned this example totally.

    thanks

    Muiris

  • mikkel 143 posts 365 karma points
    Jan 03, 2019 @ 10:49
    mikkel
    0

    Hi MuirisOG thanks for answer i will try the the guide from the link you added :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies