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

Commit

Permalink
HWKALERTS-77 Add resourcePath into Trigger.context
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasponce committed Sep 22, 2015
1 parent 0a3f145 commit 281372c
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ module HawkularMetrics {
respUpdateConditions = [
{
triggerId: respTriggerId,
conditionSetSize: 1,
conditionSetIndex: 1,
type: 'THRESHOLD',
dataId: dataId1,
threshold: this.adm.resp.waitTimeThreshold,
Expand All @@ -131,8 +129,6 @@ module HawkularMetrics {
respUpdateConditions = [
{
triggerId: respTriggerId,
conditionSetSize: 1,
conditionSetIndex: 1,
type: 'THRESHOLD',
dataId: dataId2,
threshold: this.adm.resp.creationTimeThreshold,
Expand All @@ -147,8 +143,6 @@ module HawkularMetrics {
respUpdateConditions = [
{
triggerId: respTriggerId,
conditionSetSize: 2,
conditionSetIndex: 1,
type: 'THRESHOLD',
dataId: dataId1,
threshold: this.adm.resp.waitTimeThreshold,
Expand All @@ -160,8 +154,6 @@ module HawkularMetrics {
},
{
triggerId: respTriggerId,
conditionSetSize: 2,
conditionSetIndex: 2,
type: 'THRESHOLD',
dataId: dataId2,
threshold: this.adm.resp.creationTimeThreshold,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ module HawkularMetrics {
actions: {email: [this.defaultEmail]},
context: {
resourceType: 'DataSource',
resourceName: resId
resourceName: resId,
resourcePath: this.$rootScope.resourcePath
}
},
dampenings: [
Expand Down Expand Up @@ -191,8 +192,6 @@ module HawkularMetrics {
conditions: [
{
triggerId: triggerId,
conditionSetSize: 2,
conditionSetIndex: 1,
type: 'THRESHOLD',
dataId: dataId1,
threshold: AppServerDatasourcesDetailsController.DEFAULT_WAIT_THRESHOLD,
Expand All @@ -204,8 +203,6 @@ module HawkularMetrics {
},
{
triggerId: triggerId,
conditionSetSize: 2,
conditionSetIndex: 2,
type: 'THRESHOLD',
dataId: dataId2,
threshold: AppServerDatasourcesDetailsController.DEFAULT_CREA_THRESHOLD,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ module HawkularMetrics {
actions: {email: [this.defaultEmail]},
context: {
resourceType: 'App Server',
resourceName: resourceId
resourceName: resourceId,
resourcePath: this.$rootScope.resourcePath
}
},
dampenings: [
Expand Down Expand Up @@ -139,7 +140,8 @@ module HawkularMetrics {
actions: {email: [this.defaultEmail]},
context: {
resourceType: 'App Server',
resourceName: resourceId
resourceName: resourceId,
resourcePath: this.$rootScope.resourcePath
}
},
dampenings: [
Expand Down Expand Up @@ -189,7 +191,8 @@ module HawkularMetrics {
actions: {email: [this.defaultEmail]},
context: {
resourceType: 'App Server',
resourceName: resourceId
resourceName: resourceId,
resourcePath: this.$rootScope.resourcePath
}
},
dampenings: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ module HawkularMetrics {
actions: {email: [this.defaultEmail]},
context: {
resourceType: 'App Server',
resourceName: resourceId
resourceName: resourceId,
resourcePath: this.$rootScope.resourcePath
}
},
dampenings: [
Expand Down Expand Up @@ -144,7 +145,8 @@ module HawkularMetrics {
actions: {email: [this.defaultEmail]},
context: {
resourceType: 'App Server',
resourceName: resourceId
resourceName: resourceId,
resourcePath: this.$rootScope.resourcePath
}
},
dampenings: [
Expand Down Expand Up @@ -196,7 +198,8 @@ module HawkularMetrics {
actions: {email: [this.defaultEmail]},
context: {
resourceType: 'App Server',
resourceName: resourceId
resourceName: resourceId,
resourcePath: this.$rootScope.resourcePath
}
},
dampenings: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ module HawkularMetrics {
resourcePath: this.$routeParams.resourceId + '~~'
}, (resource:IResourcePath) => {
this.resourcePath = resource.path;
this.$rootScope.resourcePath = this.resourcePath;
});

$scope.tabs = this;
Expand Down
15 changes: 13 additions & 2 deletions console/src/main/scripts/plugins/metrics/ts/urlList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ module HawkularMetrics {
var defaultEmail = this.$rootScope.userDetails.email || 'myemail@company.com';
var err = (error:any, msg:string):void => this.ErrorsManager.errorHandler(error, msg);
var currentTenantId:TenantId = this.$rootScope.currentPersona.id;
var resourcePath :string;

/// Add the Resource and its metrics
this.HawkularInventory.Resource.save({environmentId: globalEnvironmentId}, resource).$promise
Expand Down Expand Up @@ -200,6 +201,14 @@ module HawkularMetrics {

// Create threshold trigger for newly created metrics
.then(() => {

for (let i=0; i < this.resourceList.length; i++) {
if (metricId === this.resourceList[i].id) {
resourcePath = this.resourceList[i].path;
break;
}
}

var triggerId = metricId + '_trigger_thres';
var dataId: string = triggerId.slice(0,-14) + '.status.duration';
var fullTrigger = {
Expand All @@ -210,7 +219,8 @@ module HawkularMetrics {
actions: {email: [defaultEmail]},
context: {
resourceType: 'URL',
resourceName: url
resourceName: url,
resourcePath: resourcePath
}
},
dampenings: [
Expand Down Expand Up @@ -271,7 +281,8 @@ module HawkularMetrics {
actions: {email: [defaultEmail]},
context: {
resourceType: 'URL',
resourceName: url
resourceName: url,
resourcePath: resourcePath
}
},
dampenings: [
Expand Down

0 comments on commit 281372c

Please sign in to comment.