Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Removing the tenantId parameter when calling HawkularInventory.Someth…
Browse files Browse the repository at this point in the history
…ing.something(), because it's not needed anymore.
  • Loading branch information
jkremser authored and ppalaga committed Jun 24, 2015
1 parent 5157e1e commit ba7633f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,16 @@ module Inventory {
var envId = 'test';

$scope.queryResources = function() {
if(this.tenantId) {
this.resources = hkInventory.ResourceOfType.query({tenantId: this.tenantId, resourceTypeId: 'URL'}, function(data) {
angular.forEach(data, function(value) {
value.metrics = hkInventory.ResourceMetric.query({tenantId: $scope.tenantId, environmentId: envId, resourceId: value.id});
});
this.resources = hkInventory.ResourceOfType.query({resourceTypeId: 'URL'}, function(data) {
angular.forEach(data, function(value) {
value.metrics = hkInventory.ResourceMetric.query({environmentId: envId, resourceId: value.id});
});
}
});
};

$scope.queryMetrics = function() {
if(this.tenantId && this.resourceId && envId) {
this.metrics = hkInventory.ResourceMetric.query({tenantId: this.tenantId, environmentId: envId, resourceId: this.resourceId});
if(this.resourceId && envId) {
this.metrics = hkInventory.ResourceMetric.query({environmentId: envId, resourceId: this.resourceId});
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ module HawkularMetrics {
var currentTenantId: TenantId = this.$rootScope.currentPersona.id;

/// Add the Resource and its metrics
this.HawkularInventory.Resource.save({tenantId: currentTenantId, environmentId: globalEnvironmentId}, resource).$promise
this.HawkularInventory.Resource.save({environmentId: globalEnvironmentId}, resource).$promise
.then((newResource) => {
this.getResourceList(currentTenantId);
metricId = resourceId;
Expand All @@ -128,13 +128,11 @@ module HawkularMetrics {
var errMetric = (error: any) => err(error, 'Error saving metric.');
var createMetric = (metric: any) =>
this.HawkularInventory.Metric.save({
tenantId: currentTenantId,
environmentId: globalEnvironmentId
}, metric).$promise;

var associateResourceWithMetrics = () =>
this.HawkularInventory.ResourceMetric.save({
tenantId: currentTenantId,
environmentId: globalEnvironmentId,
resourceId: resourceId
}, metricsIds).$promise;
Expand Down Expand Up @@ -170,7 +168,7 @@ module HawkularMetrics {

getResourceList(currentTenantId?: TenantId):any {
var tenantId:TenantId = currentTenantId || this.$rootScope.currentPersona.id;
this.HawkularInventory.ResourceOfType.query({tenantId: tenantId, resourceTypeId: 'URL', per_page: this.resPerPage, page: this.resCurPage}, (aResourceList, getResponseHeaders) => {
this.HawkularInventory.ResourceOfType.query({resourceTypeId: 'URL', per_page: this.resPerPage, page: this.resCurPage}, (aResourceList, getResponseHeaders) => {
// FIXME: hack.. make expanded out of list
this.headerLinks = this.HkHeaderParser.parse(getResponseHeaders());

Expand Down Expand Up @@ -261,14 +259,12 @@ module HawkularMetrics {
var triggerIds: string[] = [this.resource.id + '_trigger_thres', this.resource.id + '_trigger_avail'];
var deleteMetric = (metricId: string) =>
this.HawkularInventory.Metric.delete({
tenantId: this.$rootScope.currentPersona.id,
environmentId: globalEnvironmentId,
metricId: metricId
}).$promise;

var removeResource = () =>
this.HawkularInventory.Resource.delete({
tenantId: this.$rootScope.currentPersona.id,
environmentId: globalEnvironmentId,
resourceId: this.resource.id
}).$promise;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ module HawkularMetrics {
resolve: {
hkResourceList: function ($filter, $location, $rootScope, $q, HawkularInventory) {
var resPromise = HawkularInventory.Resource.query({
tenantId: $rootScope.currentPersona.id,
environmentId: globalEnvironmentId
}).$promise;
resPromise.then(function (hkResourceList) {
Expand Down

0 comments on commit ba7633f

Please sign in to comment.