Added relative timestamps

Former-commit-id: 5ea7e7519cbe1059d9595a82229b7c7de3ef17bf
This commit is contained in:
Ziver Koc 2016-01-24 17:37:32 +01:00
parent 73ac1f8208
commit fc41b60386
11 changed files with 3641 additions and 14 deletions

View file

@ -16,6 +16,7 @@ import java.util.List;
import java.util.Map;
public class EventOverviewHttpPage extends HalHttpPage {
private static final int HISTORY_LIMIT = 200;
private static final String OVERVIEW_TEMPLATE = "web-resource/event_overview.tmpl";
private static final String DETAIL_TEMPLATE = "web-resource/event_detail.tmpl";
@ -52,8 +53,10 @@ public class EventOverviewHttpPage extends HalHttpPage {
Event event = Event.getEvent(db, id);
// get history data
PreparedStatement stmt = db.getPreparedStatement("SELECT * FROM event_data_raw WHERE event_id == ? ORDER BY timestamp DESC");
PreparedStatement stmt = db.getPreparedStatement(
"SELECT * FROM event_data_raw WHERE event_id == ? ORDER BY timestamp DESC LIMIT ?");
stmt.setLong(1, event.getId());
stmt.setLong(2, HISTORY_LIMIT);
List<HistoryData> history = DBConnection.exec(stmt, new HistoryDataListSqlResult());
Templator tmpl = new Templator(FileUtil.find(DETAIL_TEMPLATE));