/usr/lib/python2.7/dist-packages/graphite/templates/cli.html is in graphite-web 0.9.12+debian-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | <!-- Copyright 2008 Orbitz WorldWide
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. -->
<head>
<link rel='stylesheet' type='text/css' href='../content/css/cli.css'>
<link rel='stylesheet' type='text/css' href='../content/css/default.css'>
<script src="../content/js/window/prototype.js" type="text/javascript"></script>
<script src="../content/js/window/effects.js" type="text/javascript"></script>
<script src="../content/js/window/window.js" type="text/javascript"></script>
<script src="../content/js/window/window_effects.js" type="text/javascript"></script>
<script src="../content/js/scriptaculous/scriptaculous.js?load=controls,builder"></script>
<script src="../content/js/cli.js" type="text/javascript"></script>
</head>
<script type="text/javascript">
var URL = "../cli/eval";
{% if user.is_authenticated %}
var graphitePrompt = "{{user.username}}@graphite>";
{% else %}
var graphitePrompt = "graphite>";
{% endif %}
function sendCommand () {
var params = Form.serialize('inputForm') + '&_salt=' + (new Date()).valueOf();
var cmd = $('commandInput').value;
$('commandInput').value = ""
$('output').innerHTML += graphitePrompt + cmd + "<br/>";
if (cmd == '') { return false; }
$('commandInput').disabled = true;
$('input').style.visibility = 'hidden';
var req = new Ajax.Request(URL, {method: 'get', parameters: params, onComplete: handleResponse, onException: handleException});
return false;
}
function restorePrompt() {
$('input').style.visibility = 'visible';
$('commandInput').disabled = false;
$('commandInput').blur();
$('commandInput').focus();
scrollBy(0,1000);
}
function handleResponse (req) {
eval(req.responseText);
restorePrompt();
}
function handleException (req, exc) {
$('output').innerHTML += '<font color="red">AJAX Exception ' + exc.name + ': ' + exc.message + '</font><br/>';
restorePrompt();
}
function changeImage (win, url) {
var img_id = win.getId().replace('_win','_img');
var resizeCode = "var w=Windows.getWindow('" + win.getId() + "');w.setSize(this.width,this.height);"
var newCenter = Builder.node( 'center', [Builder.node('img', {id: img_id, src: url, onload: resizeCode} )] );
var content = win.getContent();
var oldCenter = content.getElementsByTagName('center')[0];
var oldImage = oldCenter.getElementsByTagName('img')[0];
oldCenter.removeChild( oldImage );
content.removeChild( oldCenter );
content.appendChild( newCenter );
}
resizeObserver = {
onEndResize: function(eventName, win) {
var img_id = win.getId().replace('_win','_img');
var img = $(img_id);
if (!img) { return; }
var url = img.src;
if (url.indexOf('?') == -1) { return; }
var size = win.getSize();
if (url.indexOf('&height=') != -1) {
url = url.replace(/&height=[0-9]+/, '&height=' + size['height']);
} else {
url = url + '&height=' + size['height'];
}
if (url.indexOf('&width=') != -1) {
url = url.replace(/&width=[0-9]+/, '&width=' + size['width']);
} else {
url = url + '&width=' + size['width'];
}
changeImage(win, url);
}
}
Windows.addObserver(resizeObserver);
</script>
</head>
<body class='mybody' onload="$('commandInput').focus();" onclick="$('commandInput').focus();">
<div id="output"></div>
<div id="input">
<form id='inputForm' action='null' method='get' onsubmit="sendCommand(); return false">
{% comment %}
The line below is ugly as hell but it makes the prompt look better to not have a space after it.
{% endcomment %}
{% if user.is_authenticated %}{{user.username}}@graphite>{% else %}graphite>{% endif %}<input type='text' id='commandInput' name='commandInput' class='commandEntry' size='130' autocomplete='off'>
<div id='completerDiv' class='autocomplete'></div>
<script type="text/javascript">
function chooseTarget(element) {
if (window.completer.drawMode()) {
window.completer.hide();
window.completer.active = false;
} else if (window.completer.historyMode()) {
var txt = element.childNodes[0].nodeValue;
$('commandInput').value = txt;
}
}
window.completer = new GraphiteCompleter( 'commandInput',
'completerDiv',
'../cli/autocomplete/',
{
method: 'get',
paramName: 'path',
//updateElement: chooseTarget,
tokens: [',']
}
);
</script>
</form>
</div>
<script type="text/javascript">
if ("{{ command }}") {
$('commandInput').value = "{{command}}";
sendCommand();
}
</script>
|