Skip to content

Commit c536513

Browse files
committed
Bumped up version to 2.1.0-SNAPSHOT; added RAML API Console
1 parent 7d9b47c commit c536513

40 files changed

+123368
-24
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Kafka Web Console is a Java web application for monitoring [Apache Kafka](http:/
3232

3333
***
3434

35-
Furthermore, the console provides a JSON API.
35+
Furthermore, the console provides a JSON API described in [RAML](/public/api-console/kafka-web-console.raml). The API can be tested using the embedded API Console accessible through the URL http://*[hostname]*:*[port]*/api/console.
3636

3737
Requirements
3838
---
@@ -55,7 +55,7 @@ Getting Started
5555
- Apache Derby
5656
- Microsoft SQL Server
5757

58-
Changing the database might necessitate making minor changes to the DDL found in *conf/evolutions/default* to accommodate the new database.
58+
Changing the database might necessitate making minor modifications to the DDL found in *conf/evolutions/default* to accommodate the new database.
5959

6060
2. Before you can monitor a broker, you need to register the Zookeeper server associated with it:
6161

app/controllers/ApiConsole.scala

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2014 Claude Mamo
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
*/
16+
17+
package controllers
18+
19+
import play.api.mvc.{AnyContent, Action, Controller}
20+
21+
object ApiConsole extends Controller{
22+
def at(path: String, file: String): Action[AnyContent] = {
23+
Assets.at(path, file)
24+
}
25+
}

build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name := "kafka-web-console"
22

3-
version := "2.0.0"
3+
version := "2.1.0-SNAPSHOT"
44

55
libraryDependencies ++= Seq(
66
jdbc,

conf/routes

+24-21
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,36 @@
33
# ~~~~
44

55
# Home page
6-
GET / controllers.Application.index()
6+
GET / controllers.Application.index()
77

8-
GET /zookeepers controllers.Assets.at(path="/public", file="html/partials/zookeeper/index.html")
9-
GET /zookeepers.json/feed controllers.Zookeeper.feed()
10-
GET /zookeepers.json/:group controllers.Zookeeper.index(group)
11-
PUT /zookeepers.json controllers.Zookeeper.create()
12-
DELETE /zookeepers.json/:name controllers.Zookeeper.delete(name)
8+
GET /zookeepers controllers.Assets.at(path="/public", file="html/partials/zookeeper/index.html")
9+
GET /zookeepers.json/feed controllers.Zookeeper.feed()
10+
GET /zookeepers.json/:group controllers.Zookeeper.index(group)
11+
PUT /zookeepers.json controllers.Zookeeper.create()
12+
DELETE /zookeepers.json/:name controllers.Zookeeper.delete(name)
1313

14-
GET /topics controllers.Assets.at(path="/public", file="html/partials/topic/index.html")
15-
GET /topics.json controllers.Topic.index()
16-
GET /topics.json/:topic/:zookeeper controllers.Topic.show(topic, zookeeper)
17-
GET /topics.json/:topic/:zookeeper/feed controllers.Topic.feed(topic, zookeeper)
18-
GET /topics/:name/:zookeeper controllers.IgnoreParamAssets.at(path="/public", file="html/partials/topic/show.html", name, zookeeper)
14+
GET /topics controllers.Assets.at(path="/public", file="html/partials/topic/index.html")
15+
GET /topics.json controllers.Topic.index()
16+
GET /topics.json/:topic/:zookeeper controllers.Topic.show(topic, zookeeper)
17+
GET /topics.json/:topic/:zookeeper/feed controllers.Topic.feed(topic, zookeeper)
18+
GET /topics/:name/:zookeeper controllers.IgnoreParamAssets.at(path="/public", file="html/partials/topic/show.html", name, zookeeper)
1919

20-
GET /consumergroups.json/:name/:topic/:zookeeper controllers.ConsumerGroup.show(name, topic, zookeeper)
20+
GET /consumergroups.json/:consumerGroup/:topic/:zookeeper controllers.ConsumerGroup.show(consumerGroup, topic, zookeeper)
2121

22-
GET /groups controllers.Group.index()
22+
GET /groups controllers.Group.index()
2323

24-
GET /brokers controllers.Assets.at(path="/public", file="html/partials/broker/index.html")
25-
GET /brokers.json controllers.Broker.index()
24+
GET /brokers controllers.Assets.at(path="/public", file="html/partials/broker/index.html")
25+
GET /brokers.json controllers.Broker.index()
2626

27-
GET /offsethistory/:consumerGroup/:topic/:zookeeper controllers.IgnoreParamAssets.at2(path="/public", file="html/partials/offset-history/show.html", consumerGroup, topic, zookeeper)
28-
GET /offsethistory.json/:consumerGroup/:topic/:zookeeper controllers.OffsetHistory.show(consumerGroup, topic, zookeeper)
27+
GET /offsethistory/:consumerGroup/:topic/:zookeeper controllers.IgnoreParamAssets.at2(path="/public", file="html/partials/offset-history/show.html", consumerGroup, topic, zookeeper)
28+
GET /offsethistory.json/:consumerGroup/:topic/:zookeeper controllers.OffsetHistory.show(consumerGroup, topic, zookeeper)
2929

30-
GET /settings controllers.Assets.at(path="/public", file="html/partials/settings/index.html")
31-
GET /settings.json controllers.Settings.index()
32-
POST /settings.json controllers.Settings.update()
30+
GET /settings controllers.Assets.at(path="/public", file="html/partials/settings/index.html")
31+
GET /settings.json controllers.Settings.index()
32+
POST /settings.json controllers.Settings.update()
3333

3434
# Map static resources from the /public folder to the /assets URL path
35-
GET /assets/*file controllers.Assets.at(path="/public", file)
35+
GET /assets/*file controllers.Assets.at(path="/public", file)
36+
37+
GET /api/console controllers.ApiConsole.at(path="/public/api-console", file="index.html")
38+
GET /api/*file controllers.ApiConsole.at(path="/public/api-console", file)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<script type='text/javascript'>
5+
function getVariable(string, variable) {
6+
var vars = string.split('&');
7+
for (var i = 0; i < vars.length; i++) {
8+
var pair = vars[i].split('=');
9+
if (decodeURIComponent(pair[0]) == variable) {
10+
return decodeURIComponent(pair[1]);
11+
}
12+
}
13+
14+
return undefined;
15+
}
16+
17+
function getQueryVariable(variable) {
18+
var query = window.location.search.substring(1);
19+
return getVariable(query, variable);
20+
}
21+
22+
var result = {
23+
token: getQueryVariable('oauth_token'),
24+
verifier: getQueryVariable('oauth_verifier')
25+
};
26+
27+
window.opener.RAML.authorizationSuccess(result);
28+
window.close();
29+
</script>
30+
</head>
31+
<body>
32+
</body>
33+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<script type='text/javascript'>
5+
function getVariable(string, variable) {
6+
var vars = string.split('&');
7+
for (var i = 0; i < vars.length; i++) {
8+
var pair = vars[i].split('=');
9+
if (decodeURIComponent(pair[0]) == variable) {
10+
return decodeURIComponent(pair[1]);
11+
}
12+
}
13+
14+
return undefined;
15+
}
16+
17+
function getFragmentVariable(variable) {
18+
var hash = window.location.hash.substring(1);
19+
return getVariable(hash, variable);
20+
}
21+
22+
function getQueryVariable(variable) {
23+
var query = window.location.search.substring(1);
24+
return getVariable(query, variable);
25+
}
26+
27+
var result = getFragmentVariable('access_token') || getQueryVariable('code');
28+
window.opener.RAML.authorizationSuccess(result);
29+
window.close();
30+
</script>
31+
</head>
32+
<body>
33+
</body>
34+
</html>
61.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)