Copied to clipboard

Flag this post as spam?

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


  • Sekou Terry 22 posts 94 karma points
    Oct 20, 2017 @ 21:56
    Sekou Terry
    0

    Creating a "Latest Edits" Dashboard Tab

    I attempted to follow the steps outlined in this link: https://our.umbraco.org/documentation/Tutorials/Creating-a-Custom-Dashboard/ in order to create a "Welcome" page that included a list of items that had a node name, edit date, and the user who edited it. The link above includes this code that makes use of the entityResource service and the logResource service:

      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;
        });
    

    First I found out that the entityType property actually stores types as "MediaType" and "DocumentType" instead of just "Media" and "Document." I'm not sure who tell about correcting that. My question has two parts:

    It appears that the .getUserLog function only retrieves information for one user and .getLog retrieves log info from all users. It takes two arguments, the first being log type and the second being the max age of the log item. I've tried entering different date values and it still returns the last 7 days of logs (which is the default).

    Also I haven't been able to find out which service/function to use to retrieve usernames based on the userId. Is that information accessible?

    Thanks in advance.

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Oct 21, 2017 @ 09:07
    Dennis Aaen
    1

    Hi Sekou,

    Have you tried to see how this is build? https://our.umbraco.org/projects/backoffice-extensions/the-dashboard/ or perhaps this package can do what your are after?

    Hope this helps,

    /Dennis

  • Sekou Terry 22 posts 94 karma points
    Oct 23, 2017 @ 19:48
    Sekou Terry
    0

    Dennis,

    Thanks for posting that plugin. It looks like the author is rolling their own api extending UmbracoAuthorizedJsonController to populate JSON for dashboard tab pages. If this is the best way to do this for now I may go this route.

  • Dave Woestenborghs 3504 posts 12133 karma points MVP 8x admin c-trib
    Oct 21, 2017 @ 09:41
    Dave Woestenborghs
    0

    Hi Sekou,

    This is actually described in the documentation. There is a tutorial about creating custom dashboards. There is a a section that describes how to show latest edits :

    https://our.umbraco.org/documentation/Tutorials/Creating-a-Custom-Dashboard/#i-know-what-you-did-last-tuesday

    Dave

Please Sign in or register to post replies

Write your reply to:

Draft