Skip to content

Commit ed3ad95

Browse files
NihalJainPDavid
authored andcommitted
HBASE-20693 Refactor thrift jsp's and extract header and footer (apache#5732)
- Fixes the way logLevel page renders in UI Signed-off-by: Nick Dimiduk <ndimiduk@apache.org> (cherry picked from commit ede4ccd)
1 parent 3b3cb5d commit ed3ad95

File tree

3 files changed

+121
-68
lines changed

3 files changed

+121
-68
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<%--
2+
/**
3+
* Licensed to the Apache Software Foundation (ASF) under one
4+
* or more contributor license agreements. See the NOTICE file
5+
* distributed with this work for additional information
6+
* regarding copyright ownership. The ASF licenses this file
7+
* to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance
9+
* with the License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
--%>
20+
<script src="/static/js/jquery.min.js" type="text/javascript"></script>
21+
<script src="/static/js/bootstrap.min.js" type="text/javascript"></script>
22+
<script src="/static/js/tab.js" type="text/javascript"></script>
23+
<script type="text/javascript">
24+
$(document).ready(function() {
25+
$('li.active').removeClass('active');
26+
$('a[href="' + location.pathname + '"]').closest('li').addClass('active');
27+
});
28+
</script>
29+
</body>
30+
</html>
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
<%--
2+
/**
3+
* Licensed to the Apache Software Foundation (ASF) under one
4+
* or more contributor license agreements. See the NOTICE file
5+
* distributed with this work for additional information
6+
* regarding copyright ownership. The ASF licenses this file
7+
* to you under the Apache License, Version 2.0 (the
8+
* "License"); you may not use this file except in compliance
9+
* with the License. You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
--%>
20+
<%@ page contentType="text/html;charset=UTF-8"
21+
import="org.apache.hadoop.hbase.HBaseConfiguration"%>
22+
23+
<!DOCTYPE html>
24+
<?xml version="1.0" encoding="UTF-8" ?>
25+
<html lang="en">
26+
<head>
27+
<meta charset="utf-8">
28+
<title><%= request.getParameter("pageTitle")%></title>
29+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
30+
<meta name="description" content="">
31+
32+
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
33+
<link href="/static/css/bootstrap-theme.min.css" rel="stylesheet">
34+
<link href="/static/css/hbase.css" rel="stylesheet">
35+
</head>
36+
37+
<body>
38+
<div class="navbar navbar-fixed-top navbar-default">
39+
<div class="container-fluid">
40+
<div class="navbar-header">
41+
<button type="button"
42+
class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
43+
<span class="icon-bar"></span>
44+
<span class="icon-bar"></span>
45+
<span class="icon-bar"></span>
46+
</button>
47+
<a class="navbar-brand" href="/thrift.jsp">
48+
<img src="/static/hbase_logo_small.png" alt="HBase Logo"/>
49+
</a>
50+
</div>
51+
<div class="collapse navbar-collapse">
52+
<ul class="nav navbar-nav">
53+
<li class="active"><a href="/thrift.jsp">Home</a></li>
54+
<li><a href="/logs/">Local logs</a></li>
55+
<li><a href="/logLevel">Log Level</a></li>
56+
<li class="nav-item dropdown">
57+
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
58+
Metrics <span class="caret"></span>
59+
</a>
60+
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
61+
<li><a target="_blank" href="/jmx">JMX</a></li>
62+
<li><a target="_blank" href="/jmx?description=true">JMX with description</a></li>
63+
<li><a target="_blank" href="/prometheus">Prometheus</a></li>
64+
<li><a target="_blank" href="/prometheus?description=true">Prometheus with description</a></li>
65+
</ul>
66+
</li>
67+
<li><a href="/prof">Profiler</a></li>
68+
<% if (HBaseConfiguration.isShowConfInServlet()) { %>
69+
<li><a href="/conf">HBase Configuration</a></li>
70+
<% } %>
71+
</ul>
72+
</div><!--/.nav-collapse -->
73+
</div>
74+
</div>

hbase-thrift/src/main/resources/hbase-webapps/thrift/thrift.jsp

Lines changed: 17 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -19,80 +19,32 @@
1919
--%>
2020
<%@ page contentType="text/html;charset=UTF-8"
2121
import="org.apache.hadoop.conf.Configuration"
22-
import="org.apache.hadoop.hbase.HBaseConfiguration"
2322
import="org.apache.hadoop.hbase.util.VersionInfo"
2423
import="java.util.Date"
2524
%>
2625
<%@ page import="org.apache.hadoop.hbase.thrift.ImplType" %>
2726
<%@ page import="org.apache.hadoop.hbase.util.JvmVersion" %>
2827

2928
<%
30-
Configuration conf = (Configuration)getServletContext().getAttribute("hbase.conf");
31-
String serverType = (String)getServletContext().getAttribute("hbase.thrift.server.type");
32-
long startcode = conf.getLong("startcode", System.currentTimeMillis());
33-
String listenPort = conf.get("hbase.regionserver.thrift.port", "9090");
34-
ImplType implType = ImplType.getServerImpl(conf);
29+
Configuration conf = (Configuration)getServletContext().getAttribute("hbase.conf");
30+
String serverType = (String)getServletContext().getAttribute("hbase.thrift.server.type");
31+
long startcode = conf.getLong("startcode", System.currentTimeMillis());
32+
String listenPort = conf.get("hbase.regionserver.thrift.port", "9090");
33+
ImplType implType = ImplType.getServerImpl(conf);
3534
36-
String transport =
37-
(implType.isAlwaysFramed() ||
38-
conf.getBoolean("hbase.regionserver.thrift.framed", false)) ? "Framed" : "Standard";
39-
String protocol =
40-
conf.getBoolean("hbase.regionserver.thrift.compact", false) ? "Compact" : "Binary";
41-
String qop = conf.get("hbase.thrift.security.qop", "None");
35+
String transport =
36+
(implType.isAlwaysFramed() ||
37+
conf.getBoolean("hbase.regionserver.thrift.framed", false)) ? "Framed" : "Standard";
38+
String protocol =
39+
conf.getBoolean("hbase.regionserver.thrift.compact", false) ? "Compact" : "Binary";
40+
String qop = conf.get("hbase.thrift.security.qop", "None");
4241
42+
pageContext.setAttribute("pageTitle", "HBase Thrift Server: " + listenPort);
4343
%>
44-
<!DOCTYPE html>
45-
<?xml version="1.0" encoding="UTF-8" ?>
46-
<html lang="en">
47-
<head>
48-
<meta charset="utf-8">
49-
<title>HBase Thrift Server: <%= listenPort %></title>
50-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
51-
<meta name="description" content="">
5244

53-
<link href="/static/css/bootstrap.min.css" rel="stylesheet">
54-
<link href="/static/css/bootstrap-theme.min.css" rel="stylesheet">
55-
<link href="/static/css/hbase.css" rel="stylesheet">
56-
</head>
57-
58-
<body>
59-
<div class="navbar navbar-fixed-top navbar-default">
60-
<div class="container-fluid">
61-
<div class="navbar-header">
62-
<button type="button"
63-
class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
64-
<span class="icon-bar"></span>
65-
<span class="icon-bar"></span>
66-
<span class="icon-bar"></span>
67-
</button>
68-
<a class="navbar-brand" href="/thrift.jsp">
69-
<img src="/static/hbase_logo_small.png" alt="HBase Logo"/>
70-
</a>
71-
</div>
72-
<div class="collapse navbar-collapse">
73-
<ul class="nav navbar-nav">
74-
<li class="active"><a href="/">Home</a></li>
75-
<li><a href="/logs/">Local logs</a></li>
76-
<li><a href="/logLevel">Log Level</a></li>
77-
<li class="nav-item dropdown">
78-
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
79-
Metrics <span class="caret"></span>
80-
</a>
81-
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
82-
<li><a target="_blank" href="/jmx">JMX</a></li>
83-
<li><a target="_blank" href="/jmx?description=true">JMX with description</a></li>
84-
<li><a target="_blank" href="/prometheus">Prometheus</a></li>
85-
<li><a target="_blank" href="/prometheus?description=true">Prometheus with description</a></li>
86-
</ul>
87-
</li>
88-
<li><a href="/prof">Profiler</a></li>
89-
<% if (HBaseConfiguration.isShowConfInServlet()) { %>
90-
<li><a href="/conf">HBase Configuration</a></li>
91-
<% } %>
92-
</ul>
93-
</div><!--/.nav-collapse -->
94-
</div>
95-
</div>
45+
<jsp:include page="header.jsp">
46+
<jsp:param name="pageTitle" value="${pageTitle}"/>
47+
</jsp:include>
9648

9749
<div class="container-fluid content">
9850
<div class="row inner_header">
@@ -165,8 +117,5 @@ String qop = conf.get("hbase.thrift.security.qop", "None");
165117
</section>
166118
</div>
167119
</div>
168-
<script src="/static/js/jquery.min.js" type="text/javascript"></script>
169-
<script src="/static/js/bootstrap.min.js" type="text/javascript"></script>
170-
<script src="/static/js/tab.js" type="text/javascript"></script>
171-
</body>
172-
</html>
120+
121+
<jsp:include page="footer.jsp" />

0 commit comments

Comments
 (0)