Skip to content

Commit

Permalink
Add server id throughout
Browse files Browse the repository at this point in the history
  • Loading branch information
trask committed Oct 10, 2015
1 parent 9b105ab commit d377759
Show file tree
Hide file tree
Showing 90 changed files with 1,720 additions and 1,424 deletions.
1 change: 0 additions & 1 deletion core/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@
<script src="scripts/controllers/jvm/glowroot-log.js"></script>
<script src="scripts/controllers/config.js"></script>
<script src="scripts/controllers/config/common.js"></script>
<script src="scripts/controllers/config/transaction.js"></script>
<script src="scripts/controllers/config/user-interface.js"></script>
<script src="scripts/controllers/config/storage.js"></script>
<script src="scripts/controllers/config/smtp.js"></script>
Expand Down
3 changes: 3 additions & 0 deletions core/app/scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ glowroot.run([
'login',
function ($rootScope, $http, $location, $state, login) {

// FIXME
$rootScope.serverId = 0;

$rootScope.showSignIn = function () {
return !$rootScope.authenticatedUser && $rootScope.layout && $rootScope.layout.adminPasswordEnabled;
};
Expand Down
2 changes: 1 addition & 1 deletion core/app/scripts/controllers/config/alert-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ glowroot.controller('ConfigAlertListCtrl', [
'httpErrors',
function ($scope, $location, $http, httpErrors) {

$http.get('backend/config/alerts')
$http.get('backend/config/alerts?server-id=' + $scope.serverId)
.success(function (data) {
$scope.loaded = true;
$scope.alerts = data;
Expand Down
9 changes: 7 additions & 2 deletions core/app/scripts/controllers/config/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ glowroot.controller('ConfigAlertCtrl', [
}

if (version) {
$http.get('backend/config/alerts/' + version)
$http.get('backend/config/alerts?server-id=' + $scope.serverId + '&version=' + version)
.success(function (data) {
$scope.loaded = true;
onNewData(data);
Expand Down Expand Up @@ -75,6 +75,7 @@ glowroot.controller('ConfigAlertCtrl', [

$scope.save = function (deferred) {
var postData = angular.copy($scope.config);
postData.serverId = $scope.serverId;
var url;
if (version) {
url = 'backend/config/alerts/update';
Expand All @@ -100,7 +101,11 @@ glowroot.controller('ConfigAlertCtrl', [
};

$scope.delete = function (deferred) {
$http.post('backend/config/alerts/remove', '"' + $scope.config.version + '"')
var postData = {
serverId: $scope.serverId,
version: $scope.config.version
};
$http.post('backend/config/alerts/remove', postData)
.success(function () {
removeConfirmIfHasChangesListener();
$location.url('config/alert-list').replace();
Expand Down
7 changes: 5 additions & 2 deletions core/app/scripts/controllers/config/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ glowroot.controller('ConfigCommonCtrl', [
'confirmIfHasChanges',
'httpErrors',
function ($scope, $http, backendUrl, confirmIfHasChanges, httpErrors) {

$scope.hasChanges = function () {
return $scope.originalConfig && !angular.equals($scope.config, $scope.originalConfig);
};
Expand All @@ -42,15 +43,17 @@ glowroot.controller('ConfigCommonCtrl', [
}

$scope.save = function (deferred) {
$http.post(backendUrl, $scope.config)
var postData = angular.copy($scope.config);
postData.serverId = $scope.serverId;
$http.post(backendUrl, postData)
.success(function (data) {
onNewData(data);
deferred.resolve('Saved');
})
.error(httpErrors.handler($scope, deferred));
};

$http.get(backendUrl)
$http.get(backendUrl + '?server-id=' + $scope.serverId)
.success(onNewData)
.error(httpErrors.handler($scope));
}
Expand Down
2 changes: 1 addition & 1 deletion core/app/scripts/controllers/config/gauge-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ glowroot.controller('ConfigGaugeListCtrl', [
return gauge.config.display.replace(/\//g, '\u200b/');
};

$http.get('backend/config/gauges')
$http.get('backend/config/gauges?server-id=' + $scope.serverId)
.success(function (data) {
$scope.loaded = true;
$scope.gauges = data;
Expand Down
11 changes: 9 additions & 2 deletions core/app/scripts/controllers/config/gauge.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ glowroot.controller('ConfigGaugeCtrl', [
}

if (version) {
$http.get('backend/config/gauges/' + version)
$http.get('backend/config/gauges?server-id=' + $scope.serverId + '&version=' + version)
.success(function (data) {
$scope.loaded = true;
onNewData(data);
Expand Down Expand Up @@ -131,6 +131,7 @@ glowroot.controller('ConfigGaugeCtrl', [
return [suggestion];
}
var queryData = {
serverId: $scope.serverId,
partialMBeanObjectName: suggestion,
limit: 10
};
Expand Down Expand Up @@ -168,6 +169,7 @@ glowroot.controller('ConfigGaugeCtrl', [

function fetchMBeanAttributes(mbeanObjectName) {
var queryData = {
serverId: $scope.serverId,
mbeanObjectName: mbeanObjectName,
gaugeVersion: $scope.config.version || ''
};
Expand Down Expand Up @@ -206,6 +208,7 @@ glowroot.controller('ConfigGaugeCtrl', [

$scope.save = function (deferred) {
var postData = angular.copy($scope.config);
postData.serverId = $scope.serverId;
postData.mbeanAttributes = $scope.config.mbeanAttributes;
var url;
if (version) {
Expand Down Expand Up @@ -237,7 +240,11 @@ glowroot.controller('ConfigGaugeCtrl', [
};

$scope.delete = function (deferred) {
$http.post('backend/config/gauges/remove', '"' + $scope.config.version + '"')
var postData = {
serverId: $scope.serverId,
version: $scope.config.version
};
$http.post('backend/config/gauges/remove', postData)
.success(function () {
removeConfirmIfHasChangesListener();
$location.url('config/gauge-list').replace();
Expand Down
4 changes: 2 additions & 2 deletions core/app/scripts/controllers/config/instrumentation-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ glowroot.controller('ConfigInstrumentationListCtrl', [
};

function refresh(deferred) {
$http.get('backend/config/instrumentation')
$http.get('backend/config/instrumentation?server-id=' + $scope.serverId)
.success(function (data) {
$scope.loaded = true;
$scope.configs = data.configs;
Expand All @@ -55,7 +55,7 @@ glowroot.controller('ConfigInstrumentationListCtrl', [
deferred.resolve();
} else {
// preload cache for class name and method name auto completion
$http.get('backend/config/preload-classpath-cache');
$http.get('backend/config/preload-classpath-cache?server-id=' + $scope.serverId);
}
})
.error(httpErrors.handler($scope, deferred));
Expand Down
12 changes: 10 additions & 2 deletions core/app/scripts/controllers/config/instrumentation.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ glowroot.controller('ConfigInstrumentationCtrl', [
}

if (version) {
$http.get('backend/config/instrumentation/' + version)
$http.get('backend/config/instrumentation?server-id=' + $scope.serverId + '&version=' + version)
.success(function (data) {
$scope.loaded = true;
onNewData(data);
Expand Down Expand Up @@ -115,6 +115,7 @@ glowroot.controller('ConfigInstrumentationCtrl', [

$scope.classNames = function (suggestion) {
var postData = {
serverId: $scope.serverId,
partialClassName: suggestion,
limit: 10
};
Expand Down Expand Up @@ -150,6 +151,7 @@ glowroot.controller('ConfigInstrumentationCtrl', [
return [suggestion];
}
var queryData = {
serverId: $scope.serverId,
className: $scope.config.className,
partialMethodName: suggestion,
limit: 10
Expand Down Expand Up @@ -236,6 +238,7 @@ glowroot.controller('ConfigInstrumentationCtrl', [

$scope.save = function (deferred) {
var postData = angular.copy($scope.config);
postData.serverId = $scope.serverId;
var url;
if (version) {
url = 'backend/config/instrumentation/update';
Expand All @@ -259,7 +262,11 @@ glowroot.controller('ConfigInstrumentationCtrl', [
};

$scope.delete = function (deferred) {
$http.post('backend/config/instrumentation/remove', '"' + $scope.config.version + '"')
var postData = {
serverId: $scope.serverId,
version: $scope.config.version
};
$http.post('backend/config/instrumentation/remove', postData)
.success(function () {
removeConfirmIfHasChangesListener();
$location.url('config/instrumentation-list').replace();
Expand Down Expand Up @@ -326,6 +333,7 @@ glowroot.controller('ConfigInstrumentationCtrl', [

function matchingMethods(methodName) {
var queryData = {
serverId: $scope.serverId,
className: $scope.config.className,
methodName: methodName
};
Expand Down
2 changes: 1 addition & 1 deletion core/app/scripts/controllers/config/plugin-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ glowroot.controller('ConfigPluginListCtrl', [
'httpErrors',
function ($scope, $location, $http, httpErrors) {

$http.get('backend/config/plugins')
$http.get('backend/config/plugins?server-id=' + $scope.serverId)
.success(function (data) {
$scope.loaded = true;
$scope.plugins = data;
Expand Down
6 changes: 4 additions & 2 deletions core/app/scripts/controllers/config/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ glowroot.controller('ConfigPluginCtrl', [

$scope.save = function (deferred) {
var postData = {
serverId: $scope.serverId,
pluginId: $stateParams.id,
enabled: $scope.config.enabled,
properties: {},
version: $scope.config.version
Expand All @@ -55,7 +57,7 @@ glowroot.controller('ConfigPluginCtrl', [
var property = $scope.config.properties[i];
postData.properties[property.name] = property.value;
}
$http.post('backend/config/plugin/' + $stateParams.id, postData)
$http.post('backend/config/plugins', postData)
.success(function (data) {
onNewData(data);
deferred.resolve('Saved');
Expand All @@ -64,7 +66,7 @@ glowroot.controller('ConfigPluginCtrl', [
.error(httpErrors.handler($scope, deferred));
};

$http.get('backend/config/plugin/' + $stateParams.id)
$http.get('backend/config/plugins?server-id=' + $scope.serverId + '&plugin-id=' + $stateParams.id)
.success(function (data) {
onNewData(data);
})
Expand Down
51 changes: 0 additions & 51 deletions core/app/scripts/controllers/config/transaction.js

This file was deleted.

4 changes: 2 additions & 2 deletions core/app/scripts/controllers/jvm/capabilities.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2014 the original author or authors.
* Copyright 2013-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,7 +21,7 @@ glowroot.controller('JvmCapabilitiesCtrl', [
'$http',
'httpErrors',
function ($scope, $http, httpErrors) {
$http.get('backend/jvm/capabilities')
$http.get('backend/jvm/capabilities?server-id=' + $scope.serverId)
.success(function (data) {
$scope.loaded = true;
$scope.capabilities = data;
Expand Down
2 changes: 1 addition & 1 deletion core/app/scripts/controllers/jvm/gauge-values.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ glowroot.controller('JvmGaugeValuesCtrl', [
$scope.$on('$locationChangeSuccess', onLocationChangeSuccess);
});

$http.get('backend/jvm/all-gauges')
$http.get('backend/jvm/all-gauges?server-id=' + $scope.serverId)
.success(function (data) {
$scope.loaded = true;
$scope.allGauges = data;
Expand Down
14 changes: 11 additions & 3 deletions core/app/scripts/controllers/jvm/heap-dump.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,13 @@ glowroot.controller('JvmHeapDumpCtrl', [
'httpErrors',
function ($scope, $http, httpErrors) {
$scope.checkDiskSpace = function (deferred) {
var postData = {
serverId: $scope.serverId,
directory: $scope.directory
};
$scope.availableDiskSpace = false;
$scope.heapDumpResponse = false;
$http.post('backend/jvm/available-disk-space', {directory: $scope.directory})
$http.post('backend/jvm/available-disk-space', postData)
.success(function (data) {
if (data.error) {
deferred.reject(data.error);
Expand All @@ -37,9 +41,13 @@ glowroot.controller('JvmHeapDumpCtrl', [
};

$scope.dumpHeap = function (deferred) {
var postData = {
serverId: $scope.serverId,
directory: $scope.directory
};
$scope.availableDiskSpace = false;
$scope.heapDumpResponse = false;
$http.post('backend/jvm/dump-heap', {directory: $scope.directory})
$http.post('backend/jvm/dump-heap', postData)
.success(function (data) {
if (data.error) {
deferred.reject(data.error);
Expand All @@ -51,7 +59,7 @@ glowroot.controller('JvmHeapDumpCtrl', [
.error(httpErrors.handler($scope, deferred));
};

$http.get('backend/jvm/heap-dump-default-dir')
$http.get('backend/jvm/heap-dump-default-dir?server-id=' + $scope.serverId)
.success(function (directory) {
$scope.loaded = true;
$scope.directory = directory;
Expand Down
2 changes: 2 additions & 0 deletions core/app/scripts/controllers/jvm/mbean-tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ glowroot.controller('JvmMBeanTreeCtrl', [
node.loading = true;
node.expanded = true;
var queryData = {
serverId: $scope.serverId,
objectName: node.objectName
};
$http.get('backend/jvm/mbean-attribute-map' + queryStrings.encodeObject(queryData))
Expand All @@ -73,6 +74,7 @@ glowroot.controller('JvmMBeanTreeCtrl', [

$scope.refresh = function (deferred) {
var queryData = {
serverId: $scope.serverId,
expanded: expandedObjectNames
};
$http.get('backend/jvm/mbean-tree' + queryStrings.encodeObject(queryData))
Expand Down
4 changes: 2 additions & 2 deletions core/app/scripts/controllers/jvm/process-info.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2013-2014 the original author or authors.
* Copyright 2013-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -21,7 +21,7 @@ glowroot.controller('JvmProcessInfoCtrl', [
'$http',
'httpErrors',
function ($scope, $http, httpErrors) {
$http.get('backend/jvm/process-info')
$http.get('backend/jvm/process-info?server-id=' + $scope.serverId)
.success(function (data) {
$scope.loaded = true;
$scope.data = data;
Expand Down

0 comments on commit d377759

Please sign in to comment.