Skip to content
This repository has been archived by the owner on Oct 6, 2018. It is now read-only.

Commit

Permalink
Bumped up version to 2.1.0-SNAPSHOT; added RAML API Console
Browse files Browse the repository at this point in the history
  • Loading branch information
cjmamo committed Jun 28, 2014
1 parent 7d9b47c commit c536513
Show file tree
Hide file tree
Showing 40 changed files with 123,368 additions and 24 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -32,7 +32,7 @@ Kafka Web Console is a Java web application for monitoring [Apache Kafka](http:/

***

Furthermore, the console provides a JSON API.
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.

Requirements
---
Expand All @@ -55,7 +55,7 @@ Getting Started
- Apache Derby
- Microsoft SQL Server

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

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

Expand Down
25 changes: 25 additions & 0 deletions app/controllers/ApiConsole.scala
@@ -0,0 +1,25 @@
/*
* Copyright 2014 Claude Mamo
*
* Licensed 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.
*/

package controllers

import play.api.mvc.{AnyContent, Action, Controller}

object ApiConsole extends Controller{
def at(path: String, file: String): Action[AnyContent] = {
Assets.at(path, file)
}
}
2 changes: 1 addition & 1 deletion build.sbt
@@ -1,6 +1,6 @@
name := "kafka-web-console"

version := "2.0.0"
version := "2.1.0-SNAPSHOT"

libraryDependencies ++= Seq(
jdbc,
Expand Down
45 changes: 24 additions & 21 deletions conf/routes
Expand Up @@ -3,33 +3,36 @@
# ~~~~

# Home page
GET / controllers.Application.index()
GET / controllers.Application.index()

GET /zookeepers controllers.Assets.at(path="/public", file="html/partials/zookeeper/index.html")
GET /zookeepers.json/feed controllers.Zookeeper.feed()
GET /zookeepers.json/:group controllers.Zookeeper.index(group)
PUT /zookeepers.json controllers.Zookeeper.create()
DELETE /zookeepers.json/:name controllers.Zookeeper.delete(name)
GET /zookeepers controllers.Assets.at(path="/public", file="html/partials/zookeeper/index.html")
GET /zookeepers.json/feed controllers.Zookeeper.feed()
GET /zookeepers.json/:group controllers.Zookeeper.index(group)
PUT /zookeepers.json controllers.Zookeeper.create()
DELETE /zookeepers.json/:name controllers.Zookeeper.delete(name)

GET /topics controllers.Assets.at(path="/public", file="html/partials/topic/index.html")
GET /topics.json controllers.Topic.index()
GET /topics.json/:topic/:zookeeper controllers.Topic.show(topic, zookeeper)
GET /topics.json/:topic/:zookeeper/feed controllers.Topic.feed(topic, zookeeper)
GET /topics/:name/:zookeeper controllers.IgnoreParamAssets.at(path="/public", file="html/partials/topic/show.html", name, zookeeper)
GET /topics controllers.Assets.at(path="/public", file="html/partials/topic/index.html")
GET /topics.json controllers.Topic.index()
GET /topics.json/:topic/:zookeeper controllers.Topic.show(topic, zookeeper)
GET /topics.json/:topic/:zookeeper/feed controllers.Topic.feed(topic, zookeeper)
GET /topics/:name/:zookeeper controllers.IgnoreParamAssets.at(path="/public", file="html/partials/topic/show.html", name, zookeeper)

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

GET /groups controllers.Group.index()
GET /groups controllers.Group.index()

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

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

GET /settings controllers.Assets.at(path="/public", file="html/partials/settings/index.html")
GET /settings.json controllers.Settings.index()
POST /settings.json controllers.Settings.update()
GET /settings controllers.Assets.at(path="/public", file="html/partials/settings/index.html")
GET /settings.json controllers.Settings.index()
POST /settings.json controllers.Settings.update()

# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)
GET /assets/*file controllers.Assets.at(path="/public", file)

GET /api/console controllers.ApiConsole.at(path="/public/api-console", file="index.html")
GET /api/*file controllers.ApiConsole.at(path="/public/api-console", file)
33 changes: 33 additions & 0 deletions public/api-console/authentication/oauth1.html
@@ -0,0 +1,33 @@
<!doctype html>
<html>
<head>
<script type='text/javascript'>
function getVariable(string, variable) {
var vars = string.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (decodeURIComponent(pair[0]) == variable) {
return decodeURIComponent(pair[1]);
}
}

return undefined;
}

function getQueryVariable(variable) {
var query = window.location.search.substring(1);
return getVariable(query, variable);
}

var result = {
token: getQueryVariable('oauth_token'),
verifier: getQueryVariable('oauth_verifier')
};

window.opener.RAML.authorizationSuccess(result);
window.close();
</script>
</head>
<body>
</body>
</html>
34 changes: 34 additions & 0 deletions public/api-console/authentication/oauth2.html
@@ -0,0 +1,34 @@
<!doctype html>
<html>
<head>
<script type='text/javascript'>
function getVariable(string, variable) {
var vars = string.split('&');
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (decodeURIComponent(pair[0]) == variable) {
return decodeURIComponent(pair[1]);
}
}

return undefined;
}

function getFragmentVariable(variable) {
var hash = window.location.hash.substring(1);
return getVariable(hash, variable);
}

function getQueryVariable(variable) {
var query = window.location.search.substring(1);
return getVariable(query, variable);
}

var result = getFragmentVariable('access_token') || getQueryVariable('code');
window.opener.RAML.authorizationSuccess(result);
window.close();
</script>
</head>
<body>
</body>
</html>
Binary file added public/api-console/fonts/FontAwesome.otf
Binary file not shown.

0 comments on commit c536513

Please sign in to comment.