From 4a5237c1930f267a2e9f7a9d735f1a556c9f018b Mon Sep 17 00:00:00 2001 From: Sasha Sherstnev Date: Mon, 2 Dec 2013 11:58:08 +0000 Subject: [PATCH] Improve UI of the website Remove java code from JSP --- server/compbio/controllers/DBUpdateController.java | 12 +++++ .../controllers/DailyStatisticsController.java | 14 ++++-- .../controllers/JobExecutionTimeController.java | 17 +++++-- webapp/view/fragments/header_database.jsp | 5 +- webapp/view/fragments/mainmenu.jsp | 3 +- webapp/view/queryIPStatistics.jsp | 18 ++++--- webapp/view/queryJobStatistics.jsp | 51 +++++++++----------- webapp/view/queryProteinSequenceCounter.jsp | 16 ++++-- webapp/view/queryRemoveJobs.jsp | 41 +++++++++------- webapp/view/queryTimeExecution.jsp | 22 ++++----- webapp/view/reportJobStatistics.jsp | 22 ++++++--- webapp/view/reportTimeExecution.jsp | 26 ++++++---- 12 files changed, 151 insertions(+), 96 deletions(-) diff --git a/server/compbio/controllers/DBUpdateController.java b/server/compbio/controllers/DBUpdateController.java index 1d84026..c5b2154 100644 --- a/server/compbio/controllers/DBUpdateController.java +++ b/server/compbio/controllers/DBUpdateController.java @@ -1,5 +1,6 @@ package compbio.controllers; +import java.util.Calendar; import java.util.Map; import org.springframework.stereotype.Controller; @@ -18,6 +19,17 @@ public class DBUpdateController { @RequestMapping(value = "/database/remove", method = RequestMethod.GET) public String initRemoveForm(Map model) { + Calendar cal = Calendar.getInstance(); + String date2 = cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DATE); + cal.add(Calendar.DATE, -3); + String date1 = cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DATE); + String jobid = "jp_NzBOJKo"; + + model.put("samplejobid", jobid); + model.put("date1", date1); + model.put("date2", date2); + model.put("sampleip", "127.0.0.1"); + model.put("sampleseq", "ATA"); return "queryRemoveJobs"; } diff --git a/server/compbio/controllers/DailyStatisticsController.java b/server/compbio/controllers/DailyStatisticsController.java index fd7a0db..22df505 100644 --- a/server/compbio/controllers/DailyStatisticsController.java +++ b/server/compbio/controllers/DailyStatisticsController.java @@ -26,6 +26,14 @@ public class DailyStatisticsController { @RequestMapping(value = "/stat", method = RequestMethod.GET) public String initFindForm(Map model) { + Calendar cal = Calendar.getInstance(); + String date2 = cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DATE); + cal.add(Calendar.DATE, -3); + String date1 = cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DATE); + + model.put("date1", date1); + model.put("date2", date2); + return "queryJobStatistics"; } @@ -40,13 +48,13 @@ public class DailyStatisticsController { date1 = StatisticsProt.DateFormatYYMMDD(cr.earliestDate()); date2 = cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DAY_OF_MONTH); } - model.put("data1", date1); - model.put("data2", date2); + model.put("date1", date1); + model.put("date2", date2); List res = cr.countJobs(date1, date2); model.put("result", res); final long endTime = System.currentTimeMillis(); model.put("timeExecution", (endTime - startTime)); - model.put("flag", option); + model.put("option", option); return "/reportJobStatistics"; } diff --git a/server/compbio/controllers/JobExecutionTimeController.java b/server/compbio/controllers/JobExecutionTimeController.java index 0917bde..191a40c 100644 --- a/server/compbio/controllers/JobExecutionTimeController.java +++ b/server/compbio/controllers/JobExecutionTimeController.java @@ -20,24 +20,31 @@ public class JobExecutionTimeController { @RequestMapping(value = "/exectime", method = RequestMethod.GET) public String initFindForm(Map model) { + Calendar cal = Calendar.getInstance(); + String date2 = cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DATE); + cal.add(Calendar.DATE, -3); + String date1 = cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DATE); + + model.put("date1", date1); + model.put("date2", date2); return "queryTimeExecution"; } @RequestMapping(value = "/exectime/query", method = RequestMethod.GET) - public String findSequence(@RequestParam("data1") String date1, @RequestParam("data2") String date2, + public String findSequence(@RequestParam("date1") String date1, @RequestParam("date2") String date2, @RequestParam(value="option", required=false) String option, Map model) { final long startTime = System.currentTimeMillis(); CassandraRequester sp = new CassandraRequester(); - if (option.equals("AllDates")) { + if (option.equals("AllDates,off")) { Calendar cal = Calendar.getInstance(); date1 = StatisticsProt.DateFormatYYMMDD(sp.earliestDate()); date2 = cal.get(Calendar.YEAR) + "/" + (cal.get(Calendar.MONTH) + 1) + "/" + cal.get(Calendar.DAY_OF_MONTH); } - model.put("data1", date1); - model.put("data2", date2); + model.put("date1", date1); + model.put("date2", date2); + model.put("option", option); model.put("result", sp.extractExecutionTime(date1, date2)); - model.put("flag", option); final long endTime = System.currentTimeMillis(); model.put("timeExecution", (endTime - startTime)); return "/reportTimeExecution"; diff --git a/webapp/view/fragments/header_database.jsp b/webapp/view/fragments/header_database.jsp index 02eb0ad..151b39a 100644 --- a/webapp/view/fragments/header_database.jsp +++ b/webapp/view/fragments/header_database.jsp @@ -23,5 +23,8 @@ function show(el, id) { document.getElementById(id).style.visibility = (el.checked)?"visible":"hidden"; } - + function hide(el, id) { + document.getElementById(id).style.visibility = (el.checked)?"hidden":"visible"; + } + diff --git a/webapp/view/fragments/mainmenu.jsp b/webapp/view/fragments/mainmenu.jsp index 56596dc..ed67bb7 100644 --- a/webapp/view/fragments/mainmenu.jsp +++ b/webapp/view/fragments/mainmenu.jsp @@ -18,8 +18,9 @@