margin-top: 1em;
}
-#reports-list .body textarea {
- width: 100%;
- height: 24em;
- max-height: 24em;
- resize: none;
+#reports-list .movie-list thead th,
+#reports-list .movie-list tbody tr:last-child {
+ border-bottom: 1px solid #d6d6d6; /* non-RGBA fallback */
+ border-bottom: 1px solid rgba(0,0,0,.1);
+}
+
+#reports-list .movie-list tbody th,
+#reports-list .movie-list tbody td {
+ border-bottom: 1px solid #e6e6e6; /* non-RGBA fallback */
+ border-bottom: 1px solid rgba(0,0,0,.05);
+}
+
+#reports-list .movie-list tbody tr:last-child th,
+#reports-list .movie-list tbody tr:last-child td {
+ border-bottom: 0;
+}
+
+#reports-list .movie-list tbody tr:nth-child(odd) td,
+#reports-list .movie-list tbody tr:nth-child(odd) th {
+ background-color: #eeeeee; /* non-RGBA fallback */
+ background-color: rgba(0,0,0,.04);
}
/*security dashboard styles*//*END*/
"</div>"
);
- data.reports.forEach(function(report) {
- var status = "ok";
-
- if (report.result != 0) {
- status = "err";
- }
-
- $(m_dashboard).find(".device-info .list").append(
- "<div class='item'>" +
- "<div class='key'>" + report.name + "</div>" +
- "<div class='value " + status + "'</div>" +
- "</div>"
- );
- });
-
$(m_dashboard).append("<div class='agent-list'></div>");
data.agents.forEach(function(agent) {
devicesController.appendDeviceHtml(device, m_reports);
$(m_reports).append("<div id='reports-list'></div>");
- reports.forEach(function(report){
- $(m_reportsList).append(
- "<div class='item' data-item='" + report.name + "'>" +
- "<div class='name-lable'>Name:</div><div class='name'>" + report.name + "</div>" +
- "<div class='date-lable'>Date:</div><div class='date'>" + report.date + "</div>" +
- "<div class='body'><textarea readonly='readonly' data-role='none'>" + JSON.stringify(report.data, null, 4) + "</textarea></div>" +
- "</div>"
- );
+ var reportNames =[];
+
+ if (reports.hasOwnProperty(DashboardController.Report.SMACK) &&
+ reports[DashboardController.Report.SMACK].length > 0) {
+ reportNames.push(DashboardController.Report.SMACK);
+ }
+ if (reports.hasOwnProperty(DashboardController.Report.DAC) &&
+ reports[DashboardController.Report.DAC].length > 0) {
+ reportNames.push(DashboardController.Report.DAC);
+ }
+ if (reports.hasOwnProperty(DashboardController.Report.SYSCALL) &&
+ reports[DashboardController.Report.SYSCALL].length > 0) {
+ reportNames.push(DashboardController.Report.SYSCALL);
+ }
+
+ reportNames.forEach(function(reportName) {
+ var displayName = DashboardController.getReportName(reportName);
+
+ var thead = "";
+ var tbody = "";
+
+ switch (reportName) {
+ case DashboardController.Report.SMACK:
+ thead =
+ "<tr>" +
+ "<th>PID</th>" +
+ "<th>Command</th>" +
+ "<th>Subject</th>" +
+ "<th>Object</th>" +
+ "<th>LSM</th>" +
+ "<th>Path</th>" +
+ "<th>Requested</th>" +
+ "<th>Dev</th>" +
+ "<th>Date</th>" +
+ "</tr>";
+
+ reports[reportName].forEach(function(report) {
+ tbody +=
+ "<tr>" +
+ "<th>" + report.pid + "</td>" +
+ "<td>" + report.comm + "</td>" +
+ "<td>" + report.subject + "</td>" +
+ "<td>" + report.object + "</td>" +
+ "<td>" + report.lsm + "</td>" +
+ "<td>" + report.path + "</td>" +
+ "<td>" + report.requested + "</td>" +
+ "<td>" + report.dev + "</td>" +
+ "<td>" + report.date + "</td>" +
+ "</tr>";
+ });
+ break;
+ case DashboardController.Report.DAC:
+ thead =
+ "<tr>" +
+ "<th>PID</th>" +
+ "<th>UID</th>" +
+ "<th>Exe</th>" +
+ "<th>Subj</th>" +
+ "<th>Command</th>" +
+ "<th>TTY</th>" +
+ "<th>Success</th>" +
+ "<th>Date</th>" +
+ "</tr>";
+
+ reports[reportName].forEach(function(report) {
+ tbody +=
+ "<tr>" +
+ "<th>" + report.pid + "</td>" +
+ "<td>" + report.uid + "</td>" +
+ "<td>" + report.exe + "</td>" +
+ "<td>" + report.subj + "</td>" +
+ "<td>" + report.comm + "</td>" +
+ "<td>" + report.success + "</td>" +
+ "<td>" + report.tty + "</td>" +
+ "<td>" + report.date + "</td>" +
+ "</tr>";
+ });
+ break;
+ default:
+ break;
+ }
+
+ var reportHtml = "<div class='item' data-item='" + reportName + "'>" +
+ "<div class='name-lable'>Name:</div><div class='name'>" + displayName + " report</div>" +
+ "<table data-role='table' data-mode='reflow' class='movie-list ui-responsive'>" +
+ "<thead>" +
+ thead +
+ "</thead>" +
+ "<tbody>" +
+ tbody +
+ "</tbody>" +
+ "</table>" +
+ "</div>";
+
+ $(m_reportsList).append(reportHtml);
});
- $(m_reportsList).find(".item:first").addClass("active");
var reportCarousel = new Carousel();
reportCarousel.init(m_reportsList);
+ $(m_reportsList).trigger("create");
+ $(m_reportsList).find(".item:first").addClass("active");
}
}
}
//context of the current dashboard
DashboardController.Context = {
device: {}
+}
+
+DashboardController.Report = {
+ SMACK: "smack",
+ DAC: "dac",
+ SYSCALL: "syscall"
+};
+
+DashboardController.getReportName = function(type) {
+ switch(type) {
+ case DashboardController.Report.SMACK:
+ return "SMACK";
+ case DashboardController.Report.DAC:
+ return "DAC";
+ case DashboardController.Report.SYSCALL:
+ return "SYSCALL";
+ default:
+ console.log("No such report type: " + type);
+ return type;
+ }
}
\ No newline at end of file