Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions frontend/etcdbrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ app.controller('NodeCtrl', ['$scope','$http','$cookies', function($scope,$http,$

$scope.loadNode = function(node){
delete $scope.error;
$http({method: 'GET', url: $scope.getPrefix() + keyPrefix + node.key}).
$http({withCredentials: true,method: 'GET', url: $scope.getPrefix() + keyPrefix + node.key}).
success(function(data) {
prepNodes(data.node.nodes,node);
node.nodes = data.node.nodes;
Expand Down Expand Up @@ -72,17 +72,17 @@ app.controller('NodeCtrl', ['$scope','$http','$cookies', function($scope,$http,$
var value = prompt("Enter Property value", "");
if(!name || name == "") return;

$http({method: 'PUT',
url: $scope.getPrefix() + keyPrefix + node.key + (node.key != "/" ? "/" : "") + name,
params: {"value": value}}).
$http({withCredentials: true,method: 'PUT',
url: $scope.getPrefix() + keyPrefix + node.key + (node.key != "/" ? "/" : "") + name,
params: {"value": value}}).
success(function(data) {
$scope.loadNode(node);
}).
error(errorHandler);
}

$scope.updateNode = function(node,value){
$http({method: 'PUT',
$http({withCredentials: true,method: 'PUT',
url: $scope.getPrefix() + keyPrefix + node.key,
params: {"value": value}}).
success(function(data) {
Expand All @@ -92,7 +92,7 @@ app.controller('NodeCtrl', ['$scope','$http','$cookies', function($scope,$http,$
}

$scope.deleteNode = function(node){
$http({method: 'DELETE', url: $scope.getPrefix() + keyPrefix + node.key}).
$http({withCredentials: true,method: 'DELETE', url: $scope.getPrefix() + keyPrefix + node.key}).
success(function(data) {
$scope.loadNode(node.parent);
}).
Expand All @@ -103,7 +103,7 @@ app.controller('NodeCtrl', ['$scope','$http','$cookies', function($scope,$http,$
var dirName = prompt("Copy property to directory","/");
if(!dirName || dirName == "") return;
dirName = $scope.formatDir(dirName);
$http({method: 'PUT',
$http({withCredentials: true,method: 'PUT',
url: $scope.getPrefix() + keyPrefix + dirName + node.name,
params: {"value": node.value}}).
error(errorHandler);
Expand All @@ -112,7 +112,7 @@ app.controller('NodeCtrl', ['$scope','$http','$cookies', function($scope,$http,$
$scope.createDir = function(node){
var dirName = prompt("Enter Directory Name", "");
if(!dirName || dirName == "") return;
$http({method: 'PUT',
$http({withCredentials: true,method: 'PUT',
url: $scope.getPrefix() + keyPrefix + node.key + (node.key != "/" ? "/" : "") + dirName,
params: {"dir": true}}).
success(function(data) {
Expand All @@ -122,7 +122,7 @@ app.controller('NodeCtrl', ['$scope','$http','$cookies', function($scope,$http,$
}

$scope.copyDirAux = function(node, tarjet){
$http({method: 'GET', url: $scope.getPrefix() + keyPrefix + node.key}).
$http({withCredentials: true,method: 'GET', url: $scope.getPrefix() + keyPrefix + node.key}).
success(function(data) {
prepNodes(data.node.nodes,node);
node.nodes = data.node.nodes;
Expand All @@ -131,7 +131,7 @@ app.controller('NodeCtrl', ['$scope','$http','$cookies', function($scope,$http,$
$scope.copyDirAux(node.nodes[key], tarjet + node.nodes[key].name + "/")
} else {
var url = $scope.getPrefix() + keyPrefix + tarjet + node.nodes[key].name
$http({method: 'PUT',
$http({withCredentials: true,method: 'PUT',
url: url,
params: {"value": node.nodes[key].value}}).
error(errorHandler);
Expand All @@ -150,7 +150,7 @@ app.controller('NodeCtrl', ['$scope','$http','$cookies', function($scope,$http,$

$scope.deleteDir = function(node) {
if(!confirm("Are you sure you want to delete " + node.key)) return;
$http({method: 'DELETE',
$http({withCredentials: true,method: 'DELETE',
url: $scope.getPrefix() + keyPrefix + node.key + "?dir=true&recursive=true"}).
success(function(data) {
$scope.loadNode(node.parent);
Expand Down Expand Up @@ -179,19 +179,19 @@ app.controller('NodeCtrl', ['$scope','$http','$cookies', function($scope,$http,$
$scope.loadStats = function(){
console.log("LOAD STATS");
$scope.stats = {};
$http({method: 'GET', url: $scope.getPrefix() + statsPrefix + "/store"}).
$http({withCredentials: true,method: 'GET', url: $scope.getPrefix() + statsPrefix + "/store"}).
success(function(data) {
$scope.stats.store = JSON.stringify(data, null, " ");
}).
error(errorHandler);
delete $scope.storeStats;
$http({method: 'GET', url: $scope.getPrefix() + statsPrefix + "/leader"}).
$http({withCredentials: true,method: 'GET', url: $scope.getPrefix() + statsPrefix + "/leader"}).
success(function(data) {
$scope.stats.leader = JSON.stringify(data, null, " ");
}).
error(errorHandler);
delete $scope.storeStats;
$http({method: 'GET', url: $scope.getPrefix() + statsPrefix + "/self"}).
$http({withCredentials: true,method: 'GET', url: $scope.getPrefix() + statsPrefix + "/self"}).
success(function(data) {
$scope.stats.self = JSON.stringify(data, null, " ");
}).
Expand Down
5 changes: 3 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ var serverPort = process.env.SERVER_PORT || 8000;
var publicDir = 'frontend';
var authUser = process.env.AUTH_USER;
var authPass = process.env.AUTH_PASS;

var serverDir = path.dirname(process.argv[1]);


var mimeTypes = {
Expand Down Expand Up @@ -62,7 +62,8 @@ http.createServer(function serverFile(req, res) {
return proxy(req, res);
}
var uri = url.parse(req.url).pathname;
var filename = path.join(process.cwd(), publicDir, uri);

var filename = path.join(serverDir, publicDir, uri);

fs.exists(filename, function(exists) {
// proxy if file does not exist
Expand Down