http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/swimlanes-event-data-js.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/swimlanes-event-data-js.jsp b/src/main/web/hicc/jsp/swimlanes-event-data-js.jsp deleted file mode 100644 index 1fa956b..0000000 --- a/src/main/web/hicc/jsp/swimlanes-event-data-js.jsp +++ /dev/null @@ -1,302 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = "java.util.Calendar, java.util.Date, java.sql.*, java.text.SimpleDateFormat, java.util.*, java.sql.*,java.io.*,java.lang.Math, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, java.lang.StringBuilder, org.apache.hadoop.chukwa.hicc.ClusterConfig, org.apache.hadoop.chukwa.hicc.TimeHandler, org.apache.hadoop.chukwa.util.DatabaseWriter, org.apache.hadoop.chukwa.database.Macro, org.apache.hadoop.chukwa.database.DatabaseConfig, org.apache.hadoop.chukwa.util.XssFilter" %> -<%@ page session="true" %> -<% -HashMap<String, String> state_colours = new HashMap<String, String>(); -state_colours.put("map","#0000cc"); -state_colours.put("reduce","#00cc00"); -state_colours.put("reduce_reducer", "#ff0000"); -state_colours.put("reduce_shufflewait", "#330000"); -state_colours.put("reduce_sort", "#990000"); -String defaultcolour = new String("#333333"); - -response.setContentType("text/javascript"); - -XssFilter xf = new XssFilter(request); -TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone")); -long start = time.getStartTime(); -long end = time.getEndTime(); -String cluster = (String) session.getAttribute("cluster"); -String table = "mapreduce_fsm"; - -if(xf.getParameter("event_type")!=null) { - table = xf.getParameter("event_type"); -} -String query = "select job_id,friendly_id,start_time,finish_time,start_time_millis,finish_time_millis,status,state_name,hostname from ["+table+"] where finish_time between '[start]' and '[end]'"; -Macro mp = new Macro(start,end,query, request); -query = mp.toString() + " order by start_time"; - -out.print("/" + "/" + "swimlanes: " + mp.toString() + " cluster: " + cluster); - -ArrayList<HashMap<String, Object>> events = new ArrayList<HashMap<String, Object>>(); - -Connection conn = null; -Statement stmt = null; -ResultSet rs = null; - -DatabaseWriter dbw = new DatabaseWriter(cluster); -try { - rs = dbw.query(query); - ResultSetMetaData rmeta = rs.getMetaData(); - int col = rmeta.getColumnCount(); - while (rs.next()) { - HashMap<String, Object> event = new HashMap<String, Object>(); - long event_time=0; - for(int i=1;i<=col;i++) { - if(rmeta.getColumnType(i)==java.sql.Types.TIMESTAMP) { - event.put(rmeta.getColumnName(i),rs.getTimestamp(i).getTime()); - } else { - event.put(rmeta.getColumnName(i),rs.getString(i)); - } - } - events.add(event); - } -} catch (SQLException ex) { - // handle any errors - //out.println("SQLException: " + ex.getMessage()); - //out.println("SQLState: " + ex.getSQLState()); - //out.println("VendorError: " + ex.getErrorCode()); -} finally { - // it is a good idea to release - // resources in a finally{} block - // in reverse-order of their creation - // if they are no-longer needed - dbw.close(); -} -%> -$(function () { -<% - SimpleDateFormat format = new SimpleDateFormat("MMM dd yyyy HH:mm:ss"); - HashMap<String, Integer> reduce_ytick_ids = new HashMap<String, Integer>(); - - StringBuilder opts_colour_string, opts_series_string, opts_data_string; - opts_colour_string = new StringBuilder(); - opts_series_string = new StringBuilder(); - opts_data_string = new StringBuilder("["); - - StringBuilder withstart_points_series_string = new StringBuilder(); - StringBuilder nostart_points_series_string = new StringBuilder(); - StringBuilder start_points_data_string = new StringBuilder(); - StringBuilder start_points_colour_string = new StringBuilder(); - - StringBuilder lookupFunctionString = new StringBuilder(); - - out.println("/" + "/" + events.size() + " results returned."); - int unique_plot_yticks = 0; - int global_ycounter = 1; - -%> $("#resultcountholder").text("<%= events.size() %> states returned."); -<% - - int start_millis = 0, end_millis = 0; - for(int i=0;i<events.size();i++) { - HashMap<String, Object> event = events.get(i); - start=(Long)event.get("start_time"); - end=(Long)event.get("finish_time"); - String event_time = format.format(start); - String launch_time = format.format(event.get("start_time")); - String event_end_time = format.format(end); - String cell = (String) event.get("state_name"); - start_millis = Integer.parseInt(((String)event.get("start_time_millis"))); - end_millis = Integer.parseInt(((String)event.get("finish_time_millis"))); - - String colourstring = null; - if (state_colours.containsKey(cell)) { - colourstring = state_colours.get(cell); - } else { - colourstring = defaultcolour; - } - %>// <%= event.get("friendly_id") %> -<% - float ytick; - if (cell.startsWith("reduce")) { - Integer thenum = null; - thenum = reduce_ytick_ids.get((String)event.get("friendly_id")); - if (thenum != null) { - ytick = thenum.intValue();%> // old -<% - } else { - ytick = global_ycounter; - reduce_ytick_ids.put((String)event.get("friendly_id"),new Integer(global_ycounter)); - global_ycounter++; %> // new -<% - } - if (cell.endsWith("reducer")) { - ytick += 0.75; - } else if (cell.endsWith("sort")) { - ytick += 0.5; - } else if (cell.endsWith("shufflewait")) { - ytick += 0.25; - } -%> var d<%= i %> = [[<%= start %>,<%= ytick %>],[<%= end %>,<%= ytick %>]]; -<% - } else { - ytick = global_ycounter; -%> var d<%= i %> = [[<%= start %>,<%= global_ycounter %>],[<%= end %>,<%= global_ycounter %>]]; -<% - global_ycounter++; - } - -%> var ds<%= i %> = [[<%= start %>,<%= ytick %>]]; -<% - start_points_data_string.append(","); - start_points_data_string.append("ds"); - start_points_data_string.append(i); - - lookupFunctionString.append("if (y == "); - lookupFunctionString.append(ytick); - lookupFunctionString.append(" ) {\n"); - lookupFunctionString.append("return '"); - lookupFunctionString.append("State: "); - lookupFunctionString.append(event.get("state_name")); - lookupFunctionString.append(" / Status: "); - lookupFunctionString.append(event.get("status")); - lookupFunctionString.append(" <br />"); - lookupFunctionString.append("Host: "); - lookupFunctionString.append(event.get("hostname")); - lookupFunctionString.append(" <br />"); - lookupFunctionString.append("Duration: "); - lookupFunctionString.append((end-start)+(end_millis-start_millis)); - lookupFunctionString.append("ms <br />"); - lookupFunctionString.append("["); - lookupFunctionString.append(event.get("friendly_id")); - lookupFunctionString.append("]"); - lookupFunctionString.append("';\n"); - lookupFunctionString.append("}\n"); - - opts_series_string.append("lines: { show:true }, \n"); - withstart_points_series_string.append("points: {show:true}, \n"); - nostart_points_series_string.append("points: {show:false}, \n"); - if (i > 0) opts_colour_string.append(", "); - opts_colour_string.append("\""); - opts_colour_string.append(colourstring); - opts_colour_string.append("\""); - start_points_colour_string.append(","); - start_points_colour_string.append("\""); - start_points_colour_string.append(colourstring); - start_points_colour_string.append("\""); - if (i > 0) opts_data_string.append(", "); - opts_data_string.append("d"); - opts_data_string.append(i); -} - -StringBuilder opts_data_withstart_string = new StringBuilder(opts_data_string.toString()); -opts_data_withstart_string.append(start_points_data_string.toString()); -opts_data_string.append("];"); -opts_data_withstart_string.append("];"); -%> -var data = <%= opts_data_string.toString() %> -var data_withstart = <%= opts_data_withstart_string.toString() %> -var options_withstart = { - legend: { show: true, container: $("#legend") }, - colors: [ <%= opts_colour_string.toString() %>], - shadowSize: 0, - xaxis: { mode: "time", timeformat: "%H%M.%S" }, - yaxis: { autoscaleMargin: 0 }, - <%= opts_series_string.toString() %> - <%= withstart_points_series_string.toString() %> selection: { mode: "xy" } -}; - -var options_small = { - legend: { show: true, container: $("#legend") }, - colors: [ <%= opts_colour_string.toString() %> ], - shadowSize: 0, - xaxis: { mode: "time", timeformat: "%H:%M" }, - yaxis: { autoscaleMargin: 0 }, - <%= opts_series_string.toString() %> - <%= nostart_points_series_string.toString() %> selection: { mode: "xy" } -}; - - -var placeholder = $("#placeholder"); -var plot = $.plot(placeholder, data_withstart, options_withstart); - -var smallplotplaceholder = $("#smallplotplaceholder"); -var smallplot = $.plot(smallplotplaceholder, data_withstart, options_small); - -placeholder.bind("plotselected", function (event, ranges) { - if (ranges.xaxis.to - ranges.xaxis.from < 0.00001) - ranges.xaxis.to = ranges.xaxis.from + 0.00001; - if (ranges.yaxis.to - ranges.yaxis.from < 0.00001) - ranges.yaxis.to = ranges.yaxis.from + 0.00001; - - plot = $.plot(placeholder, data_withstart, - $.extend(true, {}, options_withstart, { - grid: { hoverable: true }, - xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to }, - yaxis: { min: ranges.yaxis.from, max: ranges.yaxis.to }, - } - ) -); - -// don't fire event on the overview to prevent eternal loop -smallplot.setSelection(ranges, true); - -}); - -smallplotplaceholder.bind("plotselected", function (event, ranges) { - plot.setSelection(ranges); -}); - -function lookupStateInfo(y) { - <%= lookupFunctionString %> -} - -function showTooltip(x, y, contents) { - $('<div id="tooltip">' + contents + '</div>').css( { - position: 'absolute', - display: 'none', - top: y + 5, - left: x + 5, - border: '1px solid #fdd', - padding: '2px', - 'background-color': '#fee', - opacity: 0.80 - }).appendTo("body").fadeIn(200); -} - - -// Hover text -var previousPoint = null; -$("#placeholder").bind("plothover", function (event, pos, item) { - if (item) { - if (previousPoint != item.datapoint) { - previousPoint = item.datapoint; - - $("#tooltip").remove(); - var x = item.datapoint[0].toFixed(2), - y = item.datapoint[1].toFixed(2); - - showTooltip(item.pageX, item.pageY, lookupStateInfo(item.datapoint[1])); - - } else { - $("#tooltip").remove(); - previousPoint = null; - } - } -}); - -$("#clearSelection").click(function () { - plot.clearSelection(); - } -); - -});
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/swimlanes-static.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/swimlanes-static.jsp b/src/main/web/hicc/jsp/swimlanes-static.jsp deleted file mode 100644 index 83b3a04..0000000 --- a/src/main/web/hicc/jsp/swimlanes-static.jsp +++ /dev/null @@ -1,70 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = "org.apache.hadoop.chukwa.analysis.salsa.visualization.Swimlanes" %> -<%@ page import = "org.apache.hadoop.chukwa.hicc.ImageSlicer" %> -<%@ page import = "org.apache.hadoop.chukwa.util.XssFilter" %> -<%@ page import = "org.apache.hadoop.chukwa.util.ExceptionUtil" %> -<%@ page import = "java.io.FileOutputStream" %> -<%@ page import = "java.io.File" %> -<%@ page import = "java.util.HashMap" %> -<%@ page import = "java.util.HashMap" %> -<%@ page import = "org.apache.commons.logging.Log" %> -<%@ page import = "org.apache.commons.logging.LogFactory" %> -<% - Log log = LogFactory.getLog(Swimlanes.class); - XssFilter xf = new XssFilter(request); - String boxId = xf.getParameter("boxId"); - int max = 0; - try { - StringBuilder fileName = new StringBuilder(); - fileName.append(System.getenv("CHUKWA_HOME")); - fileName.append(File.separator); - fileName.append("webapps"); - fileName.append(File.separator); - fileName.append("sandbox"); - fileName.append(File.separator); - fileName.append(boxId); - fileName.append(xf.getParameter("_s")); - fileName.append(".png"); - StringBuilder baseFileName = new StringBuilder(); - baseFileName.append(boxId); - baseFileName.append(xf.getParameter("_s")); - baseFileName.append(".png"); - - FileOutputStream fos = new FileOutputStream(fileName.toString()); - - Swimlanes sw = new Swimlanes(request); - sw.run(); - if(sw.getImage(fos,"PNG", 1.0)) { - fos.close(); - ImageSlicer slicer = new ImageSlicer(); - max = slicer.process(baseFileName.toString()); - } - RequestDispatcher disp = getServletContext().getRequestDispatcher("/jsp/image-viewer.jsp"); - request.setAttribute("image-viewer",baseFileName.toString()); - request.setAttribute("maxLevel",max); - disp.forward(request, response); - } catch(Exception e) { - response.setHeader("boxId", xf.getParameter("boxId")); - response.setContentType("text/html; chartset=UTF-8//IGNORE"); - out.println("No data available."); - log.error(ExceptionUtil.getStackTrace(e)); - } -%> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/swimlanes.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/swimlanes.jsp b/src/main/web/hicc/jsp/swimlanes.jsp deleted file mode 100644 index 7ba47df..0000000 --- a/src/main/web/hicc/jsp/swimlanes.jsp +++ /dev/null @@ -1,72 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = "java.util.Calendar, java.util.Date, java.sql.*, java.text.SimpleDateFormat, java.util.*, java.sql.*,java.io.*,java.lang.Math, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, java.lang.StringBuilder, org.apache.hadoop.chukwa.util.XssFilter" %> - <% response.setContentType("text/html"); %> - <html><head> - - <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> - <title>2D Spectrum Viewer</title> - <link href="/hicc/css/heatmap/layout.css" rel="stylesheet" type="text/css"> - <script language="javascript" type="text/javascript" src="/hicc/js/jquery-1.3.2.min.js"></script> - <script language="javascript" type="text/javascript" src="/hicc/js/jquery.flot.pack.js"></script> - - <script language="javascript" type="text/javascript" src="/hicc/js/excanvas.pack.js"></script> - <script> - function activateplot() - { - document.getElementById('clearSelection').click(); - } - </script> - <script id="source" language="javascript" type="text/javascript" src="swimlanes-event-data-js.jsp"> - </script> - </head><div FirebugVersion="1.3.3" style="display: none;" id="_firebugConsole"></div><body onload="activateplot()"> - <table cellpadding="0" cellspacing="0"> - <tbody> - <tr> - - <td align="right" valign="top" rowspan="2"><div id="placeholder" style="width: 600px; height: 400px; position: relative;"><canvas width="600" height="400"></canvas><canvas style="position: absolute; left: 0px; top: 0px;" width="600" height="400"></canvas></div></td> - - <td rowspan="2"><div style="width:10px"> </div></td> - - <td><div id="smallplotplaceholder", style="width:166px;height:100px;"><canvas style="position: absolute; left: 0px; top: 0px;" width="166" height="100"></canvas></div></td> - - </tr> - - <tr> - <td align="right"> - - <span id="resultcountholder">No results returned. </span> - - <br /> - - <table cellpadding="0" cellspacing="2"><tbody> - <tr><th colspan="2">Legend</th></tr> - <tr><td bgcolor="#0000cc"> </td><td>Map</td></tr> - <tr><td bgcolor="#00cc00"> </td><td>Reduce</td></tr> - <tr><td bgcolor="#ff0000"> </td><td>Reduce-ShuffleWait</td></tr> - <tr><td bgcolor="#330000"> </td><td>Reduce-Sort</td></tr> - <tr><td bgcolor="#990000"> </td><td>Reduce-Reducer</td></tr> - <tr><td bgcolor="#333333"> </td><td>Other</td></tr> - </tbody></table> - </td> - </tr> - - </tbody></table> - </body></html> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/swimlanes_viewer.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/swimlanes_viewer.jsp b/src/main/web/hicc/jsp/swimlanes_viewer.jsp deleted file mode 100644 index d99b44a..0000000 --- a/src/main/web/hicc/jsp/swimlanes_viewer.jsp +++ /dev/null @@ -1,25 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = " org.apache.hadoop.chukwa.util.XssFilter" %> -<% - XssFilter xf = new XssFilter(request); - response.setHeader("boxId", xf.getParameter("boxId")); - %> -<IFRAME id="<%= xf.getParameter("boxId") %>iframe" src="/hicc/jsp/swimlanes.jsp?<%= xf.filter(request.getQueryString()) %>" width="100%" frameborder="0" height="800" scrolling="yes"></IFRAME> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/table.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/table.jsp b/src/main/web/hicc/jsp/table.jsp deleted file mode 100644 index 2576925..0000000 --- a/src/main/web/hicc/jsp/table.jsp +++ /dev/null @@ -1,71 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = "java.text.SimpleDateFormat" %> -<%@ page import = "java.sql.*" %> -<%@ page import = "java.text.NumberFormat" %> -<%@ page import = "java.util.Hashtable" %> -<%@ page import = "java.util.Enumeration" %> -<%@ page import = "java.util.Calendar" %> -<%@ page import = "java.util.Date" %> -<%@ page import = "org.apache.hadoop.chukwa.hicc.TimeHandler" %> -<%@ page import = "org.apache.hadoop.chukwa.util.XssFilter" %> -<%@ page import = "org.apache.hadoop.chukwa.util.DatabaseWriter" %> -<%@ page import = "org.apache.hadoop.chukwa.database.Macro" %> -<% - RequestDispatcher disp = null; - XssFilter xf = new XssFilter(request); - response.setContentType("text/html; chartset=UTF-8//IGNORE"); - response.setHeader("boxId", xf.getParameter("boxId")); - String cluster = (String) session.getAttribute("cluster"); - DatabaseWriter dbw = new DatabaseWriter(cluster); - - TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone")); - long start = time.getStartTime(); - long end = time.getEndTime(); - - Macro mp = new Macro(start,end,request.getParameter("query")); - String query = mp.toString(); - ResultSet rs = dbw.query(query); - ResultSetMetaData rmeta = rs.getMetaData(); - int col = rmeta.getColumnCount(); - rs.last(); - int size = rs.getRow(); - StringBuilder url = new StringBuilder(); - url.append("/jsp/table_viewer.jsp?"); - url.append("total="); - url.append(size); - url.append("&boxId="); - url.append(xf.getParameter("boxId")); - url.append("&report=/hicc/jsp/query.jsp&height="); - url.append(xf.getParameter("height")); - url.append("&query="); - StringBuilder qid = new StringBuilder(); - qid.append("query_"); - qid.append(xf.getParameter("boxId")); - session.setAttribute(qid.toString(),request.getParameter("query")); - for(int i=1;i<=col;i++) { - url.append("&column="); - url.append(rmeta.getColumnName(i)); - url.append("&columnSize=200"); - url.append("&columnAlign=left"); - } - disp = getServletContext( ).getRequestDispatcher(url.toString()); - disp.forward(request, response); -%> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/table_viewer.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/table_viewer.jsp b/src/main/web/hicc/jsp/table_viewer.jsp deleted file mode 100644 index 799a9e7..0000000 --- a/src/main/web/hicc/jsp/table_viewer.jsp +++ /dev/null @@ -1,85 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<% - XssFilter xf = new XssFilter(request); - response.setHeader("boxId", xf.getParameter("boxId")); - response.setContentType("text/html; chartset=UTF-8//IGNORE"); -%> -<%@ page import = "java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, java.util.*, java.sql.*,java.io.*, java.util.Calendar, java.util.Date, org.apache.hadoop.chukwa.hicc.ClusterConfig, org.apache.hadoop.chukwa.extraction.engine.*, org.apache.hadoop.chukwa.hicc.TimeHandler, org.apache.hadoop.chukwa.util.XssFilter" %> -<% String filter=(String)session.getAttribute("filter"); - if(filter==null) { - filter=""; - } - int height = Integer.parseInt(xf.getParameter("height")) - 65; - String url = request.getQueryString(); - StringBuffer tmp = new StringBuffer(); - tmp.append(xf.getParameter("report")); - tmp.append("?"); - tmp.append(url); - url = tmp.toString(); - String[] columns = xf.getParameterValues("column"); - String[] columnsSize = xf.getParameterValues("columnSize"); - String[] columnsAlign = xf.getParameterValues("columnAlign"); - if(columnsSize==null) { - columnsSize = new String[columns.length]; - for(int i=0;i<columns.length;i++) { - columnsSize[i]=""+columns[i].length()*12; - } - } - if(columnsAlign==null) { - columnsAlign = new String[columns.length]; - for(int i=0;i<columns.length;i++) { - columnsAlign[i]="center"; - } - } -%> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/> -<link href="/hicc/css/flexigrid/flexigrid.css" rel="stylesheet" type="text/css"/> -<script type="text/javascript" src="/hicc/js/jquery-1.3.2.min.js"></script> -<script type="text/javascript" src="/hicc/js/flexigrid.js"></script> -</head> -<body> -<div class="flexigrid"><table id="flex1" style="display:none"></table></div> -<script type="text/javascript"> -$(document).ready(function(){ - $('#flex1').flexigrid({ - url: '<%= url %>', - dataType: 'json', - colModel : [ -<% for(int i=0;i<columns.length;i++) { %> - { display: '<%= columns[i] %>', name: '<%= columns[i] %>', width: '<%= columnsSize[i] %>', sortable: true, align:'<%= columnsAlign[i] %>'}, -<% } %> - ], - sortorder: "asc", - usepager: true, - useRp: false, - rp: 15, - striped:false, - showTableToggleBtn: true, - width: 'auto', - height: <%= height %> - }); -}); -</script> -</body> -</html> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/time.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/time.jsp b/src/main/web/hicc/jsp/time.jsp deleted file mode 100644 index 7471e96..0000000 --- a/src/main/web/hicc/jsp/time.jsp +++ /dev/null @@ -1,50 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = "java.util.Hashtable, java.util.Enumeration, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, org.apache.hadoop.chukwa.hicc.TimeHandler, java.text.NumberFormat, org.apache.hadoop.chukwa.util.XssFilter" %> -<% - XssFilter xf = new XssFilter(request); - response.setContentType("text/html; chartset=UTF-8//IGNORE"); - response.setHeader("boxId", xf.getParameter("boxId")); -%> -<% - if(request.getParameter("time_zone")!=null) { - session.setAttribute("time_zone",xf.getParameter("time_zone")); - } - String timeType="combo"; - if(request.getParameter("time_type")!=null) { - timeType=xf.getParameter("time_type"); - } - if(((String)request.getHeader("user-agent")).indexOf("iPhone")>0) { -%> - <jsp:include page="workspace/time_iphone.jsp" flush="true" /> -<% - } else if(timeType.equals("date")) { -%> - <jsp:include page="time_frame.jsp" flush="true" /> -<% - } else if(timeType.equals("range")) { -%> - <jsp:include page="time_range.jsp" flush="true" /> -<% - } else if(timeType.equals("slider")) { -%> - <jsp:include page="time_slider_wrapper.jsp" flush="true" /> -<% - } %> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/time_frame.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/time_frame.jsp b/src/main/web/hicc/jsp/time_frame.jsp deleted file mode 100644 index a052cdf..0000000 --- a/src/main/web/hicc/jsp/time_frame.jsp +++ /dev/null @@ -1,61 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = "java.util.Hashtable, java.util.Enumeration, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, org.apache.hadoop.chukwa.hicc.TimeHandler, java.text.NumberFormat, org.apache.hadoop.chukwa.util.XssFilter" %> -<% - XssFilter xf = new XssFilter(request); - response.setHeader("boxId", xf.getParameter("boxId")); -%> -<% String boxId = xf.getParameter("boxId"); - TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone")); -%> -<table width="100%" class="clear_table"> -<tr><td align="center"> -<a href="#" onclick="return false;" id="<%= boxId %>previous"><img src="/hicc/images/arrow_left.png" border="0"></a> -</td><td align="center"> -<a href="#" onclick="return false;" id="<%= boxId %>today">Today</a> -</td><td align="center"> -<a href="#" onclick="return false;" id="<%= boxId %>next"><img src="/hicc/images/arrow_right.png" border="0"></a> -</td></tr> -<tr><td colspan="3" align="center"> -<div id="<%= boxId %>calendars" class="timeframe_calendar"></div> -</td></tr> -<tr><td colspan="3" align="center"> -<span> - <input type="text" name="<%= boxId %>start" value="<%= time.getStartDate("MMMMM dd, yyyy") %>" id="<%= boxId %>start" size="10"/> - – - <input type="text" name="<%= boxId %>end" value="<%= time.getEndDate("MMMMM dd, yyyy") %>" id="<%= boxId %>end" size="10"/> -</span> -</td></tr> -</table> -<div style="display:none"><a href="#" onclick="return false;" id="<%= boxId %>reset">Reset</a></a></div> -<input type="button" name="<%=boxId%>apply" value="Apply" onclick="save_timeframe('<%= boxId %>');"> -<script type="text/javascript"> - new Timeframe('<%= boxId %>calendars', { - previousButton: "<%= boxId %>previous", - todayButton: "<%= boxId %>today", - nextButton: "<%= boxId %>next", - resetButton: "<%= boxId %>reset", - months: 1, - format: '%Y-%m-%d', - startField: '<%= boxId %>start', - endField: '<%= boxId %>end' - } - ); -</script> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/time_range.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/time_range.jsp b/src/main/web/hicc/jsp/time_range.jsp deleted file mode 100644 index 31186eb..0000000 --- a/src/main/web/hicc/jsp/time_range.jsp +++ /dev/null @@ -1,142 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = "java.util.Hashtable, java.util.StringTokenizer, java.util.Enumeration, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, org.apache.hadoop.chukwa.hicc.TimeHandler, java.text.NumberFormat, org.apache.hadoop.chukwa.util.XssFilter" %> -<% - XssFilter xf = new XssFilter(request); - response.setHeader("boxId", xf.getParameter("boxId")); -%> -<% String boxId = xf.getParameter("boxId"); - TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone")); %> -Time Period -<select class="timeWidgetPeriodControl" id="<%= boxId %>period" name="<%= boxId %>time_period" class="formSelect"> -<% - boolean fCustom=false; - - String period = (String) session.getAttribute("period"); - String[][] periodMap = new String[9][2]; - periodMap[0][0]="last1hr"; - periodMap[0][1]="Last 1 Hour"; - periodMap[1][0]="last2hr"; - periodMap[1][1]="Last 2 Hours"; - periodMap[2][0]="last3hr"; - periodMap[2][1]="Last 3 Hours"; - periodMap[3][0]="last6hr"; - periodMap[3][1]="Last 6 Hours"; - periodMap[4][0]="last12hr"; - periodMap[4][1]="Last 12 Hours"; - periodMap[5][0]="last24hr"; - periodMap[5][1]="Last 24 Hours"; - periodMap[6][0]="last7d"; - periodMap[6][1]="Last 7 Days"; - periodMap[7][0]="last30d"; - periodMap[7][1]="Last 30 Days"; - periodMap[8][0]="custom"; - periodMap[8][1]="Custom Period"; - for (int i=0;i<periodMap.length;i++) { - String meta = ""; - if (period!=null && period.equals(periodMap[i][0])) { - meta = "selected"; - } else if (period.startsWith("custom;") && (periodMap[i][0].equals("custom"))) { - meta = "selected"; - fCustom = true; - } - - out.println("<option value='"+periodMap[i][0]+"' "+meta+">"+periodMap[i][1]+"</option>"); - } - %> -</select> -<div id="<%= boxId %>period_custom_block" style="display:<%= (fCustom?"block":"none") %>;"> -<% - String start_string="2 days ago"; - String end_string="now"; - if (period.startsWith("custom;")) { - // the string should be custom;<start>;<end> - StringTokenizer st=new StringTokenizer(period,";"); - if (st.hasMoreTokens()) { - st.nextToken(); // skip custom; - if (st.hasMoreTokens()) { - start_string=st.nextToken(); - if (st.hasMoreTokens()) { - end_string=st.nextToken(); - } - } - } - } -%> - <br/> - <fieldset> - <legend>Custom Period</legend> - <table> - <tr><td> - <label for="start_period">Start Period:</label> - </td><td> - <input type="edit" name="<%= boxId %>_start_time" id="<%= boxId %>_start_time" value="<%= start_string %>"/> - </td><td> - <a href="#" id="help_edit_start_time" class="<%= boxId %>help_control">?</a> - </td></tr> - <tr><td> - <label for="end_period">End Period:</label> - </td><td> - <input type="edit" name="<%= boxId %>_end_time" id="<%= boxId %>_end_time" value="<%= end_string %>"/> - </td><td> - <a href="#" id="help_edit_start_time" class="<%= boxId %>help_control">?</a> - </td></tr> - </table> - </fieldset> - - </div> -<input type="button" name="<%= boxId %>apply" value="Apply" onclick="save_time_range('<%= boxId %>')"> - -<script type='text/javascript' src="/hicc/js/"></script> -<script> -/* - * popup the online help - */ -function popup_help(event) { - var element = Event.element(event); - window.open("/hicc/jsp/help.jsp?id="+element.id, - "Help", - "width=500,height=400"); -} - -/* - * toggle the custom period control - */ -function togglePeriodControl(event) { - var element = Event.element(event); - value=$F(element.id); - if (value=='custom') { - $(element.id+'_custom_block').show(); - } else { - $(element.id+'_custom_block').hide(); - } -} - - -period_control = document.getElementById("<%= boxId %>period"); - -if (period_control != null) { - //period_control.observe('change',togglePeriodControl); - help_controls=document.getElementsByClassName("<%= boxId %>help_control"); - for (i=0;i<help_controls.length;i++) { - //help_controls[i].observe("click",popup_help); - } -} -</script> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/time_slider.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/time_slider.jsp b/src/main/web/hicc/jsp/time_slider.jsp deleted file mode 100644 index f5f9c97..0000000 --- a/src/main/web/hicc/jsp/time_slider.jsp +++ /dev/null @@ -1,155 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = "java.io.*, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, org.apache.hadoop.chukwa.hicc.TimeHandler" %> -<% TimeHandler time = new TimeHandler(request,(String)session.getAttribute("time_zone")); - String startDate = time.getStartDate(); - String endDate = time.getEndDate(); - SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); - long start = formatter.parse(startDate).getTime(); - long end = formatter.parse(endDate).getTime(); - end = end + (60*60*24*1000-1); - String label = ""; - String label2 = ""; - String label3 = ""; - if(end-start>(60*60*24*1000*2)) { - label = formatter.format(start); - long mid = (end+start)/2; - label2 = formatter.format(mid); - label3 = formatter.format(end); - } else { - SimpleDateFormat formatter2 = new SimpleDateFormat("HH:mm"); - label = formatter2.format(start); - long mid = (end+start)/2; - label2 = formatter2.format(mid); - label3 = formatter2.format(end); - } -%> -<html><head> -<script type='text/javascript' src='/hicc/js/workspace/prototype.js'></script> -<script type='text/javascript' src='/hicc/js/workspace/scriptaculous.js'></script> -<link href="/hicc/css/default.css" rel="stylesheet" type="text/css"> -<style type="text/css"> - div.slider3 { width:96%; margin:0px; height:15px; position: relative; opacity: 0.6; z-index:5; white-space: nowrap;} - div.slider { width:96%; margin:0px; height:10px; position: relative; opacity: 0.6; z-index:5; white-space:nowrap;} - div.slider2 { width:96%; margin:0px; background-color:#ccc; height:4px; position: relative; opacity: 0.4; z-index:5; white-space:nowrap;} - div.handle { cursor:move; position: absolute; z-index:10; opacity: 1.0; } - div.label { display: inline-block; text-align: center; position:absolute; z-index:4;} - span.label { text-align: center; } -</style> -</head> -<body> - <table class="clear_table"><tr><td align="right"> - Start Time</td><td> - <div id="start_time" style="display:inline;white-space: nowrap;"></div></td></tr> - <tr><td align="right">End Time</td><td> - <div id="end_time" style="display:inline;white-space: nowrap;"></div></td></tr> - </table> - <div id="time_slider" class="slider3"> - <div class="handle" style="width:19px; height:30px;"><img src="/hicc/images/slider-images-handle.png" alt="" style="float: left;" /></div> - <div class="handle" style="width:19px; height:30px;"><img src="/hicc/images/slider-images-handle.png" alt="" style="float: left;" /></div> - </div> - <div class="slider2"></div> - <div id="range_slider" class="slider"> - <div class="handle" style="width:19px; height:20px;"><img src="/hicc/images/slider-images-handle2.png" alt="" style="float: left;"/></div> - </div> - <div style="width:100%; height: 1em; font-size: 9px; color: gray;"> - <div class="label" style="left:0%;"><span class="label"><%=label%></span></div> - <div class="label" style="left:45%;"><span class="label"><%=label2%></span></div> - <div class="label" style="right:3%;"><span class="label"><%=label3%></span></div> - </div> -<div id="hidden_start" style="display:none;"></div> -<div id="hidden_end" style="display:none;"></div> -<script type="text/javascript"> - var time_slider = $('time_slider'); - var range_slider = $('range_slider'); - var mid=(<%= time.getStartTime() %>+<%= time.getEndTime() %>)/2; - var slider = new Control.Slider(time_slider.select('.handle'), time_slider, { - range: $R(<%= start %>, <%= end %>), - sliderValue: [<%= time.getStartTime() %>, <%= time.getEndTime() %>], - restricted: true, - onSlide: function(values) { - display_dates(values[0],values[1]); - }, - onChange: function(values) { - display_dates(values[0],values[1]); - } - }); - var slider_range = new Control.Slider(range_slider.select('.handle'), range_slider, { - range: $R(<%= start %>, <%= end %>), - sliderValue: mid, - onSlide: function(values) { - var delta = values-mid; - mid = values; - slider.setValue(slider.values[0]+delta,0); - slider.setValue(slider.values[1]+delta,1); - display_dates(slider.values[0]+delta,slider.values[1]+delta); - }, - onChange: function(values) { - } - }); - -function display_dates(start, end) { - var s = new Date(); - s.setTime(start); - var sm = s.getUTCMonth(); - sm = sm + 1; - if(sm<10) { - sm = "0" + sm; - } - var sd = s.getUTCDate(); - if(sd<10) { - sd = "0" + sd; - } - var sh = s.getUTCHours(); - if(sh<10) { - sh = "0" + sh; - } - var smin = s.getUTCMinutes(); - if(smin<10) { - smin = "0" + smin; - } - var e = new Date(); - e.setTime(end); - var em = e.getUTCMonth(); - em = em + 1; - if(em<10) { - em = "0" + em; - } - var ed = e.getUTCDate(); - if(ed<10) { - ed = "0" + ed; - } - var eh = e.getUTCHours(); - if(eh<10) { - eh = "0" + eh; - } - var emin = e.getUTCMinutes(); - if(emin<10) { - emin = "0" + emin; - } - $('start_time').innerHTML=s.getUTCFullYear()+"-"+sm+"-"+sd+" "+sh+":"+smin; - $('end_time').innerHTML=e.getUTCFullYear()+"-"+em+"-"+ed+" "+eh+":"+emin; - $('hidden_start').innerHTML=start; - $('hidden_end').innerHTML=end; -} - -display_dates(<%= time.getStartTime() %>,<%= time.getEndTime() %>); -</script> -</body></html> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/time_slider_wrapper.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/time_slider_wrapper.jsp b/src/main/web/hicc/jsp/time_slider_wrapper.jsp deleted file mode 100644 index 7bc96e4..0000000 --- a/src/main/web/hicc/jsp/time_slider_wrapper.jsp +++ /dev/null @@ -1,27 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@page import ="org.apache.hadoop.chukwa.util.XssFilter" %> -<% - XssFilter xf = new XssFilter(request); - response.setHeader("boxId", xf.getParameter("boxId")); -%> -<IFRAME id="<%= xf.getParameter("boxId") %>iframe" src="/hicc/jsp/time_slider.jsp" width="100%" frameborder="0" height="80" scrolling="no"></IFRAME> - <input type=button id="time_slider_apply" name="time_slider_apply" value="Apply" onclick="save_time_slider(document.getElementById('<%= xf.getParameter("boxId") %>iframe').contentDocument.getElementById('hidden_start').innerHTML,document.getElementById('<%= xf.getParameter("boxId") %>iframe').contentDocument.getElementById('hidden_end').innerHTML);"> - http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/util.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/util.jsp b/src/main/web/hicc/jsp/util.jsp deleted file mode 100644 index e3ddaea..0000000 --- a/src/main/web/hicc/jsp/util.jsp +++ /dev/null @@ -1,187 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ page import = "java.text.DecimalFormat,java.text.NumberFormat" %> -<%@ page import = "java.sql.*" %> -<%@ page import = "java.io.*" %> -<%@ page import = "org.json.*" %> -<%@ page import = "java.util.Calendar" %> -<%@ page import = "java.util.Date" %> -<%@ page import = "java.text.SimpleDateFormat" %> -<%@ page import = "java.util.*" %> -<%@ page import = "org.apache.hadoop.chukwa.hicc.ClusterConfig" %> -<%@ page import = "org.apache.hadoop.chukwa.hicc.TimeHandler" %> -<%@ page import = "org.apache.hadoop.chukwa.util.DatabaseWriter" %> -<%@ page import = "org.apache.hadoop.chukwa.database.Macro" %> -<%@ page import = "org.apache.hadoop.chukwa.util.XssFilter" %> -<%@ page import = "org.apache.hadoop.chukwa.database.DatabaseConfig" %> -<% - XssFilter xf = new XssFilter(request); - NumberFormat nf = new DecimalFormat("###,###,###,##0.00"); - response.setHeader("boxId", xf.getParameter("boxId")); - response.setContentType("text/html; chartset=UTF-8//IGNORE"); - String boxId=xf.getParameter("boxId"); - String cluster = (String) session.getAttribute("cluster"); - DatabaseWriter dbw = new DatabaseWriter(cluster); - String path = ""; - Calendar now = Calendar.getInstance(); - HashMap<String, Integer> index = new HashMap<String, Integer>(); - long start = 0; - long end = now.getTimeInMillis(); - String startS=""; - String endS=""; - String[] columns = xf.getParameterValues("column"); - TimeHandler time = new TimeHandler(request, (String)session.getAttribute("time_zone")); - startS = time.getStartTimeText(); - endS = time.getEndTimeText(); - start = time.getStartTime(); - end = time.getEndTime(); - Macro mp = new Macro(start,end,"[util]", request); - int averageBy=600; - String tmpTable = mp.toString(); - DatabaseConfig dbc = new DatabaseConfig(); - String[] tableList = dbc.findTableNameForCharts("util", start, end); - if(tableList[0].endsWith("_week")) { - averageBy=600; - } else if(tableList[0].endsWith("_month")) { - averageBy=600; - } else if(tableList[0].endsWith("_quarter")) { - averageBy=1800; - } else if(tableList[0].endsWith("_year")) { - averageBy=10800; - } else if(tableList[0].endsWith("_decade")) { - averageBy=43200; - } - StringBuilder queryBuilder = new StringBuilder(); - int pageNum = 0; - int rp = 0; - if(xf.getParameter("page")!=null) { - pageNum = Integer.parseInt(xf.getParameter("page")); - rp = Integer.parseInt(xf.getParameter("rp")); - } - int total=0; - String query = ""; - if(xf.getParameter("queue")==null) { - query = "select count(*) from [util] where timestamp between '[start]' and '[end]' group by queue;"; - mp = new Macro(start,end,query, request); - query = mp.toString(); - ResultSet rs = dbw.query(query); - if(rs.next()) { - total = rs.getInt(1); - } - queryBuilder.append("select queue,sum(bytes)/((unix_timestamp('[end]')-unix_timestamp('[start]'))/"); - queryBuilder.append(averageBy); - queryBuilder.append("*2) as hdfs_usage,sum(slot_hours)/((unix_timestamp('[end]')-unix_timestamp('[start]'))/"); - queryBuilder.append(averageBy); - queryBuilder.append("*2) as slot_hour from [util] where timestamp between '[start]' and '[end]' group by queue"); - mp = new Macro(start,end,queryBuilder.toString(), request); - query = mp.toString(); - if(tableList.length>1) { - StringBuilder queryAdd = new StringBuilder(); - queryAdd.append("(select * from ("); - queryAdd.append(query); - queryAdd.append(") as t group by queue)"); - query = queryAdd.toString(); - } - } else { - query = "select count(*) from [util] where timestamp between '[start]' and '[end]' and queue=? group by user;"; - mp = new Macro(start,end,query, request); - query = mp.toString(); - ArrayList<Object> parms = new ArrayList<Object>(); - parms.add(xf.getParameter("queue")); - ResultSet rs = dbw.query(query, parms); - if(rs.next()) { - total = rs.getInt(1); - } - queryBuilder.append("select user,sum(bytes)/((unix_timestamp('[end]')-unix_timestamp('[start]'))/"); - queryBuilder.append(averageBy); - queryBuilder.append("*2) as hdfs_usage,sum(slot_hours)/((unix_timestamp('[end]')-unix_timestamp('[start]'))/"); - queryBuilder.append(averageBy); - queryBuilder.append("*2) as slot_hour from [util] where timestamp between '[start]' and '[end]' and queue='"); - queryBuilder.append(xf.getParameter("queue")); - queryBuilder.append("' group by user"); - mp = new Macro(start,end,queryBuilder.toString(), request); - query = mp.toString(); - if(tableList.length>1) { - StringBuilder queryAdd = new StringBuilder(); - queryAdd.append("(select * from ("); - queryAdd.append(query); - queryAdd.append(") as t group by user)"); - query = queryAdd.toString(); - } - } - ResultSet rs = dbw.query(query); - ResultSetMetaData rmeta = rs.getMetaData(); - int col = rmeta.getColumnCount(); - JSONObject data = new JSONObject(); - JSONArray rows = new JSONArray(); - while(rs.next()) { - JSONArray cells = new JSONArray(); - for(int i=1;i<=col;i++) { - if(xf.getParameter("queue")==null && i==1) { - StringBuilder sb = new StringBuilder(); - sb.append("<a href='/hicc/jsp/table_viewer.jsp?report=%2Fhicc%2Fjsp%2Futil.jsp&column=User&column=HDFS Storage Usage (GB Per Hour)&column=Slot Hours&columnSize=400&columnSize=100&columnSize=100&height="); - sb.append(xf.getParameter("height")); - sb.append("&queue="); - sb.append(rs.getString(i)); - sb.append("'>"); - sb.append(rs.getString(i)); - sb.append("</a>"); - cells.put(sb.toString()); - } else if(xf.getParameter("queue")!=null && i==1) { - StringBuilder sb = new StringBuilder(); - sb.append("<a href='/hicc/jsp/table_viewer.jsp?report=%2Fhicc%2Fjsp%2Fjobs_viewer.jsp&column=Job ID&column=Submit Time&column=Launch Time&column=Finish Time&column=Status&columnSize=150&columnSize=110&columnSize=110&columnSize=110&columnSize=110&height="); - sb.append(xf.getParameter("height")); - sb.append("&user="); - sb.append(rs.getString(i)); - sb.append("'>"); - sb.append(rs.getString(i)); - sb.append("</a>"); - cells.put(sb.toString()); - } else { - if(rmeta.getColumnType(i)==java.sql.Types.BIGINT) { - cells.put(nf.format(rs.getBigDecimal(i))); - } else if(rmeta.getColumnType(i)==java.sql.Types.TINYINT || - rmeta.getColumnType(i)==java.sql.Types.INTEGER) { - cells.put(nf.format(rs.getInt(i))); - } else if(rmeta.getColumnType(i)==java.sql.Types.FLOAT || - rmeta.getColumnType(i)==java.sql.Types.DOUBLE || - rmeta.getColumnType(i)==java.sql.Types.DECIMAL ) { - cells.put(nf.format(rs.getDouble(i))); - } else { - cells.put(rs.getString(i)); - } - } - } - JSONObject row = new JSONObject(); - if(rs.getString(1)!=null) { - row.put("id",rs.getString(1)); - } else { - row.put("id","null"); - } - row.put("cell",cells); - rows.put(row); - total++; - } - data.put("page",xf.getParameter("page")); - data.put("rows",rows); - data.put("total",total); - dbw.close(); - out.println(data.toString()); -%> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/workspace/manage_view.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/workspace/manage_view.jsp b/src/main/web/hicc/jsp/workspace/manage_view.jsp deleted file mode 100644 index d863bf1..0000000 --- a/src/main/web/hicc/jsp/workspace/manage_view.jsp +++ /dev/null @@ -1,132 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<%@ taglib prefix="my" uri="/WEB-INF/jsp2/taglib.tld" %> -<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> -<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%> -<table class="portal_table" cellpadding="2" cellspacing="0" width="100%"> -<thead><tr bgcolor="lightgrey"> -<th>Name</th> -<th>Owner</th> -<th>Permission</th> -<th colspan="4">Operations</th> -</tr></thead> -<% - String[] users= {"Mac", "Eric", "Linyun", "Rounpin", "Jerome", "admin"}; - pageContext.setAttribute("users", users); - pageContext.setAttribute("user","admin"); - pageContext.setAttribute("permission.all.read","1"); - pageContext.setAttribute("permission.all.write","2"); - pageContext.setAttribute("default_view","default"); -%> -<my:findViews> - <tr><td> -<div id="displayViewNameBlock${key}"> -<a href="#" onClick="javascript:set_current_view('${key}');initScript('${key}');">${description}</a></div> -<div id="changeViewNameBlock${key}" style="display:none;"> -<input type=text name="changeViewNameField${key}" id="changeViewNameField${key}" value='${description}'/> -</div> -</td><td align='center'>${owner}</td> -<td align='center' width="270"> -<!-- begin permission --> -<div id="displayViewPermissionBlock${key}" style="display:block;"> -<c:choose> - <c:when test="${permission.all.read=='1'}"> - Public - </c:when> - <c:otherwise> - Private - </c:otherwise> -</c:choose> -</div> -<div id="editViewPermissionBlock${key}" style="display:none;"> - <div id="permission${key}"> -<input type=hidden name="permissionRowCount${key}" value="${fn:length(permissions)}"/> -<table class="portal_table" id="permissionTable${key}" cellspacing=0 cellpadding=0> -<thead><tr bgcolor="lightgrey"><th>User</th><th>Allow To Read</th><th>Allow to Modify</th><th></th></tr></thead> -<tbody> -<!-- begin permission --> -<c:forEach items="${permission}" var="pK"> - <tr><td> - <select id='userid_permission' class='formSelect'> - <c:forEach items="${users}" var="user"> - <c:choose> - <c:when test="${user==pK}"> - <option value='${user}' selected>${user}</option> - </c:when> - <c:otherwise> - <option value='${user}'>${user}</option> - </c:otherwise> - </c:choose> - </c:forEach> - </select> - </td><td align="middle"> - <input type='checkbox' class='formCheckbox' id='read_permission' name='read_permission'> - </td><td align="middle"> - <input type='checkbox' class='formCheckbox' id='modify_permission' name='modify_permission'> - </td><td> - <img src='/sim/images/close16.gif' onClick="deleteCurrentRow('${key}',this);"/> - </td></tr> -</c:forEach> -<!-- end permission --> -</tbody> -</table> -<br/> -<input type=button name="addPermissionRowButton" value="Add More Permission" onClick="addPermissionRow('${key}','',false,false);"/> - </div> -</div> -<!-- end permission --> -</td><td width="115"> -<!-- begin operations --> -<!--c:if test="${permission.all.modify=='1'} || ${permission.user.modify=='1'}"--> - <div id="changeViewNameButtonBlock${key}" style="display:block;"> - <input name="changeNameButton${key}" id="changeNameButton${key}" value="Change" type="button" onClick="changeViewName('${key}',false);"/> - </div> - <div id="cancelChangeViewNameBlock${key}" style="display:none;"> - <input name="saveNameButton${key}" id="saveNameButton${key}" value="Save" type="button" onClick="changeViewName('${key}',true);"/> - <input name="cancelChangeNameButton${key}" id="cancelChangeNameButton${key}" value="Cancel" type="button" onClick="changeViewName('${key}',false);"/> - </div> -<!--/c:if--> -</td> -<td nowrap width="60"> -<input name="cloneview" value="Clone" type="button" onClick="cloneView('${key}');"/> -</td> -<td nowrap width="60"> -<!--c:if test="${key=='default'}"--> -<!-- <input name="restoreview" value="Restore" type="button" onClick="if (confirm(Are you sure you want to restore the default workspace?)){ restoreView('${key}');}"/> --> -<!--/c:if--> - -<!--c:if test="${permision.all.modify=='1'} || ${permission.user.modify=='1'} && ${key!='default'}"--> - <input name="delelete" value="Delete" type="button" onClick="if (confirm('Are you sure you want to delete the workspace?')){ deleteView('${key}');}"/> -<!--/c:if--> -</td> -<td nowrap width="60"> -<c:choose> - <c:when test="${key!=default_view}"> - <input name="setDefault" value="Set As Default" type="button" onClick="setDefaultView('${key}');"/> - </c:when> - <c:otherwise> - Default View - </c:otherwise> -</c:choose> -</td> -<!-- end operation --> -</td></tr> -</my:findViews> -</table> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/jsp/workspace/time_iphone.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/jsp/workspace/time_iphone.jsp b/src/main/web/hicc/jsp/workspace/time_iphone.jsp deleted file mode 100644 index bb81434..0000000 --- a/src/main/web/hicc/jsp/workspace/time_iphone.jsp +++ /dev/null @@ -1,113 +0,0 @@ -<% -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -%> -<% - response.setHeader("boxId", request.getParameter("boxId")); -%> -<%@ page import = "java.util.Hashtable, java.util.Enumeration, java.util.Calendar, java.util.Date, java.text.SimpleDateFormat, org.apache.hadoop.chukwa.hicc.TimeHandler, java.text.NumberFormat" %> -<% String boxId = request.getParameter("boxId"); - session.setAttribute("time_type","range"); - TimeHandler time = new TimeHandler(request,(String)session.getAttribute("time_zone")); -%> -<div class="panel"> -<h2>Date/Time</h2> -<fieldset> -<div class="row"> - <label>Start Date</label> -<input type=text id="<%= boxId %>start" name="<%= boxId %>start" value="<%= time.getStartDate() %>" size="10"/> -</div> -<div class="row"> - <label>Start Time</label> -<select id="<%= boxId %>start_hour" name="<%= boxId %>start_hour"> -<% - String startHour = time.getStartHour(); - for(int i=0;i < 24; i++) { - String meta = ""; - String hour = ""+i; - if(i<10) { - hour = "0"+i; - } - if(startHour.equals(hour)) { - meta = "selected"; - } - out.println("<option value='"+hour+"' "+meta+">"+hour+"</option>"); - } -%> -</select> : -<select id="<%= boxId %>start_min" name="<%= boxId %>start_min"> -<% - String startMin = time.getStartMinute(); - for(int i=0;i < 60; i++) { - String meta = ""; - String minute = ""+i; - if(i<10) { - minute = "0"+i; - } - if(startMin.equals(minute)) { - meta = "selected"; - } - out.println("<option value='"+minute+"' "+meta+">"+minute+"</option>"); - } -%> -</select> -</div> -<div class="row"> - <label>End Date</label> -<input type=text id="<%= boxId %>end" name="<%= boxId %>end" value="<%= time.getEndDate() %>" size="10"/> -</div> -<div class="row"> - <label>End Time</label> -<select id="<%= boxId %>end_hour" name="<%= boxId %>end_hour"> -<% - String endHour = time.getEndHour(); - for(int i=0;i < 24; i++) { - String meta = ""; - String hour = ""+i; - if(i<10) { - hour = "0"+i; - } - if(endHour.equals(hour)) { - meta = "selected"; - } - out.println("<option value='"+hour+"' "+meta+">"+hour+"</option>"); - } -%> -</select> : -<select id="<%= boxId %>end_min" name="<%= boxId %>end_min"> -<% - String endMin = time.getEndMinute(); - for(int i=0;i < 60; i++) { - String meta = ""; - String minute = ""+i; - if(i<10) { - minute = "0"+i; - } - if(endMin.equals(minute)) { - meta = "selected"; - } - out.println("<option value='"+minute+"' "+meta+">"+minute+"</option>"); - } -%> -</select> -</div> -<div class="row"> -<input type="button" name="apply" value="Apply" onclick="save_time('<%= boxId %>');"> -</div> -</fieldset> -</div> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/login.jsp ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/login.jsp b/src/main/web/hicc/login.jsp deleted file mode 100644 index f0c1002..0000000 --- a/src/main/web/hicc/login.jsp +++ /dev/null @@ -1,56 +0,0 @@ -<%-- - ~ Licensed to the Apache Software Foundation (ASF) under one - ~ or more contributor license agreements. See the NOTICE file - ~ distributed with this work for additional information - ~ regarding copyright ownership. The ASF licenses this file - ~ to you under the Apache License, Version 2.0 (the - ~ "License"); you may not use this file except in compliance - ~ with the License. You may obtain a copy of the License at - ~ - ~ http://www.apache.org/licenses/LICENSE-2.0 - ~ - ~ Unless required by applicable law or agreed to in writing, - ~ software distributed under the License is distributed on an - ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - ~ KIND, either express or implied. See the License for the - ~ specific language governing permissions and limitations - ~ under the License. - --%> -<%@ page import = "org.apache.hadoop.chukwa.datastore.ChukwaHBaseStore" %> -<% - ChukwaHBaseStore.populateDefaults(); -%> -<html> -<head> - <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" /> - <meta http-equiv="Pragma" content="no-cache" /> - <meta http-equiv="Expires" content="0" /> - <link type="text/css" rel="stylesheet" href="css/login.css"/> - <link href="css/bootstrap.min.css" type="text/css" rel="stylesheet" /> - <link href="css/bootstrap-theme.min.css" type="text/css" rel="stylesheet" /> - <script src="js/jquery.js" type="text/javascript"></script> - <script src="js/bootstrap.min.js" type="text/javascript"></script> -</head> -<body> - -<div class="container"> - <form class="form-signin" name="loginform" action="" method="post"> - <h2 class="form-signin-heading">Sign in to Chukwa</h2> - <label for="inputEmail" class="sr-only">Username</label> - <input type="text" class="form-control" name="username" placeholder="Username" required autofocus> - <label for="inputPassword" class="sr-only">Password:</label> - <input type="password" class="form-control" name="password" placeholder="Password" required> - <div class="checkbox"> - <label> - <input type="checkbox" name="rememberMe"> Keep me signed in - </label> - </div> - <input type="submit" class="btn btn-lg btn-primary btn-block" name="submit" value="Login"> - <span class="form-signin-footer"> - Copyright (c) 2008-2015 Apache Software Foundation - </span> - </form> -</div> - -</body> -</html> http://git-wip-us.apache.org/repos/asf/chukwa/blob/6e9e7899/src/main/web/hicc/logs/index.html ---------------------------------------------------------------------- diff --git a/src/main/web/hicc/logs/index.html b/src/main/web/hicc/logs/index.html new file mode 100644 index 0000000..a671297 --- /dev/null +++ b/src/main/web/hicc/logs/index.html @@ -0,0 +1,76 @@ +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +--> +<!DOCTYPE html> +<html lang="en" class="no-js"> + <head> + <title>Tile</title> + <link href="../css/bootstrap-theme.min.css" type="text/css" rel="stylesheet" /> + <link href="../css/bootstrap.min.css" type="text/css" rel="stylesheet" /> + <script src="../js/jquery.js" type="text/javascript"></script> + <script src="../js/bootstrap.min.js" type="text/javascript"></script> + <style> + .tile { + color: #ffffff; + background-color: #5bc0de; + } + .row { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; + } + .banner { + background-color: #ffffff; + } + </style> + </head> + <body onResize="resize()"> + <div class="jumbotron"> + <div class="container"> + <div class="row"> + <div class="col-xs-5 col-md-5 text-center tile"> + <h2><span class="glyphicon glyphicon-list" aria-hidden="true"></span></h2> + Logs + </div> + <div class="col-xs-7 col-md-7 text-center banner"> + <p><h1>85</h1> Errors</p> + </div> + </div> + </div> + </div> + + <script src="js/jquery.js"></script> + <script> + var tracker; + + function resize() { + clearTimeout(tracker); + tracker = setTimeout(render, 50); + } + + function render() { + document.body.style.overflow = 'hidden'; + tracker = setTimeout(render, 3000); + } + + $( document ).ready(function() { + render(); + }); + </script> + </body> +</html>
