Skip to content

Commit

Permalink
Merge pull request rashidkpc#26 from josegonzalez/master
Browse files Browse the repository at this point in the history
Added `app_path` configuration option
  • Loading branch information
Rashid Khan committed Apr 4, 2012
2 parents 3f14f58 + 40aa6fb commit 9f9b336
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 38 deletions.
3 changes: 3 additions & 0 deletions config.php
@@ -1,6 +1,9 @@
<?php

$KIBANA_CONFIG = array(
// Initial path to kibana
'app_path' => '',

// Your elastic search server
'elasticsearch_server' => "elasticsearch:9200",

Expand Down
73 changes: 48 additions & 25 deletions index.php
@@ -1,40 +1,63 @@
<?php
if (!defined('KIBANA_CONFIG_FILE')) {
// KIBANA_CONFIG_FILE is the path to the file that defines the
// $KIBANA_CONFIG configuration array.
// The default value will look for the file in the same directory as this
// script.

// allow overriding the config file via an environment variable.
$config_path = getenv('KIBANA_CONFIG_FILE');
if (empty($config_path)) {
$config_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'config.php';
}

define('KIBANA_CONFIG_FILE', $config_path);
}
require_once KIBANA_CONFIG_FILE;
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Kibana</title>
<script type="text/javascript" src="js/lib/excanvas.min.js"></script>
<script type="text/javascript" src="js/lib/jquery.min.js"></script>
<script type="text/javascript" src="js/lib/jquery.history.js"></script>
<script type="text/javascript" src="js/lib/jquery.flot.min.js"></script>
<script type="text/javascript" src="js/lib/jquery.flot.selection.min.js"></script>
<script type="text/javascript" src="js/lib/jquery.smartresize.js"></script>
<script type="text/javascript" src="js/lib/iso8601.min.js"></script>
<script type="text/javascript" src="js/lib/base64.js"></script>
<script type="text/javascript" src="js/lib/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="js/lib/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="js/lib/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="js/lib/jquery.ui.accordion.js"></script>
<script type="text/javascript" src="js/lib/json2.js"></script>
<script type="text/javascript" src="js/ajax.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap-dropdown.js"></script>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="bootstrap/css/bootstrap-responsive.min.css">
<LINK REL=StyleSheet HREF="css/style.css" TYPE="text/css" MEDIA=screen>
<LINK REL=StyleSheet HREF="css/jquery-ui-1.8.16.custom.css" TYPE="text/css" MEDIA=screen>
<LINK REL=StyleSheet HREF="css/jquery.ui.datepicker.css" TYPE="text/css" MEDIA=screen>
<script type="text/javascript" src="<?php echo $KIBANA_CONFIG['app_path'] ?>js/lib/excanvas.min.js"></script>
<script type="text/javascript" src="<?php echo $KIBANA_CONFIG['app_path'] ?>js/lib/jquery.min.js"></script>
<script type="text/javascript" src="<?php echo $KIBANA_CONFIG['app_path'] ?>js/lib/jquery.history.js"></script>
<script type="text/javascript" src="<?php echo $KIBANA_CONFIG['app_path'] ?>js/lib/jquery.flot.min.js"></script>
<script type="text/javascript" src="<?php echo $KIBANA_CONFIG['app_path'] ?>js/lib/jquery.flot.selection.min.js"></script>
<script type="text/javascript" src="<?php echo $KIBANA_CONFIG['app_path'] ?>js/lib/jquery.smartresize.js"></script>
<script type="text/javascript" src="<?php echo $KIBANA_CONFIG['app_path'] ?>js/lib/iso8601.min.js"></script>
<script type="text/javascript" src="<?php echo $KIBANA_CONFIG['app_path'] ?>js/lib/base64.js"></script>
<script type="text/javascript" src="<?php echo $KIBANA_CONFIG['app_path'] ?>js/lib/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="<?php echo $KIBANA_CONFIG['app_path'] ?>js/lib/jquery.ui.datepicker.js"></script>
<script type="text/javascript" src="<?php echo $KIBANA_CONFIG['app_path'] ?>js/lib/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="<?php echo $KIBANA_CONFIG['app_path'] ?>js/lib/jquery.ui.accordion.js"></script>
<script type="text/javascript" src="<?php echo $KIBANA_CONFIG['app_path'] ?>js/lib/json2.js"></script>
<script type="text/javascript">
var APP = {
path: <?php echo json_encode($KIBANA_CONFIG['app_path']) ?>
};
</script>
<script type="text/javascript" src="<?php echo $KIBANA_CONFIG['app_path'] ?>js/ajax.js"></script>

<script type="text/javascript" src="<?php echo $KIBANA_CONFIG['app_path'] ?>bootstrap/js/bootstrap.js"></script>
<script type="text/javascript" src="<?php echo $KIBANA_CONFIG['app_path'] ?>bootstrap/js/bootstrap-dropdown.js"></script>
<link rel="stylesheet" href="<?php echo $KIBANA_CONFIG['app_path'] ?>bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="<?php echo $KIBANA_CONFIG['app_path'] ?>bootstrap/css/bootstrap-responsive.min.css">
<link rel="stylesheet" href="<?php echo $KIBANA_CONFIG['app_path'] ?>css/style.css">
<link rel="stylesheet" href="<?php echo $KIBANA_CONFIG['app_path'] ?>css/jquery-ui-1.8.16.custom.css">
<link rel="stylesheet" href="<?php echo $KIBANA_CONFIG['app_path'] ?>css/jquery.ui.datepicker.css">
<style type="text/css">
body {
padding-top: 65px;
padding-bottom: 40px;
}

</style>
<link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
<link href="<?php echo $KIBANA_CONFIG['app_path'] ?>favicon.ico" rel="shortcut icon" type="image/x-icon" />

</head>

Expand All @@ -46,7 +69,7 @@
<div class="container-fluid">
<form id='searchform' class="form-search form-horizontal" action="">
<table class=formatting><tr>
<td width='1%'><center><img src='images/logo.png'></center></td>
<td width='1%'><center><img src='<?php echo $KIBANA_CONFIG['app_path'] ?>images/logo.png'></center></td>
<td width='1%'>
<select name="time" id=timeinput class="span2">
<option value="15 minutes">Last 15m</option>
Expand Down Expand Up @@ -90,7 +113,7 @@
<p id=graphheader></p>
<div id=graph style='height: 100px;'>
<div class=hero-unit>
<h1><img src=images/kibana_banner.png></h1>
<h1><img src=<?php echo $KIBANA_CONFIG['app_path'] ?>images/kibana_banner.png></h1>
<br><br>
<p><strong>Welcome to Kibana.</strong> Give me a few moments, I'm fetching some interesting data to display. It might be a minute, there could be lots of data in here. Consider the thousands, millions or billions of events I might be looking through, to find just the right ones for you. It's nothing, really. You're welcome.
</p>
Expand Down
24 changes: 12 additions & 12 deletions js/ajax.js
Expand Up @@ -105,7 +105,7 @@ function getPage() {

//Get the data and display it
request = $.ajax({
url: "loader2.php",
url: window.APP.path + "loader2.php",
type: "GET",
data: data,
cache: false,
Expand Down Expand Up @@ -186,7 +186,7 @@ function getPage() {

// Create and populate graph
$('#graph').html(
'<center><br><p><img src=images/barload.gif></center>');
'<center><br><p><img src=' + window.APP.path + 'images/barload.gif></center>');
getGraph(resultjson.graph.interval);

// Create and populate #logs table
Expand Down Expand Up @@ -222,7 +222,7 @@ function getGraph(interval) {

//Get the data and display it
request = $.ajax({
url: "loader2.php",
url: window.APP.path + "loader2.php",
type: "GET",
data: data,
cache: false,
Expand Down Expand Up @@ -261,7 +261,7 @@ function getAnalysis() {
var data = 'page=' + sendhash + "&mode=" + window.hashjson.mode;
//Get the data and display it
request = $.ajax({
url: "loader2.php",
url: window.APP.path + "loader2.php",
type: "GET",
data: data,
cache: false,
Expand Down Expand Up @@ -397,7 +397,7 @@ function getAnalysis() {

function graphLoading() {
$('#graph').html(
'<center><br><p><img src=images/barload.gif></center>');
'<center><br><p><img src=' + window.APP.path + 'images/barload.gif></center>');
}

function analysisTable(resultjson) {
Expand Down Expand Up @@ -437,7 +437,7 @@ function analysisTable(resultjson) {
function setMeta(hits, indexed, mode) {
var metastr = "";
if ( mode == 'loading' ) {
metastr += '<img src=images/ajax-loader.gif>';
metastr += '<img src=' + window.APP.path + 'images/ajax-loader.gif>';
} else {
metastr = '<table class=formatting>' +
"<tr><td>Hits</td><td>" + addCommas(hits) + "</td></tr>" +
Expand Down Expand Up @@ -722,15 +722,15 @@ function mFields(field) {
}

function feedLinks(obj) {
var str = "<a href=loader2.php?mode=rss&page=" +
var str = "<a href=" + window.APP.path + "loader2.php?mode=rss&page=" +
base64Encode(JSON.stringify(obj)) +
">rss <img src=images/feed.png></a> "+
"<a href=loader2.php?mode=csv&page=" +
">rss <img src=" + window.APP.path + "images/feed.png></a> "+
"<a href=" + window.APP.path + "loader2.php?mode=csv&page=" +
base64Encode(JSON.stringify(obj)) +
">export <img src=images/csv.gif></a> "+
"<a href=stream.html#" +
">export <img src=" + window.APP.path + "images/csv.gif></a> "+
"<a href=" + window.APP.path + "stream.html#" +
base64Encode(JSON.stringify(obj)) +
">stream <img src=images/stream.png></a>"
">stream <img src=" + window.APP.path + "images/stream.png></a>"
return str;
}

Expand Down
2 changes: 1 addition & 1 deletion js/stream.js
Expand Up @@ -23,7 +23,7 @@ function getStream() {
window.hashjson.timeframe = '20 seconds';
var maxEvents = 15;
var b64json = base64Encode(JSON.stringify(window.hashjson));
$.getJSON("loader2.php?mode=stream&page=" + b64json, null, function(data) {
$.getJSON(window.APP.path + "loader2.php?mode=stream&page=" + b64json, null, function(data) {
if (data != null) {
window.i++;
var hasTime = false;
Expand Down

0 comments on commit 9f9b336

Please sign in to comment.