Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 68a430d

Browse files
committedAug 21, 2015
updating to new ui-services
1 parent 1c015a7 commit 68a430d

File tree

7 files changed

+55
-25
lines changed

7 files changed

+55
-25
lines changed
 

‎console/src/main/scripts/bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"angular-toastr": "1.4.1",
2222
"bootstrap-select": "1.6",
2323
"hawkular-charts": "~0.4.11",
24-
"hawkular-ui-services": "~0.6.1",
24+
"hawkular-ui-services": "Jiri-Kremser/hawkular-ui-services#HAWKULAR-565",
2525
"hawtio-core-navigation": "2.0.51",
2626
"hawtio-core": "2.0.16",
2727
"hawtio-template-cache": "2.0.3",

‎console/src/main/scripts/plugins/directives/topbar/ts/topbarDirective.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ module Topbar {
3030
}
3131

3232
export var TopbarController = _module.controller('Topbar.TopbarController',
33-
['$scope', '$rootScope', '$location', '$route', '$routeParams', 'HawkularNav', 'HawkularInventory',
34-
($scope, $rootScope, $location, $route, $routeParams, HawkularNav, HawkularInventory) => {
33+
['$scope', '$rootScope', '$location', '$route', '$routeParams', 'HawkularNav',
34+
($scope, $rootScope, $location, $route, $routeParams, HawkularNav) => {
3535

3636
$scope.getClass = function(path) {
3737
return $location.path().indexOf(path) === 0 ? 'active' : '';

‎console/src/main/scripts/plugins/metrics/ts/app-details/appServerDatasourcesDetails.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,12 @@ module HawkularMetrics {
102102
this.startTimeStamp = this.endTimeStamp - (this.$routeParams.timeOffset || 3600000);
103103

104104
var tenantId:TenantId = currentTenantId || this.$rootScope.currentPersona.id;
105-
this.HawkularInventory.ResourceOfType.query({resourceTypeId: 'Datasource'},
106-
(aResourceList, getResponseHeaders) => {
105+
var idParts = this.$routeParams.resourceId.split('~');
106+
var feedId = idParts[0];
107+
this.HawkularInventory.ResourceOfTypeUnderFeed.query({
108+
environmentId: globalEnvironmentId,
109+
feedId: feedId,
110+
resourceTypeId: 'Datasource'}, (aResourceList, getResponseHeaders) => {
107111
var promises = [];
108112
var tmpResourceList = [];
109113
angular.forEach(aResourceList, function(res, idx) {

‎console/src/main/scripts/plugins/metrics/ts/app-details/appServerDeploymentsDetails.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,12 @@ module HawkularMetrics {
8484
public getResourceList(currentTenantId?: TenantId): any {
8585
this.alertList = []; // FIXME: when we have alerts for app server
8686
var tenantId:TenantId = currentTenantId || this.$rootScope.currentPersona.id;
87-
this.HawkularInventory.ResourceOfType.query({resourceTypeId: 'Deployment'},
88-
(aResourceList, getResponseHeaders) => {
87+
var idParts = this.$routeParams.resourceId.split('~');
88+
var feedId = idParts[0];
89+
this.HawkularInventory.ResourceOfTypeUnderFeed.query({
90+
environmentId: globalEnvironmentId,
91+
feedId: feedId,
92+
resourceTypeId: 'Deployment'}, (aResourceList, getResponseHeaders) => {
8993
var promises = [];
9094
var tmpResourceList = [];
9195
angular.forEach(aResourceList, function(res: any) {

‎console/src/main/scripts/plugins/metrics/ts/app-details/appServerJvmAlerts.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ module HawkularMetrics {
7777

7878
var triggerId: string = this.resourceId + '_jvm_pheap';
7979
var resourceId: string = triggerId.slice(0,-10);
80-
var dataId: string = 'MI~R~[' + resourceId + '~/]~MT~WildFly Memory Metrics~Heap Used';
80+
var dataId: string = 'MI~R~[' + resourceId + '~~]~MT~WildFly Memory Metrics~Heap Used';
8181

8282
return this.HawkularAlertsManager.createAlertDefinition({
8383
name: triggerId,
@@ -104,7 +104,7 @@ module HawkularMetrics {
104104

105105
var triggerId: string = this.resourceId + '_jvm_nheap';
106106
var resourceId: string = triggerId.slice(0,-10);
107-
var dataId: string = 'MI~R~[' + resourceId + '~/]~MT~WildFly Memory Metrics~Heap Used';
107+
var dataId: string = 'MI~R~[' + resourceId + '~~]~MT~WildFly Memory Metrics~Heap Used';
108108

109109
return this.HawkularAlertsManager.createAlertDefinition({
110110
name: triggerId,
@@ -128,7 +128,7 @@ module HawkularMetrics {
128128
// Jvm trigger doesn't exist, need to create one
129129
var triggerId: string = this.resourceId + '_jvm_garba';
130130
var resourceId: string = triggerId.slice(0,-10);
131-
var dataId: string = 'MI~R~[' + resourceId + '~/]~MT~WildFly Memory Metrics~Accumulated GC Duration';
131+
var dataId: string = 'MI~R~[' + resourceId + '~~]~MT~WildFly Memory Metrics~Accumulated GC Duration';
132132

133133
return this.HawkularAlertsManager.createAlertDefinition({
134134
name: triggerId,

‎console/src/main/scripts/plugins/metrics/ts/metricsAppServerList.ts

+17-4
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,12 @@ module HawkularMetrics {
8181
});
8282
}
8383

84-
public getResourceList(currentTenantId?: TenantId):any {
84+
public getResourceListForOneFeed(feedId: string, currentTenantId?: TenantId):any {
8585
var tenantId:TenantId = currentTenantId || this.$rootScope.currentPersona.id;
86-
this.HawkularInventory.ResourceOfType.query({resourceTypeId: 'WildFly Server', per_page: this.resPerPage,
87-
page: this.resCurPage}, (aResourceList, getResponseHeaders) => {
86+
this.HawkularInventory.ResourceOfTypeUnderFeed.query({
87+
environmentId: globalEnvironmentId, feedId: feedId,
88+
resourceTypeId: 'WildFly Server', per_page: this.resPerPage,
89+
page: this.resCurPage}, (aResourceList, getResponseHeaders) => {
8890
this.headerLinks = this.HkHeaderParser.parse(getResponseHeaders());
8991
var promises = [];
9092
angular.forEach(aResourceList, function(res, idx) {
@@ -100,7 +102,7 @@ module HawkularMetrics {
100102
this.lastUpdateTimestamp = new Date();
101103
}, this);
102104
this.$q.all(promises).then((result) => {
103-
this.resourceList = aResourceList;
105+
this.resourceList = _.union(this.resourceList, aResourceList);
104106
});
105107
},
106108
() => { // error
@@ -112,6 +114,17 @@ module HawkularMetrics {
112114
});
113115
}
114116

117+
public getResourceList(currentTenantId?: TenantId):any {
118+
// for each feed get all WF resources
119+
var tenantId:TenantId = currentTenantId || this.$rootScope.currentPersona.id;
120+
this.HawkularInventory.Feed.query({environmentId:globalEnvironmentId},
121+
(aFeedList) => {
122+
angular.forEach(aFeedList, (feed) => {
123+
this.getResourceListForOneFeed(feed.id, tenantId);
124+
});
125+
});
126+
}
127+
115128
}
116129

117130
_module.controller('HawkularMetrics.AppServerListController', AppServerListController);

‎console/src/main/scripts/plugins/metrics/ts/metricsPlugin.ts

+20-11
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,12 @@ module HawkularMetrics {
3535
when('/metrics/response-time', {
3636
templateUrl: 'plugins/metrics/html/response-time.html',
3737
resolve: {
38-
hkResourceList: function ($filter, $location, $rootScope, $q, HawkularInventory) {
39-
var resPromise = HawkularInventory.Resource.query({
40-
environmentId: globalEnvironmentId
38+
hkResourceList: function ($route, $filter, $location, $rootScope, $q, HawkularInventory) {
39+
var idParts = $route.current.params.resourceId.split('~');
40+
var feedId = idParts[0];
41+
var resPromise = HawkularInventory.ResourceUnderFeed.query({
42+
environmentId: globalEnvironmentId,
43+
feedId: feedId
4144
}).$promise;
4245
resPromise.then(function (hkResourceList) {
4346
$location.path('/metrics/response-time/' + hkResourceList[0].id);
@@ -57,8 +60,10 @@ module HawkularMetrics {
5760
reloadOnSearch: false,
5861
resolve: {
5962
resource: function ($route, $location, HawkularInventory, NotificationsService:INotificationsService) {
60-
var p = HawkularInventory.Resource.get({environmentId: globalEnvironmentId,
61-
resourceId: $route.current.params.resourceId}).$promise;
63+
var idParts = $route.current.params.resourceId.split('~');
64+
var feedId = idParts[0];
65+
var p = HawkularInventory.ResourceUnderFeed.get({environmentId: globalEnvironmentId,
66+
feedId: feedId, resourceId: $route.current.params.resourceId}).$promise;
6267
p.then((response:any) => {
6368
return response.properties.url;
6469
},
@@ -75,8 +80,10 @@ module HawkularMetrics {
7580
reloadOnSearch: false,
7681
resolve: {
7782
resource: function ($route, $location, HawkularInventory, NotificationsService:INotificationsService) {
78-
var p = HawkularInventory.Resource.get({environmentId: globalEnvironmentId,
79-
resourceId: $route.current.params.resourceId}).$promise;
83+
var idParts = $route.current.params.resourceId.split('~');
84+
var feedId = idParts[0];
85+
var p = HawkularInventory.ResourceUnderFeed.get({environmentId: globalEnvironmentId,
86+
feedId: feedId, resourceId: $route.current.params.resourceId}).$promise;
8087
p.then((response:any) => {
8188
return response.properties.url;
8289
},
@@ -93,8 +100,10 @@ module HawkularMetrics {
93100
reloadOnSearch: false,
94101
resolve: {
95102
resource: function ($route, $location, HawkularInventory, NotificationsService:INotificationsService) {
96-
var p = HawkularInventory.Resource.get({environmentId: globalEnvironmentId,
97-
resourceId: $route.current.params.resourceId}).$promise;
103+
var idParts = $route.current.params.resourceId.split('~');
104+
var feedId = idParts[0];
105+
var p = HawkularInventory.ResourceUnderFeed.get({environmentId: globalEnvironmentId,
106+
feedId: feedId, resourceId: $route.current.params.resourceId}).$promise;
98107
p.then((response:any) => {
99108
return response.properties.url;
100109
},
@@ -123,10 +132,10 @@ module HawkularMetrics {
123132
redirectMissingAppServer();
124133
return;
125134
}
126-
var p = HawkularInventory.FeedResource.get({
135+
var p = HawkularInventory.ResourceUnderFeed.get({
127136
environmentId: globalEnvironmentId,
128137
feedId: idParts[0],
129-
resourceId: $route.current.params.resourceId + '~/'
138+
resourceId: $route.current.params.resourceId + '~~'
130139
}).$promise;
131140
p.then((response) => {
132141
return response;

0 commit comments

Comments
 (0)
Please sign in to comment.