diff --git a/dashboards/static/dashboards/js/logbehavior.js b/dashboards/static/dashboards/js/logbehavior.js index 4bae214..e192806 100644 --- a/dashboards/static/dashboards/js/logbehavior.js +++ b/dashboards/static/dashboards/js/logbehavior.js @@ -22,14 +22,34 @@ var log = { refresh_log_data: function(init_date, end_date){ $.get("/dashboards/get_log_data", {init_date: init_date.format("YYYY-MM-DD HH:mm"), end_date: end_date.format("YYYY-MM-DD HH:mm")}).done(function(data){ - log.render_table("log_body", data); + log.render_table("log-body", data); }) }, render_table: function(target_id, data){ table_body = $('#' + target_id); + content = ""; + + //load row names at the top + + //build row html data data.forEach(function(datum){ - console.log(datum); + content += "" + html_helper.row_builder(datum) + ""; }); + + content += "
"; + + $(table_body).append(content); }, } + + +var html_helper = { + row_builder: function(datum){ + result = ""; + result = "" + datum.datetime + "" + "" + datum.user + "" + "" + datum.component + "" + + "" + datum.resource + "" + "" + datum.action + "" + "" + datum.context.category_name + "" + + "" + datum.context.subject_name + "" + ""+ datum.context + ""; + return result; + } +} \ No newline at end of file diff --git a/dashboards/views.py b/dashboards/views.py index c3d86b2..ca61997 100644 --- a/dashboards/views.py +++ b/dashboards/views.py @@ -135,6 +135,10 @@ def parse_log_queryset_to_JSON(logs): for log in logs: datum = {} datum['user'] = log.user - + datum['resource'] = log.resource + datum['datetime'] = log.datetime + datum['action'] = log.action + datum['context'] = log.context + datum['component'] = log.component data.append(datum) return data \ No newline at end of file -- libgit2 0.21.2